Quantcast
Channel: DesignSpark - Home - DesignSpark
Viewing all 280 articles
Browse latest View live

With just 1 hour... What Could You Achieve with the PanelPilot ACE Software?

$
0
0

We were talking to the guys at DesignSpark and the conversation got around to what we could do if we had an extra hour, walk about 4 miles, watch an episode of Game of Thrones, clean the fridge (thanks Pete) or try to stay away from our smart phones.

title

After getting to the silly answers the guys at DesignSpark set us a challenge, the only criteria was that we had 1 hour, we had to use PanelPilotACE Design Studio, we had to write a blog and record the challenge (see video below).

This is what we came up with...

Measuring the Angle of a Vector with PanelPilotACE

Of the features added to the PanelPilotACE Design Studio software with the recent release of a public BETA, the maths builder was the one I wanted to get to grips with first. This feature adds much needed control and flexibility to the Design Studio software, allowing users to actually work with the analogue and digital inputs and introduce more control elements into projects.

The idea behind the project was to use two analogue inputs (both ±5V d.c.) each representing a distance of ±50mm on the X and Y axis. I wanted to use the maths builder to calculate and display the angle that these two distances create when describing a vector.

title

I do recommend reading this article with the software open so that you can aee how the project elements go together. I have split the porject in to 4 stages.

1. Creating the Background in Adobe Illustrator
The drawing tools in PanelPilotACE Design Studio are fairly basic so I use Adobe Illustrator to create the dial which will show the angle. To do this I make two circles each with 5 pixel strokes to create the two-tone outside of the dial. I then use the pen tool to create a mark on the dial. This mark is rotated and copied around the centre point of the circle by 10°. The ‘Transform Again (CTRL-D)’ tool repeats this operation to create a mark every 10° around the circumference of the circle. Markings for the analogue inputs and an X/Y axis in the middle of the circle are also added.

Lastly the pointer/arrow for the angle dial is created and a new ‘artboard’ added so that this exports as a separate image file. Using transparency, the bottom centre point is located at the correct distance for the centre of the dial.

 title

You can see the size of the arrow image with the dotted lines. Other than the yellow artwork the rest of the image is transparent so it appears to revolve around a remote point.
The artwork is exported to .png using ‘artboards’ and ‘transparency’

2. Creating the Analogue Scales in PanelPilotACE Design Studio
Having opened up the BETA release of the software I drop the two images (one-by-one) from an Explorer window straight onto the project screen.
I then add the main visual elements which include four rectangles (90 x 2 px) to describe the ±50mm scales of the analogue inputs and seven text boxes (three for readings: X, Y, and angle; the rest for units/labels).
The two analogue inputs are set to ±5Vd.c. (x_axis_vin & y_axis_vin). Four fill meters (x_axis_neg, x_axis_pos, y_axis neg, & y_axis_pos) are added which together with the four rectangles created above make the centred X and Y axis.
Finally, two digital meters (x_axis_dig & y_axis_dig) are added and linked to the same analogue inputs and the respective text boxes to give a numerical readout of the X/Y values.

3. Calculating Vector Angle with the Mathematics Builder
The scaled analogue voltages describe the X and Y distance from the origin and hence provide the values I need to calculate the angle:
If Y is positive:
Tan-1 x (Xmm / Ymm) x 180/π
If Y is negative:
(Tan-1 x (Xmm / Ymm) x 180/π) + 180
As such I set up two maths builder functions (calc_angle_if & calc_angle_else) and a logic builder to test the value of Y (if_y_positive).
Think of the maths builder values like a variable. The number is stored there at all times, but nothing is done with it unless you equate something like a visual element to it. The most effective way to use the information in a maths builder is to run an ‘Action (Set Rule)’ element. So two of these are added. One for when the Y value is positive, and one for when it is negative. Both do broadly the same thing in equating the angle text box (angle_text) to the result of the respective maths builder, and then the angle of the pointer/arrow to the value of this text box.
Finally I use a timer (set to run every 250ms) to run the ‘if_y_positive’ logic builder, which sets off the chain of events described above!
Here’s a block diagram of what’s happening:

title

4. Moving an Object Using Analogue Inputs and Maths Builder
I wanted to show a pointer that represented the end-point of the vector we’re calculating the angle of. I start by creating a 4px x 4px ellipse and placing this on the cross of the axis in the centre of the dial. I record the X and Y coordinates of this position.
I then add two more maths builder elements one to add the X-axis mm reader to the recorded X coordinate, and the other to do likewise for the Y-axis. Finally I equate the X and Y properties of the ellipse to the results of the two maths functions using the ‘Action (Set Rule)’ elements created above.

Here is the video we recorded, sped up so that you can watch it in under 2 mins.

titleScreenshot from the video of the final emulator screen

Note: Workaround for BETA bug
The code for supressing decimal places is not yet working in the public BETA. As such, when taking number information out of the maths builder you may need to add a ‘String Builder’ element to remove unwanted decimal places. In this case within the String Builder select the appropriate maths builder value from the drop-down and use the slider to reduce the decimal places as required. Then change the ‘Action (Set Rule)’ to equate the Angle text box to the String Builder result instead of the Maths Builder. This will be resolved for the next full release version.

Your Hour Challenge And You Could Win a PanelPilotACE Development Kit:

So what do you think that you can achieve with PanelPilotACE Design Studio?
We have a challenge for DesignSpark members to create a project and load it to DesignSpark where the PanelPilot team will judge the best and award the prize. The Winner will receive a Lacar PanelPilot ACE TFT Development Kit including the PanelPilot ACE Display 

Click HERE To Enter the Competition


New for April

Parallella Technical Conference in Tokyo

$
0
0

title

The Parallella is a credit-sized platform with a super energy-efficient multicore chip, Epiphany, from Adaptiva. Surprisingly, the world's first conference of Parallella will be held in Tokyo in the end of May. In this event, Mr.Andreas Olofsson, Adaptiva CEO and designer of Parallella, will attend the conference and he will talk about applications of Parallella and plans for the future.

To attend the conference, you need to register!

Outline

  • Date:                 2p.m. - 6p.m. May 30th Sat.
                              (P
    ost-conference party: 6p.m. - 8p.m.)
  • Venue:             DMM.make Akiba (https://akiba.dmm-make.com/)
  • Contents:        Presentaions, demos and discussions by Andreas and users
  • Fee:                  Free registration (1,000 Yen for post-conference party)
  • Registration:
                 If you want to join the event as an AUDIENCE, click HERE to register. 
                 If you want to join the event as a PRESENTER, click HERE to register.
  • Co-sponsor:  RS Components K.K


title

Register to win

Building an MQTT enabled application with Cylon.js

$
0
0

title

Integrating an Intel Edison sensor node with Node-RED running on a Raspberry Pi 2.

In this post we will connect an infra-red distance sensor to an Intel Edison and publish readings to an MQTT topic. We will use a Raspberry Pi 2 running Node-RED to subscribe to this topic, process the data and publish a boolean to a new topic.

As covered in a previous post, MQTT or 'Message Queueing Telemetry Transport' is a Machine-to-Machine (M2M) or Internet of Things (IoT) connectivity protocol. We can use MQTT to send messages between different platforms, including the Raspberry Pi and Intel Edison as we will in this post. We will make use of the Mosquitto MQTT broker we set up previously.

We will assume that you are using the Edison Arduino breakout board, have the latest Yocto image installed and can login over the network via SSH. We will also assume you have Mosquitto and Node-RED installed on a Raspberry Pi 2.

Setting up Cylon.js on the Edison

We will use the Cylon.js JavaScript framework to create a simple application to read the sensor and connect to our MQTT broker. We have used Cylon.js on the Edison before. We need to install the MRAA library first. Log in to your Edison terminal and execute the following commands:

$ echo “src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/mraa-upm.conf

$ opkg update

$ opkg install libmraa0

Once the MRAA library is installed we can install cylon-intel-iot, the Cylon.js adaptor for the Intel Edison and Galileo platforms.

$ npm install cylon-intel-iot

Next test that the install is working correctly by blinking the onboard LED:

  • Create a file called blinkTest.js
  • Copy the sample code from the Cylon tutorial page (under the heading 'Blinking the built in LED') into your blinkTest.js file
  • Save the file
  • Execute the file on the Edison:
  • $ node blinkTest.js
  • You should see confirmation in the console window and the onboard LED blinking
  • Press ctrl-c to stop

Setting up MQTT

Next let's get MQTT running on the Edison. Start by installing the cylon-mqtt module:

$ npm install cylon-mqtt

Now we will create a test script to publish to an MQTT topic. Open a new browser window, head to the Node-RED install running on your Pi (<YOUR-PI-IP:1883>). Find the flow we made that contained MQTT input and output nodes (see the flow we created in this post for detail on how to set this up). We will refer to this flow to test the following MQTT messages.

On the Edison, create a file named testMQTT.js and paste in the following code:

var Cylon = require('cylon');

Cylon.robot({

connections: {

server: { adaptor: 'mqtt', host: 'mqtt://<YOUR-PI-IP-ADDRESS>:1883', username: '<YOUR-DEFINED-USER>', password: '<YOUR-PASSWORD>' }

},

work: function(my) {

// below 4 lines are for subscribing to chosen topic

// my.server.subscribe('topic/test');

// my.server.on('message', function (topic, data) {

// console.log(topic + ": " + data);

// });

// below 4 lines are for publishing to topic

every((5).seconds(), function() {

console.log("Saying hello...");

my.server.publish('topic/test', 'hi there');

});

}

}).start();

Notice that the above includes code for both subscribing and publishing to an MQTT topic – for now we have the subscribing part commented out and are just interested in testing the publishing part. Change the server details in the <brackets>. Save the file and execute it:

$ node testMQTT.js

title

You should see something similar to the screen shot above. Now go to Node-RED flow on the Pi and watch the debug panel. As our existing MQTT input node is subscribed to the 'topic/test' topic, messages from the Edison should be displayed in the Node-RED debug console.

Next let's test the subscribe function in the previous code. Open the editor again, uncomment the 4 lines for subscribing and comment out the 4 lines for publishing. Save and execute your code. Now you will have to publish test messages to your topic, we can use the test inject node that we created in Node-RED previously. When clicking the button on the inject node in Node-RED you should see the messages echoed in the terminal window on the Edison running the testMQTT.js file.

title

Adding a distance sensor

title

Now we have our Edison successfully publishing and subscribing to MQTT topics, let's use sensor data rather than test messages. We will connect a Sharp reflective infra-red sensor to the Edison and use Cylon.js to read the data, format it and publish it to an MQTT topic.

Hardware used:

Connect the sensor to the Edison as shown in the above diagram. Create a file named distMQTT.js and paste in the following code:

var Cylon = require('cylon');

Cylon.robot({

connections: {

edison: { adaptor: 'intel-iot' },

server: { adaptor: 'mqtt', host: 'mqtt://<YOUR-PI-IP-ADDRESS>:1883',

username: '<YOUR-USERNAME>', password: '<YOUR-PASSWORD>' },

},

devices: {

sensor: { driver: 'ir-range-sensor', pin: 0, model: 'gp2y0a41sk0f' }

},

work: function(my) {

every((5).seconds(), function() {

var range = my.sensor.range();

var ra = range.toFixed(2);

var r = ra.toString();

console.log("Publishing range");

my.server.publish('topic/test', r);

});

}

}).start();

Remember to change the necessary fields in the <brackets>. Save the file and execute it on the Edison:

$ node distMQTT.js

title

You should see several lines output to the terminal as above before regular 'Publishing range' messages. You should now be able to switch back to your Node-RED install that is subscribed to the same MQTT topic and see the messages from the Edison appearing in the debug window.

Now that we have data coming into Node-RED we can process this (in this case on a Raspberry Pi) before sending messages back to the sensor node. This is useful where we might want to deploy many lightweight sensor nodes and use a single more powerful central node to do the processing. We can then return the output to the sensor nodes or other nodes as needed. Note that the Edison would be more than capable of performing this particular task and this is to demonstrate one possible configuration and the flexibility of this architecture.

To do this we will set up another Node-RED flow that subscribes to the topic that the distance sensor is publishing to and returns a boolean depending on it's value.

First find the line in the distMQTT.js file that determines the topic we are publishing to:

my.server.publish('topic/test', r);

Change the topic to 'dist':

my.server.publish('topic/dist', r);

Save the file and go to your Node-RED flow editor. Start a new flow and drag in an MQTT input node. Double-click the MQTT node and add the topic 'topic/dist' in the topic field. Your broker details should have been saved from earlier use, if not add those too. Close the node edit window and drag in a debug node. Connect the two nodes together and deploy. Switch back to your Edison terminal and execute the distMQTT.js file as before. You should see the distance data appearing in the debug window in Node-RED.

title

Now we can evaluate the sensor data and publish a boolean to a topic. Disconnect the two nodes in your flow and drag in a function node. Double-click it to open the editor window and paste in the following code:

var n = parseInt(msg.payload);

msg.payload = n;

return msg;

This converts our incoming message into an integer that we can pass to the next node for evaluation. Close the editor window and drag in a switch node. Double-click it and add the conditions as below.

title

Next drag in 2 trigger nodes and edit one as below and the second in a similar way except changing the output from '1' to '0' and the name from 'tooClose' to 'safeDistance'. Now drag in an MQTT output node, double-click it and give it a topic of 'topic/distReturn'. Name the node 'distReturn' and close the editor panel.

title

Connect the nodes up as above and deploy your flow. You should now see either a 0 or 1 appear in your debug window depending on the value passed from the distance sensor and the value (4 in above example) in our switch node.

Now we simply need to modify our distMQTT.js file to subscribe the Edison to the correct topic. Edit the file, delete the existing contents and copy in the code below:

var Cylon = require('cylon');

Cylon.robot({

connections: {

edison: { adaptor: 'intel-iot' },

server: { adaptor: 'mqtt', host: 'mqtt://<YOUR-PI-IP-ADDRESS>:1883',

username: '<YOUR-USERNAME>', password: '<YOUR-PASSWORD>' },

},

devices: {

sensor: { driver: 'ir-range-sensor', pin: 0, model: 'gp2y0a41sk0f' }

},

work: function(my) {

my.server.subscribe('topic/distReturn');

my.server.on('message', function (topic, data) {

console.log(topic + ": " + data);

});

every((5).seconds(), function() {

var range = my.sensor.range();

var ra = range.toFixed(2);

var r = ra.toString();

console.log("Publishing range");

my.server.publish('topic/dist', r);

});

}

}).start();

title

Save the file and execute it on the Edison. You should now see messages being published and subscribed in both the Edison terminal and Node-RED debug window as above.

Final thoughts

This example shows how we can use MQTT to send data between different hardware and software platforms. Instead of the Edison we could be using an Arduino Ethernet, a BeagleBone Black or even another Raspberry Pi. We could also be using applications written in Python or other languages as well as those based on Cylon.js and Node-RED.

DesignSpark PCB リファレンスデザインの使い方

$
0
0

この記事では、Designspark PCB リファレンスデザインカタログに掲載されているリファレンスデザインの使い方についてご紹介します。回路図、PCBレイアウトデータの開き方、ライブラリの読み込み方、BOM注文の仕方、3D表示、Designspark Mechanicalへの書出し方について説明していきます。

リファレンスデザインカタログとは

リファレンスデザインカタログでは、有名メーカーのリファレンスデザインやオープンソースハードウェアプロジェクトのデザインをDesignspark PCB形式で無償で提供しています。提供されるデザインには、通常、回路図ファイル、PCBレイアウトファイル、部品ライブラリ、部品表が含まれています。リファレンスデザインはそのまま利用することももちろん可能ですし、回路図とライブラリを用いて、独自の基板を作成することも可能です。デザインは世界で随時追加されています。

title

デザインのダウンロード

まず、カタログページにアクセスして、メーカーを選択します。たとえば、ROHMの製品を見てみます。

title

すると、ROHMのページに移り、メーカーごとのデザインの一覧が表示されます。ダウンロードしたいデザインを選んでください。

title

ルネサスのGR-KURUMIボードのページに移動して、デザインをダウンロードしてみます。デザインをダウンロードするには、記事の冒頭にある"リファレンスデザインをダウンロード"というボタンをクリックしてください。場合によっては、記事の一番下のDownloads欄からダウンロードするタイプのページもあります。Zipファイルがダウンロードされますので解凍してください。

title

title

解凍すると、フォルダの中身は次のようになっています(ダウンロードするデザインによって多少異なります)。拡張子が.prjのファイルがプロジェクトファイルとなっていますので、通常Designspark PCBを利用する際は、このファイルを開いてください。拡張子が、.schのファイルが回路図、.pcbのファイルがPCBレイアウトとなります。.csvのファイルは、部品表です。

title

さらに上記、Libraryフォルダの中には部品ライブラリ用のファイルが6つ(コンポーネントライブラリ、回路図シンボル、PCBシンボルファイルが2つずつ)入っています。

title

リファレンスデザインに含まれるファイル一覧

拡張子ファイルの種類説明
.prjプロジェクトファイル プロジェクトを管理するファイルです。
リファレンスデザインを参照する際は、このファイルを開いてください。
.sch回路図ファイル 回路図のデータの入ったファイルです。
このファイルを直接開くことも可能です。
.pcbPCBレイアウトファイル PCBレイアウトのデータの入ったファイルです。
このファイルを直接開くことも可能です。 
.csvCSV形式部品表 CSV形式の部品表です。通常、Excelなどで開くことができます。
.txtDRCエラー説明書 DRCをかけると、エラーが出ることがありますが、それに関する注意書きです。
.cmx, .cmlコンポーネントライブラリファイル コンポーネントのデータが入っています。
.psx, .pslPCBフットプリントファイルフットプリントシンボルのデータが入っています。 
.ssx, .ssl回路図ライブラリファイル回路図シンボルのデータが入っています。 

 

デザインの読み込み

Designspark PCBを起動して、.prjファイルを開いてください。このようなファイル一覧が表示されます。回路図やPCBパターンを開きたい場合、一覧のファイル名をダブルクリックします。

title

すると、このようにアイコンがハイライトされ、それぞれのファイルを開くことができます。

title

title

title

ライブラリの読み込み

まず、画面左上のライブラリアイコンをクリックします。

title

ライブラリマネージャウインドウが開きますので、Foldersタブを選択してください。そして、Add...ボタンをクリックします。(*画像は加工しています。実際にはライブラリのある場所のパスが表示されます。)

title

ライブラリのフォルダを指定する画面へと移ります。Browse...ボタンを押して、先ほどの解凍したフォルダ内のLibraryフォルダを指定して、OKをクリックしてください。ライブラリをデフォルトのライブラリと同じ場所など特定の場所に置いておきたい場合は、先にLibraryフォルダ内のファイルをその場所にコピーしてから、その場所をフォルダとして指定するようにしてください。

title

ライブラリマネージャの画面に戻りますが、Folder Enabledと各ライブラリファイルにEnabledのチェックが入っていることを確認してください。入っていなければ、チェックを入れてください。最後に適用をクリックして、ウインドウを閉じます。

title

これで、ライブラリを通常の手順で読みだせるようになります。

title

BOM(部品表) Quoteによる部品の発注

Designspark PCBでは、BOM Quote機能を使ってRSに直接部品を注文することができます。画面、右上のBOM Quoteボタンをクリックします。

title

するとブラウザが開き、RSの在庫と照合されます。この際、テキストファイルが開くかもしれませんが無視して大丈夫です。リファレンスデザインファイルでは、RSの取り扱っている部品にはRS品番が登録されていますので、それによって指定の部品を探すことができます。関係のない部品のデータを表示させないため、「この部品でOK」した部品のみを表示に切り替えてください。RSに在庫する部品の一覧が表示されます。このまま注文する場合は手続きを進めてください。なお、ご注文の際は必ず注文内容を再度、ご自身でご確認いただくよう、よろしくお願いいたします。

title

3D表示とMechanicalデータの書き出し

3D表示

PCBレイアウトを表示させた状態のメニューで3D>3D View...を選択します。

title

3D表示されます。基板の色や厚みについては環境の設定が適用されるので、変更したい場合はこちらのページの一番最後の方の説明をご参照下さい。

title

Designspark Mechanicalへの出力

メニューから、Output>DesignSpark Mechanical(IDF)...を選択します。

title

出力先と基板の厚みを指定して、OKをクリックします。

title

出力先のフォルダには、次の.idbと.idlの2つのファイルが生成されます。

title

Designspark Mechanicalを起動して、このファイルを開くと次のように基板をDesignsparkのオブジェクトとして扱えます。また、このオブジェクトをDesignspark Mechanicalの形式としても保存できます。

title

まとめ

以上がリファレンスデザインファイルの使い方になります。リファレンスデザインを利用することによって、高度な回路もより手軽に扱うことができたり、ライブラリを自分のデザインに利用したりできるようになります。ぜひ一度お試しください。

関連記事

DESIGNSPARK PCBをダウンロード

Designspark PCBはフル機能を商用利用を含め、完全無料でご利用いただける基板設計ソフトウェアです。多数のチュートリアル等を公開しております→Designspark PCBの使い方一覧

 

リファレンスデザインカタログでは他にも多数のリファレンスデザインをご用意しております。


免責:本リファレンスデザインの各種設計データ(本設計データ)のご使用は自己責任でお願いいたします。

Working together

11 Internet of Things (IoT) Protocols You Need to Know About

$
0
0

titleThere exists an almost bewildering choice of connectivity options for electronics engineers and application developers working on products and systems for the Internet of Things (IoT).

Many communication technologies are well known such as WiFi, Bluetooth, ZigBee and 2G/3G/4G cellular, but there are also several new emerging networking options such as Thread as an alternative for home automation applications, and Whitespace TV technologies being implemented in major cities for wider area IoT-based use cases. Depending on the application, factors such as range, data requirements, security and power demands and battery life will dictate the choice of one or some form of combination of technologies. These are some of the major communication technologies on offer to developers.

Bluetooth

titleAn important short-range communications technology is of course Bluetooth, which has become very important in computing and many consumer product markets. It is expected to be key for wearable products in particular, again connecting to the IoT albeit probably via a smartphone in many cases. The new Bluetooth Low-Energy (BLE) – or Bluetooth Smart, as it is now branded – is a significant protocol for IoT applications. Importantly, while it offers similar range to Bluetooth it has been designed to offer significantly reduced power consumption.

However, Smart/BLE is not really designed for file transfer and is more suitable for small chunks of data. It has a major advantage certainly in a more personal device context over many competing technologies given its widespread integration in smartphones and many other mobile devices. According to the Bluetooth SIG, more than 90 percent of Bluetooth-enabled smartphones, including iOS, Android and Windows based models, are expected to be ‘Smart Ready’ by 2018. 

Devices that employ Bluetooth Smart features incorporate the Bluetooth Core Specification Version 4.0 (or higher – the latest is version 4.2 announced in late 2014) with a combined basic-data-rate and low-energy core configuration for a RF transceiver, baseband and protocol stack. Importantly, version 4.2 via its Internet Protocol Support Profile will allow Bluetooth Smart sensors to access the Internet directly via 6LoWPAN connectivity (more on this below). This IP connectivity makes it possible to use existing IP infrastructure to manage Bluetooth Smart ‘edge’ devices. More information on Bluetooth 4.2 is available here and a wide range of Bluetooth modules are available from RS. 

  • Standard: Bluetooth 4.2 core specification
  • Frequency: 2.4GHz (ISM)
  • Range: 50-150m (Smart/BLE)
  • Data Rates: 1Mbps (Smart/BLE)

Zigbee

title

ZigBee, like Bluetooth, has a large installed base of operation, although perhaps traditionally more in industrial settings. ZigBee PRO and ZigBee Remote Control (RF4CE), among other available ZigBee profiles, are based on the IEEE802.15.4 protocol, which is an industry-standard wireless networking technology operating at 2.4GHz targeting applications that require relatively infrequent data exchanges at low data-rates over a restricted area and within a 100m range such as in a home or building.

ZigBee/RF4CE has some significant advantages in complex systems offering low-power operation, high security, robustness and high scalability with high node counts and is well positioned to take advantage of wireless control and sensor networks in M2M and IoT applications. The latest version of ZigBee is the recently launched 3.0, which is essentially the unification of the various ZigBee wireless standards into a single standard. An example product and kit for ZigBee development are TI’s CC2538SF53RTQT ZigBee System-On-Chip IC and CC2538 ZigBee Development Kit. 

  • Standard: ZigBee 3.0 based on IEEE802.15.4
  • Frequency: 2.4GHz
  • Range: 10-100m
  • Data Rates: 250kbps

Z-Wave

titleZ-Wave is a low-power RF communications technology that is primarily designed for home automation for products such as lamp controllers and sensors among many others. Optimized for reliable and low-latency communication of small data packets with data rates up to 100kbit/s, it operates in the sub-1GHz band and is impervious to interference from WiFi and other wireless technologies in the 2.4-GHz range such as Bluetooth or ZigBee. It supports full mesh networks without the need for a coordinator node and is very scalable, enabling control of up to 232 devices. Z-Wave uses a simpler protocol than some others, which can enable faster and simpler development, but the only maker of chips is Sigma Designs compared to multiple sources for other wireless technologies such as ZigBee and others. 

  • Standard: Z-Wave Alliance ZAD12837 / ITU-T G.9959
  • Frequency: 900MHz (ISM)
  • Range: 30m
  • Data Rates: 9.6/40/100kbit/s 

6LowPAN

titleA key IP (Internet Protocol)-based technology is 6LowPAN (IPv6 Low-power wireless Personal Area Network). Rather than being an IoT application protocols technology like Bluetooth or ZigBee, 6LowPAN is a network protocol that defines encapsulation and header compression mechanisms. The standard has the freedom of frequency band and physical layer and can also be used across multiple communications platforms, including Ethernet, Wi-Fi, 802.15.4 and sub-1GHz ISM. A key attribute is the IPv6 (Internet Protocol version 6) stack, which has been a very important introduction in recent years to enable the IoT. IPv6 is the successor to IPv4 and offers approximately 5 x 1028 addresses for every person in the world, enabling any embedded object or device in the world to have its own unique IP address and connect to the Internet. Especially designed for home or building automation, for example, IPv6 provides a basic transport mechanism to produce complex control systems and to communicate with devices in a cost-effective manner via a low-power wireless network.

Designed to send IPv6 packets over IEEE802.15.4-based networks and implementing open IP standards including TCP, UDP, HTTP, COAP, MQTT, and websockets, the standard offers end-to-end addressable nodes, allowing a router to connect the network to IP. 6LowPAN is a mesh network that is robust, scalable and self-healing. Mesh router devices can route data destined for other devices, while hosts are able to sleep for long periods of time. An explanation of 6LowPAN is available here, courtesy of TI. 

  • Standard: RFC6282
  • Frequency: (adapted and used over a variety of other networking media including Bluetooth Smart (2.4GHz) or ZigBee or low-power RF (sub-1GHz)
  • Range: N/A
  • Data Rates: N/A

Thread

title

A very new IP-based IPv6 networking protocol aimed at the home automation environment is Thread. Based on 6LowPAN, and also like it, it is not an IoT applications protocol like Bluetooth or ZigBee. However, from an application point of view, it is primarily designed as a complement to WiFi as it recognises that while WiFi is good for many consumer devices that it has limitations for use in a home automation setup. 

Launched in mid-2014 by the Thread Group, the royalty-free protocol is based on various standards including IEEE802.15.4 (as the wireless air-interface protocol), IPv6 and 6LoWPAN, and offers a resilient IP-based solution for the IoT. Designed to work on existing IEEE802.15.4 wireless silicon from chip vendors such as Freescale and Silicon Labs, Thread supports a mesh network using IEEE802.15.4 radio transceivers and is capable of handling up to 250 nodes with high levels of authentication and encryption. A relatively simple software upgrade should allow users to run thread on existing IEEE802.15.4-enabled devices. 

  • Standard: Thread, based on IEEE802.15.4 and 6LowPAN
  • Frequency: 2.4GHz (ISM)
  • Range: N/A
  • Data Rates: N/A

WiFi

titleWiFi connectivity is often an obvious choice for many developers, especially given the pervasiveness of WiFi within the home environment within LANs. It requires little further explanation except to state the obvious that clearly there is a wide existing infrastructure as well as offering fast data transfer and the ability to handle high quantities of data. 

Currently, the most common WiFi standard used in homes and many businesses is 802.11n, which offers serious throughput in the range of hundreds of megabit per second, which is fine for file transfers, but may be too power-consuming for many IoT applications. A series of RF development kits designed for building WiFi-based applications are available from RS. 

  • Standard: Based on 802.11n (most common usage in homes today)
  • Frequencies: 2.4GHz and 5GHz bands
  • Range: Approximately 50m
  • Data Rates: 600 Mbps maximum, but 150-200Mbps is more typical, depending on channel frequency used and number of antennas (latest 802.11-ac standard should offer 500Mbps to 1Gbps) 

Cellular

<titleAny IoT application that requires operation over longer distances can take advantage of GSM/3G/4G cellular communication capabilities. While cellular is clearly capable of sending high quantities of data, especially for 4G, the expense and also power consumption will be too high for many applications, but it can be ideal for sensor-based low-bandwidth-data projects that will send very low amounts of data over the Internet. A key product in this area is the SparqEE range of products, including the original tiny CELLv1.0 low-cost development board and a series of shield connecting boards for use with the Raspberry Pi and Arduino platforms. 

  • Standard: GSM/GPRS/EDGE (2G), UMTS/HSPA (3G), LTE (4G)
  • Frequencies: 900/1800/1900/2100MHz
  • Range: 35km max for GSM; 200km max for HSPA
  • Data Rates (typical download): 35-170kps (GPRS), 120-384kbps (EDGE), 384Kbps-2Mbps (UMTS), 600kbps-10Mbps (HSPA), 3-10Mbps (LTE) 

NFC

titleNFC (Near Field Communication) is a technology that enables simple and safe two-way interactions between electronic devices, and especially applicable for smartphones, allowing consumers to perform contactless payment transactions, access digital content and connect electronic devices. Essentially it extends the capability of contactless card technology and enables devices to share information at a distance that is less than 4cm. Further information is available here. 

  • Standard: ISO/IEC 18000-3
  • Frequency: 13.56MHz (ISM)
  • Range: 10cm
  • Data Rates: 100–420kbps

Sigfox

titleAn alternative wide-range technology is Sigfox, which in terms of range comes between WiFi and cellular. It uses the ISM bands, which are free to use without the need to acquire licenses, to transmit data over a very narrow spectrum to and from connected objects. The idea for Sigfox is that for many M2M applications that run on a small battery and only require low levels of data transfer, then WiFi’s range is too short while cellular is too expensive and also consumes too much power. Sigfox uses a technology called Ultra Narrow Band (UNB) and is only designed to handle low data-transfer speeds of 10 to 1,000 bits per second. It consumes only 50 microwatts compared to 5000 microwatts for cellular communication, or can deliver a typical stand-by time 20 years with a 2.5Ah battery while it is only 0.2 years for cellular. 

Already deployed in tens of thousands of connected objects, the network is currently being rolled out in major cities across Europe, including ten cities in the UK for example. The network offers a robust, power-efficient and scalable network that can communicate with millions of battery-operated devices across areas of several square kilometres, making it suitable for various M2M applications that are expected to include smart meters, patient monitors, security devices, street lighting and environmental sensors. The Sigfox system uses silicon such as the EZRadioPro wireless transceivers from Silicon Labs, which deliver industry-leading wireless performance, extended range and ultra-low power consumption for wireless networking applications operating in the sub-1GHz band. 

  • Standard: Sigfox
  • Frequency: 900MHz
  • Range: 30-50km (rural environments), 3-10km (urban environments)
  • Data Rates: 10-1000bps 

Neul 

titleSimilar in concept to Sigfox and operating in the sub-1GHz band, Neul leverages very small slices of the TV White Space spectrum to deliver high scalability, high coverage, low power and low-cost wireless networks. Systems are based on the Iceni chip, which communicates using the white space radio to access the high-quality UHF spectrum, now available due to the analogue to digital TV transition. The communications technology is called Weightless, which is a new wide-area wireless networking technology designed for the IoT that largely competes against existing GPRS, 3G, CDMA and LTE WAN solutions. Data rates can be anything from a few bits per second up to 100kbps over the same single link; and devices can consume as little as 20 to 30mA from 2xAA batteries, meaning 10 to 15 years in the field. 

  • Standard: Neul
  • Frequency: 900MHz (ISM), 458MHz (UK), 470-790MHz (White Space)
  • Range: 10km
  • Data Rates: Few bps up to 100kbps

LoRaWAN

titleAgain, similar in some respects to Sigfox and Neul, LoRaWAN targets wide-area network (WAN) applications and is designed to provide low-power WANs with features specifically needed to support low-cost mobile secure bi-directional communication in IoT, M2M and smart city and industrial applications. Optimized for low-power consumption and supporting large networks with millions and millions of devices, data rates range from 0.3 kbps to 50 kbps. 

  • Standard: LoRaWAN
  • Frequency: Various
  • Range: 2-5km (urban environment), 15km (suburban environment)
  • Data Rates: 0.3-50 kbps.

More about the Internet of Things in our IOT Design Centre

title


Reference Design Renesas RL78/G1C target board -QB-R5F10JGC-TB -

$
0
0

Renesas RL78/G1C target board, QB-R5F10JGC-TB, was converted into Designspark PCB format. 

(*Note: This reference design does not provide a PCB file. Only a schematic file and parts library are distributed.)

DOWNLOAD QB-R5F10JGC-TB DESIGN FILES

title

Schematic of QB-R5F10JGC-TB Board

 

RL78/G1C target board: QB-R5F10JGC-TB

The QB-R5F10JGC-TB is a target board used for evaluating microcontroller operations, using the E1, the Renesas Electronics on-chip debug emulator with programming function (hereinafter referred to as E1).

RL78/G1C target board (QB-R5F10JGC-TB) features

  •  Incorporates RL78/G1C (R5F10JGC).
  • A 12MHz resonator is mounted.
  • Supports both flash memory programming and on-chip debugging (using TOOL0 pin)
  • Highly extendable; peripheral board connectors are equipped with microcontroller pins

User's Manual

MORE REFERENCE DESIGNS

What are included in the reference design file?

A Schematics design file (.sch) and parts library files for the design are provided. A RS part number and size information of parts are already linked to each part in the library. So you can directly order parts to RS by using the BOM quote feature. Of course, parts in the library would be used in another design. 

title

Parts library

 

What is DesignSpark PCB format?

DesignSpark PCB is an award-winning software package for schematic capture and PCB layout, available for FREE from RS Components. Our software is easy to learn and use yet surprisingly powerful. DesignSpark PCB is now widely adopted in the industry as a standard format for design file sharing and collaboration. This is especially useful in the prototyping phase where most of the innovation takes place. Not yet a DesignSpark PCB user? 

DOWNLOAD DESIGNSPARK PCB NOW

MORE REFERENCE DESIGNS

Reference Design Renesas high-precision LED lighting control board -EZ-0012-

$
0
0

RL78/I1A DC/DC LED Control Evaluation Board, EZ-0012, was converted into Designspark PCB format. 

(*Note: This reference design does not provide a PCB file. Only a schematic file and parts library are distributed.)

DOWNLOAD EZ-0012 DESIGN FILES

title

Schematic of EZ-0012 Board

 

RL78/I1A High-precision LED lighting control board: EZ-0012

The EZ-0012 is mounted with an RL78/I1A microcontroller with on-chip high-precision LED lighting control functions, so it can be used as a reference platform for RL78/I1A system development.

RL78/I1A DC/DC LED Control Evaluation Board (EZ-0012) features

  • The on-chip high-precision dimming control (1 ns or less PWM resolution) of the RL78/I1A can be used.
  • Supports evaluation of three channels of LED constant current
  • Supports four dimmer interfaces: DALI, DMX512, infrared, and analog volume
  • Supports automatic software generation tool Applilet EZ for HCD (planned)

MORE REFERENCE DESIGNS

What are included in the reference design file?

A Schematics design file (.sch) and parts library files for the design are provided. A RS part number and size information of parts are already linked to each part in the library. So you can directly order parts to RS by using the BOM quote feature. Of course, parts in the library would be used in another design. 

title

Parts library

 

What is DesignSpark PCB format?

DesignSpark PCB is an award-winning software package for schematic capture and PCB layout, available for FREE from RS Components. Our software is easy to learn and use yet surprisingly powerful. DesignSpark PCB is now widely adopted in the industry as a standard format for design file sharing and collaboration. This is especially useful in the prototyping phase where most of the innovation takes place. Not yet a DesignSpark PCB user? 

DOWNLOAD DESIGNSPARK PCB NOW

MORE REFERENCE DESIGNS

Thermal Imaging for Fun and Profit with the FLIR E5

$
0
0

title

Hands-on with a most cool (!) FLIR thermal imaging camera.

It's hard to say when I first heard about thermal imaging and I suspect that, like many people, it will have been at some point in the 1990s and in connection with firefighter use. In any case, it conjures up images of somewhat large and unwieldy devices that use liquid helium to cool a detector down to cryogenic temperatures — with a price tag of: if you have to ask, you cannot afford one!

Of course, technology never stands still and thermal imaging cameras can now be had for a fraction of the price they would have cost only a decade ago. They've also become far more convenient and a cooled detector is only really required for certain specialist applications.

We were given a loan of the compact and eminently usable FLIR E5, and in this post we take a look at its main features and include a few obligatory thermal imaging shots.

Kit contents

title

The E5 came packaged in a robust protective case and was supplied with a USB charger, USB cable and manuals. A removable rechargeable battery is located inside the grip.

title

Controls

As can be seen above the camera has a trigger button, which is used to capture images. There are also four buttons located underneath the screen.

title

Pressing the middle button brings up a menu with options for:

  • Settings

  • Image mode

  • Measurement

  • Colour

  • Temperature scale

From the Settings menu it's possible to change key parameters such as the emissivity and reflected temperature for your particular object. For example, a shiny object is likely to emit less radiation but reflect more, and remember that what the camera captures is overall radiation. So for accurate readings these parameters need to be correctly set, but it turns out that there is a simple enough process to do this, which involves the use of scrunched up silver foil as a reference point.

The E5 actually incorporates two sensors: an IR sensor and a visible light camera. The image mode setting allows you to shift between Multi Spectral Dynamic Imaging (MSX), a mode whereby image processing is used to enhance thermal video with visible spectrum light, thermal only, thermal blending, a slightly surreal mode which appears to add thermal highlighting to a visible image, and digital camera mode.

title

Thermal MSX image mode

title

Thermal mode

title

Thermal blending mode

The measurement menu allows you to change between measuring the temperature from a fix point in the middle of the screen, a moving hot spot, a moving cold spot, and no measurement at all.

The colour menu is used to change between iron, rainbow and grey palettes.

Finally, the temperature menu can be used to auto-ranging and locked scale.

Simple enough!

In use

Right, so if you've read this far you're now probably thinking, “This is all very well, but where are all the cool pictures?!” So, here are a few shots. Bear in mind that they're scaled up from 320x240 and so they are not quite as sharp as when viewed at the native resolution.

title

Above can be seen the view over the town of Hebden Bridge.

title

Trees look pretty, as anyone who has done photography with infra-red film would expect!

title

Cats on the other hand look pretty strange...

title

The challenge is that it's hard to maintain focus when a previously invisible world has been revealed to you. But in any case, I managed to after a little while and above can be seen a slightly more technical thermal image, of the diesel engine in an old Land Rover. It hadn't been running long, but the turbo appears to be nicely warming up and at >60C after 5 or 10 minutes.

As it happens, the temperature sender and dashboard gauge in the Land Rover are mismatched, so it always reads in the red and I've worried that it may be overheating and I wouldn't know. So I guess I best take it for a good run and make the most of the camera before I have to send it back!

title

And here is the radiator. Guess which side the water enters?

title

Finally, a shot that is a much more on topic and that is of inside the Novena open hardware laptop. Here the Freescale quad-core ARM SoC can clearly be seen centre of frame, situated beneath a small heatsink and generating far more heat than anything else on the board.

First impressions

I need a thermal imaging camera. Honestly. It's one of those things that I've often thought it could be useful to have, and obviously a great deal of fun too — but hardly a necessity. However, playing around and having fun imaging random things aside, it's become apparent just how useful it would be when we're designing enclosures and selecting fans and heatsinks etc. for projects.

Sure, you can touch an IC to see if it feels a little too hot, you can attach self-adhesive thermometer strips to devices and blast boards with freezer spray. But quite frankly, this all takes on a sense of the archaic once you've spent any time at all with a thermal imaging camera. And being the slightly paranoid sort when it comes to such things, I suspect that I'll sleep a lot better at night if I've actually seen where heat builds up and is dissipated, and are able to easily ascertain the temperature at any point across an assembly and confirm that the correct design decisions were made.

Get your hands on a Flir E5 

Andrew Back

出版了!

Raspberry Pi 2へのWindows 10 IoT Core Insider Preview版のインストール方法

$
0
0

昨日(2015年4月29日)、Raspberry Pi2版のWin10 Preview版がリリースされたようです。

今年2月のRaspberry Pi2発売時、Windows10がRaspberry Pi 2上で動作することが既にアナウンスされていましたが、今回、Insider Preview版が利用できるようになったようですよって、Microsoftの解説(英語)をもとにWindows10 Insider Preview版のRaspberry Pi2 へのインストール方法をご紹介いたします(より詳細な手順は上記のMicrosoft社の解説をご覧ください)。

title

注意: RaspPi2へのインストールには、Windows 10 Technical PreviewのインストールされたPCが必要です。

用意するもの

  • Windows 10 Technical Previewの動作しているPC
  • Raspberry Pi 2
  • 最低1A以上の出力を持つ5V micro USB電源
  • 8GB Class10以上の性能を持つmicro SDカード
  • HDMIケーブル
  • イーサネットケーブル

インストール手順

  1. SDカードリーダにアクセスするためこの手順は、仮想マシンでなく、Windows10のインストールされた実際のマシンで実行する必要があります。
  2. ここからアカウントを設定してください。もしも、すでに設定が済んでいれば、空白のページが表示されるはずです。
  3. ここから、Windows_IoT_Core_RPI2_BUILD.zipをダウンロードし、それに含まれるflash.ffuのローカルコピーを作成します。
  4. SDカードをPCのカードリーダに挿入してください。
  5. 管理者権限のコマンドプロンプトで、コピーを作成したflash.ffuのローカルでの場所に移動します。
  6. コンピュータ上でSDカードに割り当てられたディスク番号を調べます。この番号は次のステップでイメージをインストールするときに使います。diskpartユーティリティで、次のコマンドを実行することでも確認できます。
    diskpart
    list disk
    exit
  7. 引き続き、管理者権限のコマンドプロンプトを利用して、次のコマンドを実行してイメージをSDカードに適用します。
    dism.exe /Apply-Image /ImageFile:flash.ffu
    /ApplyDrive:\\.\PhysicalDriveN /SkipPlatformCheck
    (PhysicalDriveNのNには先ほどの番号を入力します。)
  8. ディスクに"ハードウェアの安全な取り外し"を実行して、SDカードをはずすことのできるようにします。

Raspberry Pi 2の起動方法

  1. Raspberry Pi2にさきほどイメージを書き込んだSDカードを挿入します。
  2. Ethernetポートにケーブルを接続して、ネットワークにつなぎます。
  3. HDMIポートにケーブルを接続して、モニタに接続します。
  4. 最後にmicro USBポートに電源を接続します。
  5. その後、自動的にWindows 10 IoT Core Insider Previewが起動するはずです。
  6. 最初の起動時には設定があるために青い色のアプリケーションが数分起動していますが、その後自動的に再起動します。DefaultApp が表示され、Raspberry Pi2のIPアドレスが表示されます。
  7. PowerShellを利用して、Raspberry Pi2に接続することもできます
  8. 管理者権限のアカウントでは、デフォルトのパスワードを変更することを強く推奨します
  9. Remote Debuggerが自動的にRaspberry Pi2のブート時に起動します。

Electronic Product Design Project Competition - City University of Hong Kong

$
0
0

Judgement Day is here! Two semesters of planning and hard work has brought 6 selected teams putting their electronic design and programming knowledge to the test.

Using an Arduino based robot, the goal is to pick an object (plastic cube) and deliver it to the target (through a hoop into a bin) after travelling on a customized track to test maneuverability. The students utilized DesignSpark PCB to complete their PCB layout designs with component sponsorship byRS.

Judging criteria included the speed of completion, efficiency of the pickup, delivery and track guidance system.
The overall design of the robot was also inspected.

Check out these pics from the event:

titletitle

title

title

And, here are the winners !

Name

Award

Lai Chun Tak, Lam Kwok Wing

Gold Award

Wu Zhanhong, Mao Shu, Xu Bowen

Silver Award

WANG Shiqi, FENG Mohan, XU Jian, WU Xuan

Silver Award

Lee Yin To, Yau Lok Yin, Ng Lok Fung, Chan Chi Wai

Creative Idea Award

Kwok Tsz Wing, Chao Ming Yu, Chow Man Yiu, Wan Shuk Ying

Certificate of Merit

Ho Ka long, Mak Kwan Hong, Waqas Mahmood

Certificate of Merit

title

titletitle

Why not design your own Arduino robot? Check out these exciting technical content and start making now!

  • DesignShare Project : Line Tracking Robot Car

           http://www.rs-online.com/designspark/designshare/eng/projects/243/

  • Blog : Robot Car Project - City University of Hong Kong

          http://www.rs-online.com/designspark/electronics/blog/CityUrobotcar

  • Knowledge items:

Arduino Motor Drive
http://www.rs-online.com/designspark/electronics/eng/knowledge-item/arduino-motor-drive


Arduino Light Reflective Sensor
http://www.rs-online.com/designspark/electronics/eng/knowledge-item/light-reflective-sensor


Arduino Line Tracking Robot Car Prototype
http://www.rs-online.com/designspark/electronics/eng/knowledge-item/arduino-line-tracking-robot-car-prototype


Arduino Line Tracking Robot Car
http://www.rs-online.com/designspark/electronics/eng/knowledge-item/arduino-line-tracking-robot-car

Hashtags: #DesignSpark#DesignSpark PCB#DesignSpark Mechanical#Arduino

Reference Design Renesas RL78/G1C target board -QB-R5F10JGC-TB -

$
0
0

Renesas RL78/G1C target board, QB-R5F10JGC-TB, was converted into Designspark PCB format. 

(*Note: This reference design does not provide a PCB file. Only a schematic file and parts library are distributed.)

DOWNLOAD QB-R5F10JGC-TB DESIGN FILES

title

Schematic of QB-R5F10JGC-TB Board

 

RL78/G1C target board: QB-R5F10JGC-TB

The QB-R5F10JGC-TB is a target board used for evaluating microcontroller operations, using the E1, the Renesas Electronics on-chip debug emulator with programming function (hereinafter referred to as E1).

RL78/G1C target board (QB-R5F10JGC-TB) features

  •  Incorporates RL78/G1C (R5F10JGC).
  • A 12MHz resonator is mounted.
  • Supports both flash memory programming and on-chip debugging (using TOOL0 pin)
  • Highly extendable; peripheral board connectors are equipped with microcontroller pins

User's Manual

MORE REFERENCE DESIGNS

What are included in the reference design file?

A Schematics design file (.sch) and parts library files for the design are provided. A RS part number and size information of parts are already linked to each part in the library. So you can directly order parts to RS by using the BOM quote feature. Of course, parts in the library would be used in another design. 

title

Parts library

 

What is DesignSpark PCB format?

DesignSpark PCB is an award-winning software package for schematic capture and PCB layout, available for FREE from RS Components. Our software is easy to learn and use yet surprisingly powerful. DesignSpark PCB is now widely adopted in the industry as a standard format for design file sharing and collaboration. This is especially useful in the prototyping phase where most of the innovation takes place. Not yet a DesignSpark PCB user? 

DOWNLOAD DESIGNSPARK PCB NOW

MORE REFERENCE DESIGNS


An MQTT-powered display using an Arduino Ethernet and LCD

$
0
0

A simple example using the MQTT Arduino library and a 16x2 LCD.

 

title

In a previous post we used a temperature sensor and wireless transmitter with a Raspberry Pi and Node-RED to build a heating control system. In another post we went on to use MQTT to allow us to scale across multiple devices, with a Node-RED system and a separate temperature sensor node.

In this post we will use an Arduino Ethernet with an LCD screen to expand on this system, subscribing to an MQTT topic and displaying the messages as they are published to it from Node-RED. This allows monitoring of the messages on our topics without using a desktop computer.

We will assume that you already have an MQTT broker running with a device publishing messages on a topic. If you don't already have this, see the aforementioned posts for details.

Hardware Used

Setting up the hardware

We will use the 16x2 character LCD module that comes bundled with the Arduino Starter Kit, though these and similar displays can also be purchased separately.

First ensure that the Arduino is powered down. Then use a breadboard and jumper wires to connect the LCD module as per the diagram below:

title

LCD Pin

Connected to

1

GND

2

5v

3

10k potentiometer

4

Arduino pin 8

5

GND

6

Arduino pin 9

7

 

8

 

9

 

10

 

11

Arduino pin 5

12

Arduino pin 7

13

Arduino pin 3

14

Arduino pin 2

15

220 ohm resistor

16

GND

 

Note that if you are using a different LCD module you will need to refer to the relevant datasheet to ensure correct wiring.

Next create a new sketch in the Arduino IDE and paste in the code below:

//include the library that simplifies use of the LCD module

#include <LiquidCrystal.h>

//define the pins the LCD module is connected to

LiquidCrystal lcd(8, 9, 5, 7, 3, 2);

void setup() {

//things here run once at the beginning

lcd.begin(16, 2);

lcd.print("hello, world");

}

void loop() {

//things here run in a loop

//this sets the cursor position on the LCD, column 0, line 1

lcd.setCursor(0,1);

//this will print the time elapsed since startup to the LCD display

lcd.print(millis() / 1000);

}

Now connect the USB to serial adapter and Arduino Ethernet to your computer and upload the sketch. The IDE will ask you to save the sketch before uploading. Once the sketch is uploaded you should see the LCD powered up and displaying our test messages. If you do not see anything, try turning the potentiometer, this changes the contrast on the LCD display.

title

MQTT on the Arduino

To use the Arduino as an MQTT client we will need to make use of a third party library which can be downloaded from here. Next copy the 'PubSubClient' directory into your Arduino libraries folder (the location of which is determined by the operating system you are using).

Restart the Arduino IDE and check to see if the library has installed correctly: look in File>Examples and you should see 'PubSubClient' at the bottom. If so, open a new sketch and paste in the code below:

/*

Basic MQTT example with Authentication

- connects to an MQTT server, providing username and password

- publishes "hello world" to the topic "outTopic"

- subscribes to the topic "inTopic"

This sketch is modified to print the topic payload to Serial for debugging

*/

#include <SPI.h>

#include <Ethernet.h>

#include <PubSubClient.h>

// Update these with values suitable for your network.

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xA1, 0x95 }; // MAC address of your Arduino

byte server[] = { 10, 0, 10, 21 }; // IP address of your MQTT broker

byte ip[] = { 10, 0, 10, 149 }; // IP address of your Arduino

void callback(char* topic, byte* payload, unsigned int length) {

Serial.print("Payload: ");

Serial.write(payload, length);

Serial.println();

}

EthernetClient ethClient;

PubSubClient client(server, 1883, callback, ethClient);

void setup()

{

Serial.begin(9600);

Ethernet.begin(mac, ip);

//print out the IP address

Serial.print("IP = ");

Serial.println(Ethernet.localIP());

if (client.connect("arduinoClient", "USERNAME", "PASSWORD")) {

client.publish("outTopic","hello world");

client.subscribe("inTopic");

}

}

void loop()

{

client.loop();

}

You will need to modify the following in the above sketch:

  • MAC address

  • IP address of the MQTT broker

  • IP address of Arduino

  • User name and password for MQTT broker

Ensure your Arduino is connected to the network and upload the sketch.

Next head over to your MQTT broker on the same network (we are using Mosquitto running on a Raspberry Pi with Node-RED that we built in this post).

Start a new Node-RED flow and drag in an MQTT input node. Double-click to edit it and add the following details:

  • Topic: 'outTopic'

  • username and password

Close the editing window and drag in a debug node. Connect the two nodes together and deploy the flow. Now look at the debug panel on the right hand side and reset your Arduino. When it restarts you should see the message 'hello world' appear in the debug panel.

title

Now let's see if we aresubscribing correctly. Drag in an MQTT output node to your flow and edit the following details:

  • Topic: 'inTopic'

  • username and password

Close the editing window and drag in an inject node. We will use the default timestamp payload for testing. Connect the two nodes and deploy the flow. Head back to the Arduino IDE and open the Serial Monitor. Then go back to your flow and click the button on the inject node. You should see the timestamp message appear in the Serial Monitor window. If not, things to check include:

  • Ensure the Arduino is connected to your computer with a USB to Serial adapter

  • Check the username and passwords match in both the Arduino code and Node-RED flow.

  • Check that the topics match.

  • Check that the Serial Monitor is set at the correct baud rate and port.

title

Displaying MQTT messages

Now that we have tested each part of our system we can put everything together. We know that our LCD display works and thatthe Arduino can subscribe to an MQTT topic. Our existing Node-RED flow is already reading temperature data from a sensor. We can build on this by adding an MQTT output node and publishing the temperature data to a new topic, 'officeTemp'. We will also add an inject node and connect it to the MQTT output node to help with testing. Once added to the workspace and configured we can deploy the flow.

title

Now we can write a sketch for the Arduino that subscribes to an MQTT topic and displays the messages on the LCD screen. We will also publish a message to an MQTT topic when the Arduino connects to our broker to say that the LCD monitor is online. See below for our code:

/*

Code based on "Basic MQTT example with Authentication" sketch

- connects to an MQTT server, providing username and password

- subscribes to the topic "officeTemp"

- prints the topic payload to Serial for debugging

- displays messages in topic on LCD screen

- publishes 'online' message to topic "node1"

*/

#include <SPI.h>

#include <Ethernet.h>

#include <PubSubClient.h>

//include the library that simplifies use of the LCD module

#include <LiquidCrystal.h>

//define the pins the LCD module is connected to

LiquidCrystal lcd(8, 9, 5, 7, 3, 2);

// Update these with values suitable for your network

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xA1, 0x95 };

byte server[] = { 10, 0, 10, 21 };

byte ip[] = { 10, 0, 10, 149 };

void callback(char* topic, byte* payload, unsigned int length) {

Serial.print("Payload: ");

Serial.write(payload, length);

Serial.println();

//clear LCD screen

lcd.clear();

//set cursor position on the LCD at column 0, line 0 then display Office Temp

lcd.setCursor(0,0);

lcd.print("Office Temp");

//set cursor position on the LCD at column 0, line 1

lcd.setCursor(0,1);

//write the payload to the LCD display and add ' C' after it

lcd.write(payload, length);

lcd.print(" C");

}

EthernetClient ethClient;

PubSubClient client(server, 1883, callback, ethClient);

void setup()

{

Serial.begin(9600);

Ethernet.begin(mac, ip);

//Print Arduino IP address to serial for debugging

Serial.print("IP = ");

Serial.println(Ethernet.localIP());

if (client.connect("arduinoClient", "pi", "bilberry")) {

client.publish("node1","LCD Display Online");

client.subscribe("officeTemp");

}

lcd.begin(16, 2);

}

void loop()

{

client.loop();

}

As before ensure that you update the network, topic and login details in the above sketch.

Upload the code to your Arduino. Note that nothing will be displayed on the LCD screen until it receives the first MQTT message. We can send a test message by heading to our Node-RED flow and clicking the button on the inject node connected to our MQTT output node. We can also open the Serial Monitor in the Arduino IDE to check the messages we are receiving.

title

Final Thoughts

We now have an Arduino-based display connected to our network that can subscribe to MQTT topics and display the content of messages. Though useful as it is, ways this could be expanded upon include:

  • Adding a temperature sensor to the Arduino and publishing remote readings to an MQTT topic, which our central Node-RED system can then process.

  • Adding a potentiometer and publishing readings to a topic, which Node-RED subscribes to and uses to configure the thermostatset point.

  • Adding a switch to the Arduino, reading it's state, publishing it to a topic and using it as a master override for the heating control.



New for May

「DESIGN SPARK Mechanical」セミナー開催 6/11(木)、12(金) 開催

$
0
0

株式会社キリバスの大江といいます。

このたび弊社では、DESIGNSPARKMechanicalのセミナーを開催することとなりました。セットアップ済みPCをご用意しているので、当日、PCを持参することもなくお気軽にご参加頂けます。

■日時: 2015年 6月11日(木)、12日(金)
  ・1コマ目: 11日(木) 12:00~15:00 (3時間)、定員15名
  2コマ目: 11日(木) 15:30~18:30 (3時間)、定員15名
  3コマ目: 12日(金) 12:00~15:00 (3時間)、定員15名
 内容:
 無料の3Dモデリングツール「DesignSpark Mechanical」で
 3Dのデータの作成を体験し、ご習得頂けます。  
  ・セットアップ方法
  ・2次元図のスケッチ
  ・3次元のモデリング
  ・回転体やパターンの作成
  ・オンラインライブラリから3Dモデルをダウンロード
  ・3Dプリンタ用データ出力
  ・ヘルプ機能の活用
場所:     外語ビジネス専門学校 本館コンピュータルーム(神奈川県川崎市)
アクセス:  京急川崎駅徒歩1分、JR川崎駅徒歩4分
title
受講料:   7,000円/1コマ
申込み:   こちらのフォームからご希望の日時を選択しお申込みください
持ち物:   なし (筆記用部と受講料をお持ちください)
■事前準備:  なし
本セミナーの特徴:
 ・3Dプリンタ用データの作編集が学べる
 ・無料ツールなので、セミナー後すぐに導入できる
 ・駅近で都心からのアクセス抜群
 ・CADツールセットアップ済みPC完備
 ・ツールセットアップなどの事前準備不要
 ・便利な裏技やショートカットキーが学べる
■注意事項
 ・受講料は当日受付にて現金でお支払願います。
 ・領収書発行いたします。
 ・
title

名刺サイズのスパコン「Parallella」全機種10%OFFのキャンペーン中!

$
0
0

title

Parallellaを開発したアダプティーバ社のCEO、アンドレアス・オロフソン氏の来日を記念してParallellaボード全3機種を10%割引でご提供!
6月12日までの限定キャンペーンです!

詳しくはこちら!

Panasonic design centre

Viewing all 280 articles
Browse latest View live