The idea is to pass all incoming RF12 packets to Ethernet using UDP broadcasts. By using the collectd protocol, many different tools could be used to further process this information.
What I did was take the etherNode sketch in the new EtherCard library, and add a call to
forwardToUDP() whenever a valid RF12 comes in. The main trick is to convert this into a UDP packet format which matches collectd’s binary protocol:
sendUdp() code has been extended to recognize “multicast” destinations, which is the whole point of this: with multicast (a controlled form of broadcasting), you can send out packets without knowing the destination.
The remaining code can be found in the new JeeUdp.ino sketch (note that I’m now using Arduino IDE 1.0beta2 and GitHub for all this).
It took some work to get the protocol right. So before messing up my current collectd setup on the LAN here at JeeLabs, I used port 25827 instead of 25826 for testing. With JeeMon, it’s easy to create a small UDP listener:
And sure enough, eventually it all started to work, with RF12 packets getting re-routed to this listener:
Now the big test. Let’s switch the sketch to port 25826 and see what WireShark thinks of these packets:
Yeay – it’s workin’ !
The tricky part is the actual data. Since these are raw RF12 packets, with a varying number of bytes, there’s no interpretation of the data at this level. What I ended up doing, is sending the data bytes in as many collectd 64-bit unsigned int “counter values” as needed. In the above example, two such values were needed to represent the data bytes. It will be up to the receiver to get those values and convert them to meaningful readings. This decoding will depend on what the nodes are sending, and can be different for each sending JeeNode.
I’ve left the original web browser in as well. Here is the “JeeUdp” box, as seen through a web browser:
(please ignore the old name in the title bar, the name is now “JeeUdp”)
It’s not as automatic out of the box as I’d really like. For one, you have to figure out which IP address this unit gets from DHCP – one way to do so is to connect it to USB and open the serial console. The other bit is that you need to configure the unit to set its name, the UDP port, and the RF12 settings to use. There’s a “Configure” link of the web page to do this – a some point, I’d like to make JeeMon aware of this, so it can do the setup itself (via http). And the last missing piece of the puzzle is to hook this into the different drivers and decoders to interpret the data from these UDP packets in the same way as with a JeeLink on USB.
Ultimately, I’d like to make this work without any remote setup:
- attach Ethernet and power to this box (any number of them)
- each box starts reporting its status via UDP (including its IP address)
- a central JeeMon automatically recognizes these units
- you can now give a name to each box and fill in its RF12 configuration
- packets start coming in, so now you can specify the type of each node
- decoders kick in to pick up the raw data and generate meaningful “readings”
- that’s it – easy deployment of JeeNode-based networks is on the horizon!
Not there yet, but all the essential parts are working!