Internet of Customers – Arduino, RFID, HTTP PUT & Node.js

Internet of Customers – Arduino, RFID, HTTP PUT & Node.js

In our last post we featured an Arduino powered RFID reader interacting with Salesforce.com via Node.js application running on Heroku. In this post we are going to dive into detail to understand what exactly an Arduino is, how the Arduino was physically configured and the application code required to create our proof.

IOC-Architecture

What exactly is Arduino?
The following is far from an official explanation, but the following best represents what I found so appealing and useful about the platform.

Arduino is a hardware platform that allows people to experiment with various electronics by loading their own programs onto the device. No soldering iron is needed and due to Arduino being open source, many potential components exist for it.

In short – it is a great platform to quickly hack together quick concepts with, before having to invest large amounts of time and money to achieve and has an excellent community supporting it.

Setting up the Arduino
This way my first time using an Arduino and in order to experiment with a wide range of capabilities, I grabbed a kit from Adafruit. With all of the amazing functionality that various Arduino modules provide, it is not without some issues given the technology is aimed at enthusiasts and after significant trial and error, I had to update the firmware on a Wifi Shield I added that was required for the sample below.

Arduino-RFID-Parts-Marked

With our proof of concept we needed to allow the Arduino to

  1. Connect to the internet / WiFi network
  2. Read the RFID code from an RFID tag
  3. Fire an HTTP PUT with the code to our Node.js application

Physically configuring the device was pretty simple and the physical architecture is as follows.  Please note the drawing on the right showing the wiring paths excludes the Wifi Shield.  The shield simply rests directly on the Arduino Uno, so the connection paths will remain the same per the Fritzing generated diagram below.

Arduino-RFID-Wires

Putting it All Together
Using the configuration above with the code sample below, you will be able to place an RFID card in front of the reader – causing the light to switch from Red to Green and the resulting output should display within your consoles.  The code for our Node.js will appear in our next post, so for now, we can focus on the the Arduino IDE console.  Click the images below to see the application in action!

Note – in order to receive console output you must have a connection from your IDE directly to the device in some fashion – I used a cable to directly attach.

Running Code on the Arduino
With the hardware configured it was finally time to get our device online and ready to send data to our services running on Heroku (these will be covered in our next post).

The following code essentially merges 2 samples from the arduino site, 1 for Wifi networking, 1 for reading RFID codes. Both examples then needed modification in order to work, as most Wifi samples do not cover HTTP PUTs and the RFID reader did not work with OOTB code.

Please note the code below if for a proof and not ready for use in production!

0 comments

Trackbacks

  1. […] – View Arduino, HTTP PUT, RFID and Node.js for the Arduino code used in this […]

  2. […] Arduino Code This Arduino code combines a Bluetooth scan using code from Jan Stevens, combined with our code from prior proofs connecting the Arduino to Wifi. […]

  3. […] an actual code standpoint with the system, the general approach from our prior post using RFID was largely reused as the core.  It was then adjusted to work with the custom objects specific to […]