Basic wireless monitoring platform for experimentation and rapid prototyping.
- Raspberry Pi
- Arduino
- Node.js
- Bluetooth
- Awesome!
#Bill of Materials This is "must have" list for building the GroMon system. Each "half" of the solution is broken out separately. You can absolutely build either half independently, allowing you to split the purchase in two but still keep hacking.
- Raspberry Pi
- SD card
- Wifi dongle
- Bluetooth dongle
- Bluetooth Bee Standalone
- Seeed Studio XBee Carrier
- DHT11 temperature sensor
- Grove cables for connecting the Seeed Studios gear
But if not, you really should buy it.
- Micro USB cable
- Mini USB cable
- Some way of supplying power to the USB cables (like a wall wart, powered USB hub, etc)
- USB to TTL serial cable for the Raspberry Pi
#Raspberry Pi Setup This is a fairly high-level overview of how to set up the Raspberry Pi to host the GroMon application.
-
Pop in your wifi and bluetooth devices.
-
Download and install Raspbian onto an sdcard. (we downloaded 2013-02-09-wheezy-raspbian.zip)
-
Slap in wifi dongle and configure wifi (/etc/wpa_supplicant/wpa_supplicant.conf, ifdown wlan0, ifup wlan0)
-
Patch to current (sudo apt-get update && sudo apt-get upgrade). This does take a while.
-
Install bluetooth support (sudo apt-get install bluetooth). This also takes a while.
-
Quickly test bluetooth (hcitool scan)
-
Download and compile node.js 0.10.x. This takes a long time, almost 3hrs. If you are able to cross-compile for arm, do that.
#Bluetooth Bee Setup Simple instructions on how to assemble and program your Bluetooth Bee.
-
Mount the Bluetooth Bee on the XBee Carrier, leave the switch in the "Off" position.
-
Connect the temperature probe to the port labeled "D6D5" on the XBee Carrier.
-
Connect the USB cable to the XBee Carrier and your computer. Even if the switch is in the "Off" position, you'll get some LED activity. It's okay.
-
Flip the XBee Carrier switch into the "On" position. You should see a ton of LED activity now.
-
Fire up the Arduino IDE
-
Check under "Tools > Serial Port" and ensure you have a device listed.
-
Under the "Tools > Board" menu, select "Arduino Nano w/ATMega168".
-
Open the file GroMon.ino, search for "ProbeMon" and replace it with something more clever.
-
When ready, click the "Upload" button. If we're lucky everything will "just work"!
-
After uploading, power-cycle the XBee carrier. Your wireless probe is now programmed.
#Connecting the Raspberry Pi to the Bluetooth Bee
-
Power up the Bluetooth Bee and then log into the Raspberry Pi. The remainder of these steps will be performed on the Pi.
-
Check to see if bluetooth is running (service bluetooth status), if not, start it up (sudo service bluetooth start)
-
Search for the Bluetooth Bee (hcitool scan), it's either named "GroMon" or you changed it (which I hope you did). Take note of the hardware ID.
-
Check to see if bluetooth is running (service bluetooth status)
-
Run "sudo bluetooth-agent 0000 &". If you changed the PIN in the Arduino sketch, then use that in place of the zeros.
-
Run "sudo rfcomm release 0". If it says "Can't release device: No such device", that's totally okay.
-
Run "sudo rfcomm bind 0 1", this creates a serial port at /dev/rfcomm0, now we can eat it with Node.js!
-
Start the web app (cd ~/gromon/Web; node app.js). Within a few moments you should see messages flowing back and forth.
#Misc notes and whatnot
-
Sometimes, when you rename the Bluetooth Bee, the old name persists when you run "hcitool scan" or "bluez-test-discovery". You can edit /var/lib/bluetooth//names to correct this problem.
-
The normal boot cycle of the bluetooth bee is: booting = blinking blue led.. waiting to pair = alternating blue and red leds... paired = blinking blue led
Directions for running the full solution coming soon. Until then, here's how you can simulate the remote sensor and get a feel for how things work.
-
Open a terminal, then clone the GroMon repo.
git clone [email protected]:aulvi/gromon.git
-
Navigate into the Web directory, then install modules.
cd gromon/Web; npm install
-
Fire up socat and create a couple of serial ptys. This will take over your terminal.
socat -d -d pty,raw,echo=0 pty,raw,echo=0
This command will return two devices in the output (ie, "N PTY is /dev/pts/5").
-
Open another terminal and start the dummy probe using the first device from the command above:
node dummy-probe.js --port=/dev/pts/5
-
Start the web app using the other device:
node app.js --probePort=/dev/pts/6
-
Within a few seconds you should see messages moving back and forth.
Copyright (C) 2013 Adam Ulvi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.