RFM69Pi V3

Development of the RFM69Pi has been a team effort between Martin Harizanov, Glyn Hudson and Ken Boak.

The RFM69Pi enables the Raspberry Pi to receive data from other RFM69CW or RFM12B (backward compatible) wireless modules

The RFM69Pi V3 consists of an RFM69CW wireless module and an ATmega328 microprocessor running the OptiBoot serial bootloader (modified for 8MHz internal oscillator) which is Arduino compatible. See our blog post introducing the new RFM69CW module.

The ATmega328 runs a modified version of JeeLabs's RF12Demo.
Raw wireless packets are passed to the Pi via the Pi's internal serial port.

Technical Overview

ATmega328 based, has more memory and hardware serial support

Runs on the internal 8Mhz oscillator (to save unnecessary components)

SMT components.

Lower profile to fit inside most Raspberry Pi enclosures

The new RFM2Pi with ATmega328 allows programming directly from Raspberry Pi using avrdude (..and OptiBoot)

Communicates with Raspberry Pi via /dev/ttyAMA0 at 38400 bps

RFM69Pi V3 Setup

The RFM69Pi V3 can be purchased pre-assembled and pre-loaded with firmware from the OpenEnergyMonitor shop. No assembly or setup required.

You should see the message Serial console on /dev/ttyAMA0 is disabled, the serial port is now free for communication with the ATMega328 on the RFM69Pi

Minicom can be used to view the serial output of the RFM69Pi direcly:

$ sudo apt-get install minicom

$ minicom -b38400 -D/dev/ttyAMA0

[CTRL + A] then [X] to exit minicom

Raspberry Pi 3 Compatibility

The emonPi communicates with the RasPi via GPIO 14/15 which on the Model B,B+ and Pi2 is mapped to UART0. However on the Pi3 these pins are mapped to UART1 since UART0 is now used for the bluetooth module. However UART1 is software UART and baud rate is dependant to clock speed which can change with the CPU load, undervoltage and temperature; therefore not stable enough. One hack is to force the CPU to a lower speed ( add core_freq=250 to /boot/cmdline.txt) which cripples the Pi3 performance. A better solution for the emonPi is to swap BT and map UART1 back to UART0 (ttyAMA0) so we can talk to the emonPi in the same way as before.

RasPi 3 by default has bluetooth (BT) mapped to /dev/AMA0. To allow use to use high performace hardware serial (dev/ttyAMA0) and move bluetooth to software serial (/dev/ttyS0) we need to add an overlay to config.txt. See /boot/overlays/README for more details. See this post for RasPi3 serial explained.

You should see data from emonPi ATmega328, sending serial v should result in emonPi returning it's firmware version and config settings.

To fix SSHD bug (when using the on board WiFi adapter and NO Ethernet). Edit /etc/ssh/sshd_config and append:

IPQoS cs0 cs0

Upgrading RFM69Pi Firmware Direct from the Pi

Since the Raspberry Pi lacks a DTR pin that makes it oh-so-easy to upload your hex files to the AVR, we need this hack to make it just as easy. Thanks to JCW from JeLabs for working this out, and Martin Harizanov for implementing it on the RFM12Pi.

Alternatively, you could flash the modified Optiboot bootloader, then upload the RF12_Demo_atmega328.cpp.hex to RFM69Pi direct from the Pi. See below for instructions on how to modify the OptiBoot bootloader, and above, for instructions on how to upload direct from the Pi once the bootloader is in place.

Modified OptiBoot Bootloader

The ATmega328 gets its clock from the the internal 8Mhz oscillator. This requires a special version of Optiboot optimised for 38.4 kbps. The modified and compiled version can be obtained at: from Martin's github.

The full guide on how to modify and re-compile Optboot is detailed on the Arduino forum here.

In order to compile Arduino sketches to work for this modified bootloader, we need to add a new entry in arduino-1.0.2\hardware\arduino\boards.txt.

Design Files & Reference

Debugging

Minicom can be used to view the RFM69Pi serial output via the Pi's internal serial port. If you're running a stock Raspbian image, you will need to enable access to ttyACM0 the internal UART serial port which the RFM69Pi uses. To do this, see instructions here: