Martin's corner on the web

[OBSOLETE] RFM2Pi board v1 rev3

> Wiki Home > [OBSOLETE] RFM2Pi board v1 rev3

[This project is obsoleted and not supported]

Note: There is a more advanced wiki at this address: http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi

The RFM2Pi board is an Attiny84+RFM12b based expansion board that plugs on top the Raspberry Pi‘s GPIO pins and provides serial interface with the RFM12b module. The board is pre-programmed with RFDemo sketch for Attiny84 and will output to Pi’s UART the incoming packets. This revision of the board is created in collaboration with openenrgymonitor.org

Eagle Design files are available here

The interface is bi-directional, that means the board can be configured and used to send Jeelib compatible packets as well. Software running on the Raspberry Pi side can parse and decode the serial input and make further processing, like posting to emoncms or cosm. Here is an example of capturing and decoding in perl: link. The latest modular emoncms version has add-on module to support the RFM2Pi board.

Note: Prior to going any further, please backup Raspberry Pi’s SD card

By default, you Raspberry Pi will be running the console on the UART. In order to use it for the RFM2Pi board, we need to free it up from the console:

  • Make sure Raspberry Pi’s UART is disconnected from the console and available for programs to use it
    • First, make a backup of the cmdline.txt file
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt
    • Next, edit it to remove references to Pi’s UART (ttyAMA0)
sudo nano /boot/cmdline.txt
    • Originally it contains this
dwc_otg.lpm_enable=0 rpitestmode=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
    • Edit it to look like this
dwc_otg.lpm_enable=0 rpitestmode=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
    •  Press Ctrl+O to save, then Ctrl+X to exit
    • Next, type “sudo nano /etc/inittab”  and comment (or remove) the line (towards the end of the file)
 2:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
  • Restart the Raspberry Pi by typing “sudo reboot” so changes take effect
  • I use minicom to view the serial data
sudo apt-get install minicom

And to run it at 9600 baud (or change that to whaterver baud you used on TinySensor’s side:

minicom -b 9600 -o -D /dev/ttyAMA0

Tip: you may use “sudo minicom -s” to store these settings as permanent

 Only after the UART pins are freed up you can plug the RFM2Pi board.

The board plugs on-top the Raspberry Pi and utilizes the following pins:

7 thoughts on “[OBSOLETE] RFM2Pi board v1 rev3

  1. PeterN

    Hi Martin,
    It looks like RaspberryPi_run.php supports sending data to remote server as well as local. I just can’t quiet figure out how to use same. Do you have working example or description.
    Thanks a mil. Cheers
    Peter

    1. admin Post author

      Hi Peter,
      I haven’t used that myself, but there is a button “Sync feeds” on the bottom of the FEEDS tab, there you can select a URL and remote key. This is Trystan’s work so I suggest checking in the openenergymonitor’s forums.

      Martin

      1. PeterN

        Thanks for speedy reply.
        Sorry I saw code in your raspberrypi_run.php that made me think you could point to another remote emoncms url e,g, post to both local and remote emoncms. Then you could always syn if you lost connection. I will look at syn.
        Thanks
        Peter

  2. PeterN

    Hi Martin, Looks like Trystan has done it already, can’t keep up with new feature they coming that quick. In panel raspberrypi there’s and option “Forward data to remote emoncms server”. Not quiet sure how it works yet. Cheers Peter

    1. admin Post author

      I also thought about this at one point, but the Attiny84 doesn’t have hardware I2C, it can be done in the software with bit-banging. I also think the serial is more reliable due to buffering on the Pi’s side.

  3. PeterN

    emoncms, RFM12B module with raspberrypi_run.php and 3G dongle. Issue I hope you can help the 3G dongle (K3520) working (sakis3g/Umtskeeper) but won’t post to to remote URL after reboot. The 3G connection comes up on boot and I can browse internet, raspberry pi cron shows still running. Tried a number of fixs including restart of cron – raspberrypi_run.php. “To rectify the process used “I have to login to dashboard Raspberry Pi and change remote url to false URL and save, then revert changes so url is correct and save again”.

    This process obviously resets something for remote URL and API somewhere, or restores some missing data but I don’t know what. Anyone shed some light on what above process may do or what may be restored or reset during process it may help with fix e.g. cron job rather then manual process.

    Cheers

    Peter