Click here to Skip to main content
15,884,628 members
Articles / Internet of Things
Article

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

19 Aug 2016CPOL3 min read 19.1K   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

Image 1

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:

Image 2

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:

    Image 3
  4. Click OK/Update.
  5. Set the name to RFID In. Example:

    Image 4
  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:
    Image 5
  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.

Image 6

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
This is a Organisation

42 members

Comments and Discussions

 
-- There are no messages in this forum --