Experimenting with the JeeLabs Room Node

JeeNode with Room Node attachedAfter many years I’ve re-discovered electronics as a hobby, thanks to the JeeLabs and Arduino communities.

I’m setting up a small electronics lab with some basic equipment like the Rigol DS1052E oscilloscope (approx. 300 Euros; I “upgraded” mine to the DS1102E firmware to increase the scope’s bandwidth to 100MHz).

One of my first projects is building a Wireless Sensor Network (WSN) to measure humidity, temperature, brightness and motion in several locations at home. The necessary hardware is depicted on the right.

I’ve added a simple resistor ladder network to one of the analog inputs, allowing me to measure battery voltage; these units are supposed to be powered from rechargable batteries for at least a year. Standby power consumption of these devices is in the micro-Amp range; much better than a standard Arduino. The JeeNode comes with an onboard RF12B wireless module (not visible in the picture; it’s below the PIR board) for communications.

While experimenting with the software, I wanted to take a closer look at the actual PIR sensor output signal. The Rigol oscilloscope has all kinds of handy features that assist in analysing and measuring these signals. It can store screenshots on a USB stick, or be remote controlled from a PC – excellent value for money!

Rigol DS1052E Screenshot of PIR sensor output, 570ms pulse widthRigol DS1052E Screenshot of PIR sensor output, with additional information
As you can see, the display is only 320 pixels wide (QVGA) but that is enough for my modest needs ;-)

I tried triggering the PIR as short as possible. The PIR open collector output is pulled low (negative edge) if motion is detected. The minimum output pulse width was approx. 570 milliseconds wide. If the sensor sees continuing motion, the output will remain low for that period (at least, in Continuous trigger mode).

The accompanying “sketch” (Arduino-talk for a program that you write) sends out packets at regular intervals (once per minute, or less), containing all the telemetry info. If motion is detected, an interrupt is generated that causes a packet to be sent out immediately.

I modified a receiver “sketch” to decode the telemetry info and generate a human-readable report:

ROOM-18 1695b 221* 1 38% 22.6C 4.638V 0
 -> ack-18
ROOM-25 1695b 21* 0 46% 19.6C 5.180V 0
ROOM-18 1695b 221* 1 38% 22.7C 4.638V 0
 -> ack-18
 ? 17 166 224 91 134 200 17 70 143 23 173 91 150 205 3 49 236 76 147 243 149
 ? 45 230 233 2 36 124 197 34 202 40 8 137 155 8 37 81 182 185 91 22 183
ROOM-18 1695b 221* 0 38% 22.7C 4.638V 0

Here, I have two JeeNodes (ID 18 and 25), each outfitted with a Room Board. The 433MHz band is crowded, so you’ll see spurious traffic (indicated by ‘?’). If a proper Room Node packet is recognized, it is decoded and displayed.

The report indicates the source of the transmission (ROOM-18 or ROOM-25); free RAM (1695 bytes); brightness (0-255); motion (0-1); humidity; temperature and battery voltage. The last “0” is the Low Battery indicator.

Regular transmissions are not acknowledged; it’s no problem if you lose a couple of data points. If the PIR is triggered however, acknowledgements are requested to ensure that the central node registers this event.

I’m still working on the central node software; I’ll probably just parse the data and stick it in a RRD file or database…

Electronics + Software = hours of fun! ;-)

JeeNode, JeeLink and the Arduino IDE

The Arduino IDE is used to program and debug your Arduino-compatible boards. JeeLabs has a variety of Arduino-like boards. I use the following settings in the Arduino IDE:

On Mac OS X, the Serial port (Tools/Serial Port) should be set to a device named /dev/tty.usbserial-XXXXXXXX. The speed should be set at 57600 bps.

JeeLabs device Arduino IDE: Tools/Board
JeeLink v3 Arduino Uno
JeeNode v6 Arduino Duemilanove or Nano w/ ATmega328

TIP: If you have more than one board, multiple serial port devices will exist. You can easily find out the right one by checking the available entries first (in Tools/Serial Port), then plugging in the board, then checking again.

Linkdump: Arduino and JeeLabs

Here’s a bunch of assorted links that I dug up searching for Arduino and JeeLabs stuff:

Hacks:

Data logging and reporting:

  • Live Graph –聽Plot and explore your data in real-time!
  • Pachube –聽Store, share & discover realtime sensor, energy and environment data from objects, devices & buildings around the world.

Sensors

Arduino GSM/GPRS/UMTS:

Rotary encoders:

Internet

Miscellaneous

Getting started with the RF12 wireless module on a JeeNode

I recently ordered a couple of JeeNode v6 boards. These boards are mostly Arduino-compatible (standard shields won’t fit) and optionally contain an RF12 radio module. They are ideal for creating wireless sensors.

On Mac OS X, the Arduino IDE stores your sketches in your home directory, under ~/Documents/Arduino. Open a Terminal window and type the following commands:

cd ~/Documents/Arduino
mkdir libraries
cd libraries
svn co svn://svn.jeelabs.org/jeelabs/trunk/libraries/Ports
svn co svn://svn.jeelabs.org/jeelabs/trunk/libraries/RF12

Done! The RF12 library is now installed. Do not forget the Ports library, or you will see errors like this:

RF12demo.cpp:7:19: error: Ports.h: No such file or directory

Restart the Arduino IDE. You should now see several new entries under File | Sketchbook | libraries | RF12. Open the RF12demo sketch and try to compile it. There should be no errors.

For a more meaningful demonstration you will of course need at least 2 JeeNodes with RF12. Load File | Sketchbook | libraries | RF12 | pingPong and try to compile it. Upload to both JeeNodes and watch the Serial Monitor. If there is traffic you will be greeted by “OK Hello!”:

57600
Send and Receive
OK Hello!
OK Hello!