Pocket Beagle RFM69 cape
A half-mounted Pocket Beagle cape with RFM69 radio, atmega328p, RTC, atsha204, a few status LEDs, and a JST connector for Pocket Beagle backup power.
So, last year Pocket Beagle came out as the next installment of BeagleBone/Board boards. I like these a lot because they are completely open, with good documentation and support, and they work really well. I got one of the pocketbeagles and it seemed perfect for a gateway for my local jeenode sensor network. The pocketbeagle also has (finally!) a really well thought out layout of pins, making it really simple to use UART, I2C and SPI from just one inner row of pins.
I designed and made a cape for it, with all the (according to me) goodies needed for a good RFM69/jeenode gateway...
Features and design
- atmega328p (programmable from the beagle), hooked to serial and SPI
- RFM69(HW) radio, hooked to SPI; the select and IRQ lines can be connected either to m328p or to beagle (so that m328p can be bypassed completely and the beagle could talk to the radio directly if wanted)
- DS1338C RTC clock with CR1225 battery backup
- ATSHA204A auth chip, hooked to atmega328p
- 4 status LEDs
- a JST connector hooked to "LiPo battery backup" pins on the beagle (the beagle has its own LiPo management chip)
- it only covers one inner row of pins, plus two pins on the outer side (for the battery), leaving the whole of the other side open for other stuff
As usual, the design is open:
You can order PCBs from pcbs.io, but I've got some left, so if you want one, get in touch. I have (as of 2018-07-02T18:24:10) some leftover stuff, including some not-entirely standard part (e.g. the barrel-shaped 16MHz crystal for m328p, the RTC chip or a resistor array).
It's of course almost all SMT parts, but the smallest are 0805, so it's not too difficult to solder by hand.
Using the cape
I've been using the cape for several months now for receiving sensor readings from my home sensors, and it works as expected; no surprises.
The atmega328p is programmable from the beagle; m328p's reset is routed to a pin on the beagle, so just wiggle the pin and the run avrdude. The initial bootloading can be also done from the beagle (since the SPI pins are also routed to beagle's SPI), but I find it easier just hooking up the board to an actual AVR programmer while it's not plugged into the beagle.
The RTC clock communicates via I2C, and works fine with the usual rtc-ds1307
module on beagle/linux (I use debian 9 stretch on the beagle, and it happily
ran for 2 months without intervention or problems).
I have not played with ATSHA204A authentication chip very much yet, beyond confirming that it works and responds.
The antenna for RFM69 is expected to be a wire whip of the right length (which depends on your radio frequency).
For the software side, on m328p I run a simple gateway Arduino sketch, whose serial output is compatible with the standard jeenode RF12demo gateway. For radio communication I use jcw's "new" RFM69 driver, which is compatible with the new jeenode zero, and it is really straightforward to understand (two include files, nice and clean code). All the code (gateway, sensors; plus a couple of versions using other libraries) is here.
On the beagle, I then use ser2net to get the messages onto TCP, and then I wrote a small program in rust to multiplex (ser2net only accepts one connection at a time), process (decode) messages and write the readings into one or more outputs (currently supports plain CSV files, MQTT publish and MongoDB). The code is here.
By the way, the really smart USB hub on the pocketbeagle is this one.