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:
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:
- Plug in the JeeLink – it will briefly flash on its red and green LEDs.
- 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).
- 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:
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:
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).
(This series of posts is also available from the Dive Into JeeNodes page on the Café wiki.)