Difference between revisions of "RFM12Pi V2"

From OpenEnergyMonitor Wiki
Jump to: navigation, search
(Operational Overview)
Line 12: Line 12:
  
 
==Operational Overview==
 
==Operational Overview==
The RFM12Pi V2 consists of an [http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless RFM12B wireless module] and an ATmega328 microprocessor running OptiBoot serial bootloader which is Arduino compatible.  
+
The RFM12Pi V2 consists of an [http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless RFM12B wireless module] and an ATmega328 microprocessor running OptiBoot serial bootloader (modified for 8mhz internal oscillator) which is Arduino compatible.  
  
The ATmega328 runs a slightly modified version of [https://github.com/jcw/jeelib/tree/master/examples/RF12/RF12demo JeeLabs's RF12Demo] raw wireless packets are passed to the Pi via serial using the Pi's internal UART serial port. The raw packets are processed by emoncms Raspberry Pi module, specifically the [https://github.com/emoncms/raspberrypi/blob/master/raspberrypi_run.php raspberrypi_run.php] script. See emoncms documentation on [http://emoncms.org/site/docs/raspberrypi emoncms.org] for detailed documentation regarding setting up and running emoncms on a Raspberry Pi with an RFM12Pi.   
+
The ATmega328 runs a slightly modified version of [https://github.com/jcw/jeelib/tree/master/examples/RF12/RF12demo JeeLabs's RF12Demo].
 +
Raw wireless packets are passed to the Pi via serial using the Pi's internal UART serial port. The raw packets are processed by emoncms Raspberry Pi module, specifically the [https://github.com/emoncms/raspberrypi/blob/master/raspberrypi_run.php raspberrypi_run.php] script.  
 +
See emoncms documentation on [http://emoncms.org/site/docs/raspberrypi emoncms.org] for detailed documentation regarding setting up and running emoncms on a Raspberry Pi with an RFM12Pi.   
  
  
Line 20: Line 22:
 
===RFM12Pi V2 Setup===
 
===RFM12Pi V2 Setup===
  
The RFM12Pi V2 can be purchased pre-assembled and from the OpenEnergyMonitor shop [LINK] there
+
The RFM12Pi V2 can be purchased pre-assembled and ready flashed with firmware from the OpenEnergyMonitor shop [LINK]. Therefore no assembly or setup is required to to the RFM12Pi itself.
sudo avrdude -v -p atmega328p -c avrispmkII -P usb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xE2:m -U flash:w:Optiboot328_8mhz_RF12_Demo.hex
+
  
====Upgrading ====
+
If you have assembled the RFM12Pi yourself or wish to reflash the firmware this can be done using the ISP header and a ISP programmer.
 +
 
 +
 
 +
====Upgrading RFM12Pi Firmware Direct from the Pi ====
  
 
Upload to 328 with ISP:
 
Upload to 328 with ISP:
Line 32: Line 36:
  
  
===Design Files===
+
====Flashing the Bootloader====
The board schematic, layout and firmware are available on [https://github.com/mharizanov/RFM2Pi/ github]
+
''The RFM12Pi should come pre-loaded with the bootloader and firmware, this step should not be required unless you have assembled the RFM12Pi yourself and used a blank ATmega328.''
 +
 
 +
Note: the RFM12Pi is a 3.3V only therefore it should not be powered by a 5V ISP programmer. To avoid accidental connection of 5V the VCC pin on the ISP header by default is disconnected. A jumper connection between the two adjacent pads must be made to connect the ISP VCC the VCC on the board. On some ISP programmers (such as the AVR MKII that I use) the VCC pin needs to be connected to initialise the programmer even though the programmer itself does not power the board. An easy way to power the board with 3.3V for programming is to connect it onto the Pi's GPIO taking care to align pin 1.
 +
 
 +
The stock RFM12Pi firmware can be downloaded in pre-compiled .hex form from github: [https://github.com/mharizanov/RFM2Pi/blob/master/firmware/RF12_Demo_atmega328/Optiboot328_8mhz_RF12_Demo.hex https://github.com/mharizanov/RFM2Pi/blob/master/firmware/RF12_Demo_atmega328/Optiboot328_8mhz_RF12_Demo.hex]. This pre-compiled .hex file contains both the optiboot bootloader and the modified RF12Demo Sketch.
 +
 
 +
The .hex can be flashed and the fuses set on the ATmega328 using the following avrdude command: 
 +
 
 +
<code> sudo avrdude -v -p atmega328p -c avrispmkII -P usb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xE2:m -U flash:w:Optiboot328_8mhz_RF12_Demo.hex </code>
 +
 
 +
Alternatively you could just flash the modified Optiboot bootloader then upload the RF12_Demo_atmega328.cpp.hex to RFM12Pi direct from the Pi, see instructions below.
 +
 
 +
 
 +
===Design Files & Referance===
 +
The board schematic, layout and firmware are available on [https://github.com/mharizanov/RFM2Pi/ Martin Mharizanov's github]
 +
 
 +
 
 +
[http://harizanov.com/2013/02/new-rfm2pi-board-in-the-works/ Martin Mharizanov's original blog post introducing the RFM12Pi V2]

Revision as of 19:49, 12 April 2013

RFM12Pi V2

The RFM12Pi allows the Raspberry Pi to receive wireless data from RFM12B wireless module.

Technical Overview

  • ATmega328 based, has more memory and hardware serial support
  • Runs on the internal 8Mhz oscillator (to save unnecessary components)
  • SMT used, board layout is optimized for pick-and-place assembly
  • Lower profile to fit inside most Raspberry Pi enclosures
  • The new RFM2Pi with ATmega328 allows programming directly from Raspberry Pi using avrdude (..and OptiBoot)

Operational Overview

The RFM12Pi V2 consists of an RFM12B wireless module and an ATmega328 microprocessor running OptiBoot serial bootloader (modified for 8mhz internal oscillator) which is Arduino compatible.

The ATmega328 runs a slightly modified version of JeeLabs's RF12Demo. Raw wireless packets are passed to the Pi via serial using the Pi's internal UART serial port. The raw packets are processed by emoncms Raspberry Pi module, specifically the raspberrypi_run.php script. See emoncms documentation on emoncms.org for detailed documentation regarding setting up and running emoncms on a Raspberry Pi with an RFM12Pi.


RFM12Pi V2 Setup

The RFM12Pi V2 can be purchased pre-assembled and ready flashed with firmware from the OpenEnergyMonitor shop [LINK]. Therefore no assembly or setup is required to to the RFM12Pi itself.

If you have assembled the RFM12Pi yourself or wish to reflash the firmware this can be done using the ISP header and a ISP programmer.


Upgrading RFM12Pi Firmware Direct from the Pi

Upload to 328 with ISP:

Sketch upload on Pi: cd /RFM2Pi/firmware/RF12_Demo_atmega328 avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:RF12_Demo_atmega328.cpp.hex


Flashing the Bootloader

The RFM12Pi should come pre-loaded with the bootloader and firmware, this step should not be required unless you have assembled the RFM12Pi yourself and used a blank ATmega328.

Note: the RFM12Pi is a 3.3V only therefore it should not be powered by a 5V ISP programmer. To avoid accidental connection of 5V the VCC pin on the ISP header by default is disconnected. A jumper connection between the two adjacent pads must be made to connect the ISP VCC the VCC on the board. On some ISP programmers (such as the AVR MKII that I use) the VCC pin needs to be connected to initialise the programmer even though the programmer itself does not power the board. An easy way to power the board with 3.3V for programming is to connect it onto the Pi's GPIO taking care to align pin 1.

The stock RFM12Pi firmware can be downloaded in pre-compiled .hex form from github: https://github.com/mharizanov/RFM2Pi/blob/master/firmware/RF12_Demo_atmega328/Optiboot328_8mhz_RF12_Demo.hex. This pre-compiled .hex file contains both the optiboot bootloader and the modified RF12Demo Sketch.

The .hex can be flashed and the fuses set on the ATmega328 using the following avrdude command:

sudo avrdude -v -p atmega328p -c avrispmkII -P usb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xE2:m -U flash:w:Optiboot328_8mhz_RF12_Demo.hex

Alternatively you could just flash the modified Optiboot bootloader then upload the RF12_Demo_atmega328.cpp.hex to RFM12Pi direct from the Pi, see instructions below.


Design Files & Referance

The board schematic, layout and firmware are available on Martin Mharizanov's github


Martin Mharizanov's original blog post introducing the RFM12Pi V2