Introduction: Wireless Sensors Via IoBridge + ThingSpeak
I have had my ioBridge for a few years now, and recently wanted to expand the sensors to other parts of the house. After looking around at several different options, I picked up 2 netduinos (sparkfun ) and 2 xbees (sparkfun ). To go along with the netduinos, I picked up the following from ioBridge:
- 2 Temperature probes (http://store.iobridge.com/product_p/a0013.htm )
- 1 Light sensor (http://store.iobridge.com/product_p/a0011.htm )
-1 Serial smart board (http://store.iobridge.com/product_p/a0018.htm )
The netduinos have 2 UART serial connections per board. The netduinos also have 3.3V and 5V power, but the analog inputs can only handle 3.3V inputs. Luckily the ioBridge sensors can work with 3.3V. The XBEEs require 3.3V for power. I used series 1 XBEES, by default they act as a wireless serial cable. Basically, what ever goes in one XBEE comes out all of the others (and vice-versa).
For detailed information on programming the netduinos, check out the getting started guide on the netduino download page.
Step 1: The Transmitter
Wiring up the transmitter: I used a mini breadboard (you can find them on sparkfun) to share the 3.3V and ground. Connect the ground of the sensor(s) to the same row, and then run a wire from that row to one of the ground pins on the netduino. The netduinos have built in AREF so you don't have to worry about connecting that. Do the same with the 3.3v, all on one row and connect to the netduino's 3.3V. I connected the analog output from the ioBridge sensors to the various analog inputs on the netduino. The ioBridge sensors have their pinout printed on them.
I only needed 1 serial connection for the XBEE (to send data to the receiver). Connect the XBEE to the 3.3V, Ground and Digital Pin 1 (UART 1 TX). Digital Pin 0 is RX, if you would like to receive data. You can find the pinout for the XBEE here .
Program the netduino: follow the instructions from their website (http://www.netduino.com/downloads/ ). The netdinos use the .NET Micro Framework (which uses a compact version of C# or VB). They have some code samples on their site, but I will attach the receiver and transmitter code on this instructable.
The main function of the transmitter polls the sensors every minute or so then broadcasts the data over the XBEE. I send each sensor as a seperate string and the receiver parses all incoming sensor data
Step 2: The Receiver
Wiring up the receiver: The receiver requires 2 serial connections, one from the XBEE and one to the ioBridge. Connect the XBEE to the 3.3V, Ground and Digital Pin 0 (UART 1 RX). Digital Pin 1 is TX, if you would like to receive data. For the ioBridge, connect the Ground and RX (minimum) to UART 2 (Digital Pins 2/3). The pinout for the serial smart board is here .
Program the netduino: The main function in the receiver listens for serial data from the XBEE and once data is received, stores the data. Roughly once a minute the data is transmitted to the ioBridge (which then stores the data on ThingSpeak). Using ThingSpeak I can publish graphs/charts with the data from the sensors.
Step 3: IoBridge Configuration
Connect the serial smart board to the ioBridge (unplug ioBridge when connecting). Login to your ioBridge account and select Modules from the navigation. Select your module and change the mode of the channel you connected the serial smart board to serial. The ioBridge should now be good to go. I use the ioBridge serial web services API to update Thingspeak. Due to an issue with ioBridge's ThingHTTP api, I just used the GET api to update the sensors. The next step will explain the ThingHTTP app and serial web services setup.
Step 4: ThingSpeak
If you don't have a ThingSpeak account, please sign up for one here. Once logged in, choose Channels from the navigation and create a new channel. Enter some information about the channel and click Update Channel. On the right, you will find a URL for updating your channel. Copy this and then click Apps from the navigation and select ThingHTTP. Create a new request, enter the following information:
- URL: https://api.thingspeak.com/update
- Method: POST
- Content Type: application/x-www-form-urlencoded
- Host: api.thingspeak.com
- Body: key=CHANNEL_WRITE_API_KEY_HERE&field1=%%field1%%&field2=%%field2%%&field3=%%field3%%
Repeat the field entries for how many sensors you want to track. Choose Update Request when you are done. On the right you will see the URL to access your ThingHTTP channel. In the netduino code, I send [[[get|ttp://api.thingspeak.com/apps/thinghttp/send_request?api_key=THING_HTTP_KEY&field1=[SENSOR_DATA]&field2=[SENSOR_DATA]&field3=[SENSOR_DATA]]]]. Again, I used GET because the ThingHTTP channel was having issues.
Step 5: Wrapup (Source Code)
With this setup you should be able to get about 6 sensors per netduino transmitter up on the web. I haven't tried out this solution with multiple transmitters but with minor work should be possible. I used a 9V power adapter to power the netduinos (sparkfun ).
This was my first project with a netdunio and I am pretty satisifed with the results. It seems to be pretty reliable. ThingSpeak allows me to take the raw sensor data and get it up on the internet quickly.
Thanks for reading!