Friday, January 11, 2013

Getting Started with JeeNode v6

Two JeeNode v6 kits; RFM12-B radios not installed yet
JeeNode is an Arduino-compatible wireless solution based on the RFM12-B-S2 wireless transceiver including really nice driver libraries that make multi-node wireless communication ridiculously easy.

Starting with a standard JeeNode v6 kit, let's get cracking with assembly and testing.

Assembly

Do this for each of your JeeNodes.
  • You'll need a soldering iron, flux pen or flux paste, and solder.
  • Start by installing each of the four 0.1uF bypass capacitors, C1, C2, C3, and C4
  • Next, install the 47uF electrolytic capacitor, aligning polarity markings on the board and cap
  • Install the 10K reset pullup resistor
  • Now install the 28-pin socket onto the board
  • If the RFM12-B isn't installed yet, carefully align it so that the crystal is opposite the antenna connector. There's a crystal outline marking on the main board.
  • Carefully hold it in place while soldering one pad. Reheat and realign as needed, touching up with flux if the solder doesn't flow well
  • Once aligned, tack down a second pin on the opposite side of the board
  • Now solder in all the RFM12-B pins
  • Install the 16MHz crystal
  • Install the four female port headers
  • Install the 6-pin FTDI connector
  • Install the 3.3V regulator (TO-92 case, looks like a transistor) carefully matching flat sides on board and device
  • Lastly, install the antenna. Cut some wire to the appropriate length for the frequency of your radio. For a 1/4 wavelength antenna, divide the speed of light by the frequency divided by 4. E.g., 3E8 / 434E6 / 4 = 17.27cm
That's it, you're done.

Environment Setup

  • If you haven't, download the Arduino software.
  • You need an FTDI cable or breakout board that supplies 5V but has 3.3V logic levels
  • Download the JeeLib, containing RF12 and Ports libraries, from github.
  • Uncompress the archive, and store the files in your Arduino libraries directory.

One JeeNode Demo

Do this for each of your JeeNodes. Mine weren't flashed with the RF12demo.
  • Open Arduino and then select the RF12demo from File > Examples > RF12 > RF12Demo
  • If your IDE can't open the file, instead open the RF12demo.ino file in a text editor, copy, and paste into a new Arduino sketch
  • Connect your 5V FTDI programmer
  • Compile and download the RF12demo program
  • Open up a terminal emulator, connect to your FTDI board
  • Type ? and see if something like the following comes up. If so, you're golden.
Available commands:
  i     - set node ID (standard node ids are 1..26)
               (or enter an uppercase 'A'..'Z' to set id)
  b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
  g    - set network group (RFM12 only allows 212, 0 = any)
  c      - set collect mode (advanced, normally 0)
  t          - broadcast max-size test packet, with ack
  ..., a - send data packet to node , with ack
  ..., s - send data packet to node , no ack
  l      - turn activity LED on PB1 on or off
  q      - set quiet mode (1 = don't report bad packets)
Remote control commands:
  ,,, f     - FS20 command (868 MHz)
  ,, k              - KAKU command (433 MHz)
Current configuration:
 A i1 g212 @ 433 MHz 

Two JeeNode Demo

Of course having one transciever is useless. So let's get the second going. Power it up with 5V. If your other JeeNode isn't connected, hook up your FTDI, open a terminal window and connect to the JeeNode.

Type 2i to set your JeeNode identity to 1. Now send a test packet. Type t and you should see this:

> 0t
test 2
 -> 66 b
OK 194

The OK means the test packet was acknowledged by the other radio. Sweet! Now type 000,1 a which sends the data packet "000" (ascii 0's) to node 1 with acknowledgement requested. You should see:

> 1a
 -> 1 b
OK 129

Then type in 000,1 s which sends the same packet but without acknowledgement. You should see this.

> 1s
 -> 1 b

If you let it sit for a little while you may start to see numbers across your screen.

 ? 45 26 155 128 119 93 38 238 253
 ? 21 159 192 167 31 127 183 204 236 247 246 145 197 251 157 90 239 232 56 127 22
 ? 161 145 219 34 147 199 184 69 53 59 245 199 158 181 71 88 99 209 2 170 255

These indicate data packets received. The "?" means the checksum didn't pass. "OK" would indicate a good checksum. The cause is most likely RF interference.

Another Demo

Pick one of your JeeNodes and download the radioBlip example sketch after making sure the initialization is correct for your radio (line rf12_initialize(22, RF12_433MHZ, 5); in my case since I'm using 433MHz radios from Sparkfun).

You can change the frequency of transmission by changing the line     Sleepy::loseSomeTime(60000); which sleeps the JeeNode for 60 seconds. I changed the interval to 6000 so the node transmits every 6 seconds.

JeeNodes use group IDs to partition sets of nodes. The radioBlip uses group 5. So you need to set your RF12Demo JeeNode to this group. Type 5g at the prompt. After you do that, you should start seeing packets coming in on your RF12Demo JeeNode.

> 5g
 B i2 g5 @ 433 MHz 
OK 22 7 0 0 0
OK 22 8 0 0 0
OK 22 9 0 0 0
OK 22 10 0 0 0
OK 22 11 0 0 0
OK 22 12 0 0 0

That's it, your JeeNodes are up and running, life is good, time to tackle a fun wireless sensor project.

1 comment:

  1. How did you learn to use the trancievers? I can't get them to keep communication. I get a dozen successes then the system hangs. I'm just hacking from other programs. Is there a more complete guide to writing code for these ..neat stuff though,,,you got me this far thanks

    ReplyDelete