Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Getting Started With Node-­Red and RFID on Intel® IoT Gateways

19 Aug 2016 2  
Node-­RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

Node-­RED* is a tool for wiring together hardware devices, APIs and online services in new and interesting ways. Node­-RED provides a browse-r­based flow editor that makes it easy to wire together flows using the wide range nodes in the palette. Flows can be then deployed to the runtime in a single click. The lightweight runtime is built on Node.js*, taking full advantage of its event-­driven, nonblocking model. This makes it ideal to run at the edge of the network. The SparkFun* RFID Starter Kit, an all­-in-­one kit that offers everything you need to create an RFID project. The kit includes a USB RFID Reader, ID-­12LA RFID module, and two 125 kHz RFID cards.

Required Hardware

  • Intel® Internet of Things Gateway
  • SparkFun RFID Starter Kit
  • USB Mini­B Cable

<img height="377px" src="1119425/GettingStartedWithNode-RedandRFID.jpg" width="377px" />

Assumptions

  • Intel® IoT Gateway is running the Wind River* Intelligent Device Platform (IDP) version 3.0 or above.
  • Node.js is installed on the Intel IoT Gateway.
  • Node-RED node "node-red-node-serialport" is installed on the Intel® IoT Gateway.
  • Node-RED is installed on the Intel IoT Gateway and is running.

Connecting the RFID Reader

  1. Plug the RFID reader in to the board.
  2. Plug the small end of the USB cable in to the board.
  3. Plug the other end of the USB cable in to a USB port on your Intel® IoT Gateway.

On the console of the gateway, you should see a message saying what serial device was created for the USB interface. It is likely /dev/ttyUSB0. Make a note of what device was created.

Using Node­-RED*

The Node-RED browser interface can be reached via http://ipaddressofthegateway:1880. When it first comes up, it will look something like this:

<img height="372px" src="1119425/GettingStartedWithNode-RedandRFID2.jpg" width="640px" />

Let’s create a Node­-RED flow to get the badge readings from the RFID reader.

Drag the following nodes from the left bar on to Sheet 1

  • Serial input
  • debug

Now, configure the nodes"

  1. Double-click on the serial node.
  2. Click on the pen icon to add a new serial port.
  3. In the Serial Port field, enter the device you noted above when you plugged the RFID reader in to the Intel® IoT Gateway, likely /dev/ttyUSB0. Set the Baud Rate to 9600, and leave the other fields as default. Example:

    <img height="591px" src="1119425/GettingStartedWithNode-RedandRFID3.jpg" width="516px" />
  4. Click OK/Update.
  5. Set the name to RFID In. Example:

    <img height="213px" src="1119425/GettingStartedWithNode-RedandRFID4.jpg" width="454px" />
  6. Click OK.
  7. Now wire the RFID In node to the Debug node by clicking and dragging between the small box on the right of the RFID In node to the small box on the left of the Debug node. It should look like this:
    <img height="128px" src="1119425/GettingStartedWithNode-RedandRFID5.jpg" width="431px" />
  8. Click on the Deploy button, top right, and Confirm deploy.
  9. Ensure the debug node is turned on. The box extending to the right of the node should be solid/filled in green.
  10. Switch the column on the right from the Info tab to the debug tab.
  11. Scan one of your badges.
    • The badge ID should appear as part of the payload message in the debug tab.
  12. Scan your other badges.
    • The badge ID should appear as part of the payload message in the debug tab.

Congratulations! You are successfully communicating via Serial to a RFID reader device.

Example Flow

Node-RED supports exporting and importing of flows (into source json). Below is a sample export of the above two flows we created.

<img height="147px" src="1119425/GettingStartedWithNode-RedandRFID6.jpg" width="586px" />

If you import this, the same nodes and configuration we created manually will automatically appear on the selected Sheet. Import and Export can be found in the Node-RED menu by clicking on the thee horizontal lines to the right of the Deploy button.

References

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here