Beginning the JeeNode Adventure

Update 2013-04-05: I got thinking and realized the SMD version of the JeeNode includes the activity LED - the normal version does not. So while the Hello World sample makes sense, it would be nice if they reminded folks of the SMD difference. I also found a reference to the activity LED and the RF12demo command to control it: "Activity LED"

So I took this week off to play around with some electronics projects I've been thinking about for a while. One of those is the JeeNode. The JeeNode is, yet another, Arduino-compatible device. The cool thing is it has a built-in radio and supporting library. Glancing around that website, the Modern Device website (the U.S. partner) and the JeeLabs Blog, it looked like there was tons of documentation that would be helpful in getting started. Little did I know what I was getting myself into.

Picture of JeeNode bits

In the picture above, you can see the collection of parts I purchased. I also ordered a battery box and some extra header pins. From top to bottom, that's a BUB II (a USB to TTL serial adapter to make programming the JeeNode easier), a JeeNode SMD, a JeeLink (a JeeNode in a USB key form factor that makes it easy for a host to communicate with your JeeNode network), and a Room Board kit. I opted to forgo the SHT11 sensor, because it adds about 30 bucks to the cost of the kit. I'm waiting for a DS18B20 to arrive, that I'll be using instead.

I got the node and BUB soldered up and went to the web to read up on first use guidance. Instead of finding helpful advice, I was met with broken links and either out-dated references to older revisions of the boards or perhaps the info is just plain wrong. It didn't help that I have exactly zero experience with the Arduino universe. In hindsight, I probably should have started there before jumping into the JeeNode world.

First Step

So in hindsight, I should have installed the Arduino IDE first. I tried talking to the JeeNode using minicom, which worked, but I wasn't sure if the lack of output was a minicom configuration issue (oh how I didn't miss you at all, serial communications) or I was doing something wrong with the node. On Fedora, the latest stable Arduino IDE was available, so I installed that:

sudo yum install arduino

I ignored everything I read online about chmod'ing etc. When I first ran the IDE, it suggested my user be added to a couple of groups and offered to do it for me. It runs the appropriate usermod commands for you and then requests you to logout and back in for the group changes to take affect. Once you have the IDE up and functioning, you can launch the Serial Monitor and start playing with the RF12demo sketch that comes pre-installed. The initial output from RF12demo is a usage screen.

The commands are awkward and unclear, unless you read the RF12demo documentation. In hindsight, I should have read it, but I wanted to see my node do something! Both my JeeNode SMD and JeeLink came with an older version of the demo sketch (v7). If you type 1l and send it to the node, a blue LED on the node will light (0l will turn it off). The current version (v12 as of this writing) doesn't list the l command as an option, but it's still in there and will work just dandy. It lives!!!

Next, I mistakenly tried to perform the "Hello World" demo on their site. What they don't bother to tell you is that B1 pin the sketch is going to pull high also happens to be what the blue LED on the node is attached to. The other big problem you'll run into if you've never played with the Arduino language, is that sketch will not work as written. I have no idea if it did in an older version of the IDE or what....but I can't believe they haven't updated it or at least added clarification. Whatever. Luckily, I already know how to code, so I read the output from the IDE and tweaked things accordingly. Here is what the sketch should look like:

#define LED_PIN 9
void setup () {
  pinMode(LED_PIN, OUTPUT);
}

void loop () {
  digitalWrite(LED_PIN, 1);
  delay(500);
  digitalWrite(LED_PIN, 0);
  delay(500);
}

int main () {
  init();
  setup();
  for(;;)
  loop();
  return 0;
}

Factory reset?

OK, so I got the demo sketch working. But now I had lost the RF12demo. Crap. Luckily, everything is Open Source and on GitHub! Check out the JeeLib Project. They have a JeeLib Wiki page, but guess what - it doesn't tell you about the Arduino gotchas when trying to load the library! The first mistake I made, was to assume that I needed to unzip the file. Nope - the IDE expects you to provide it a zip file. The second problem is that the IDE doesn't like anything but alphanumberics in the top directory of the zip file. If you download the zip file of the master branch, the top directory in the zip file is called "jeelib-master" and the IDE chokes. You'll have unzip, rename, then re-zip the directory tree to get the library to properly import.

Once you have the library imported, you can go to the File menu, then examples, then JeeLib. In there you can navigate to the RF12demo. Compile and download it to your node (or link) and you're back to factory defaults.

What's next

Well that's enough for now. I need some dinner and a break - my eyes are starting to bleed. I have some more bits coming next week (like the Dallas Semi part), so truly useful things are still a ways off. This weekend I'll clean my circuit boards and play around with coding some simple network demos so I can get the feel for using the radios.