Computing stuff tied to the physical world

DIJN.04 – Receive data with a JeeLink

In Uncategorized on Feb 8, 2013 at 00:01

Welcome to the fourth instalment of Dive Into JeeNodes. Let’s go wireless!

The JeeLink is a version of the JeeNode with some extra features, but the main reason I like to use it as central node is that it comes as a little pluggable unit – quite convenient, here it is in action on my MacBook, for example:

DSC_4357

As delivered, JeeLinks and JeeNodes come with the RF12demo sketch pre-installed. This can be used for a variety of tasks, including basic configuration and basic packet reception.

But first, we need to be able to connect to the JeeLink over serial USB. This is similar to the uploading performed in the previous DIJN post:

  1. Plug in the JeeLink – it will briefly flash on its red and green LEDs.
  2. Start the Arduino IDE, and go to the Tools -> Serial Port menu entry. Then, make sure to select the JeeLink, which will show up as a second serial port (assuming you still have the other JeeNode plugged in).
  3. In the IDE, click on the right-most button, the one with the magnifying glass, to bring up the “Serial Monitor”.

That last step will open up a new window, with something like this:

Screen Shot 2013-02-07 at 14.05.31

If you only get gibberish, you need to adjust the baud rate popup in the lower right to 57600. If you don’t get anything: double-check that you selected the correct serial port.

What we need to do next, is to match up the wireless settings to be able to pick up the packets sent from that other JeeNode. There are a few settings:

  • The frequency band must be set to 868 MHz. Note that this may differ from the unit you have, and the frequency used in your part of the world, but all JeeLinks and JeeNodes can operate in any of the 433 / 868 / 915 MHz bands. The only difference is that the power and range will be dramatically reduced in bands for which that wireless module is not optimised. In this case, we don’t care (yet), since the first tests will be across less than 1 meter, which can easily be bridged in any frequency band.
  • The “net group” must match between all transmitters and receivers, to allow them to pick up each other’s packets. In this case, we need to use group “100″.
  • The “node ID” is normally different for each node, so they can tell each other apart. For a central node, it’s usually best to pick the special ID “31″.

The commands to set these parameters can be combined into a single line:

Screen Shot 2013-02-07 at 14.15.51

Once the commands have been entered, you will see a confirmation shown as follows:

 _ i31 g100 @ 868 MHz 

And then, if the sending JeeNode is still powered up, these – once a second:

OK 1 0
OK 1 1
OK 1 2
OK 1 3
OK 1 4
OK 1 5
[etc...]

The “OK” text indicates reception of a valid packet (you may also get some “?” packets, which are usually caused by picking up noise or other 868 MHz transmitters), the first byte indicates that this is a regular packet broadcast coming from node #1, and the second byte is the counter, incremented for each new packet, as you can see in the test1 source code.

Congratulations. You have created your own Wireless Sensor Network. Well, no actual sensors yet, but we’ll get to that soon enough. First, we need to look more deeply into this thing called a “Ra(h)spberry P(h)i” (here’s a little exercise to get you started).

Onwards!

(This series of posts is also available from the Dive Into JeeNodes page on the Café wiki.)

  1. I have a number of “Really Bare Bones Board” devices purchased from either Wulfden or Modern Device, and I want to make use of these devices since they are perfectly good. In November 2011, I ordered an 915 Mhz RFM12B board from Modern Device rather than a JeeLink. I built the RFM12B kit and connected it to my most modern Really Bare Bones Board. Then I became quite distracted and did nothing else with either my RFM12B board or my JeeNode v6. Everything, JeeNode, Really Bare Bones Board, and the RFM12B board and large 3M breadboard, went into a plastic storage bin and reposed on the shelf, almost forgotten. After more than a year I came back to it tonight. To my delight, as soon as I loaded the RF12Demo sketch, the Really Bare Bones board responded just fine in serial port mode. I followed the directions above. I set the RFM12B board to 868 MHz and it responded to the set command just fine, but printed gibberish in the serial terminal. I realized that my JeeNode V6 isn’t set to 868 Mhz. Instead it is set to 915 MHz. So I changed the frequency of the RFM12B board to 915 MHz and left all the parameters as suggested, e.g. node id of 31. That worked instantly and the OK response was being printed to the serial terminal. I am so pleased to have this success. Now if only I know what pin 9 is on the Really Bare Bones Board, since it probably doesn’t correspond exactly to the JeeLink.

Comments are closed.