encounters with electron•ics / by flabbergast

From Ciseco to HopeRF

Recently there were several things related to Ciseco that annoyed me a bit (RFµ-328 is going to get a bigger footprint; they removed an item from a bundle in their shop from one day to the next without changing the price or announcing anything; buying SRF radios can be now only in bulk (10 minimum) UPDATE: Ciseco rescinded the decision; SRFs are available individually again. Well, too late for me.). Don’t get me wrong, they still make cool stuff (like the RFµ-328), but I didn’t want to depend on them for radio modules.

So I decided to switch to HopeRF’s RFMs. Eventually I went for the newer RFM69CW, although they are less readily available than RFM12B, and the firmwares using RFM12B will need modifications. Luckily the most common library used for RFM12Bs, jeelib, supports the newer radios and the two types can communicate with each other. I’m discovering JeeNodes, mini-wireless modules from anarduino and moteinos, all using compatible HopeRF radios.

Of course, I need to attach the new radio to my Raspberry Pi. The easiest option would be to buy RFM12Pi from OpenEnergyMonitor’s shop, but I had several gripes with this (in order):

  • It would have to be the top module on the stack: non-stackable connector, which can’t be replaced with a stackable one since it doesn’t use the whole length of Pi’s pins, but annoyingly does cover I2C.
  • Reset line from the atmega328p is connected to GPIO4 on the Pi - which I don’t like since the OneWire kernel module for Dallas ICs uses the same pin. It is way easier to modify which pin avrdude uses than mess with the kernel module.
  • It would come with RFM12B.
  • Price. Not by much though, compared to my setup.

In the end, I opted for the combination of Slice of Pi with a RFµ-328-BARE with a RFM69CW soldered onto it. Note that the RFµ-328 needs slight modifications. The Slice of Pi has a stackable header on it, so that I can attach the mini RTC module on top. Here’s a pic (it has a small RTC module stacked on top):

Apart from the headers that come with Slice of Pi, I added a LED and a resistor, and one 0.1uF cap from RFµ-328 reset pin to GPIO23 (on the underside of the PCB). So the functionality is (almost) exactly as the RFM12Pi (V2) module: it has an activity led on Arduino pin 9 and the reset line is wired to Pi’s GPIO23 (as opposed to GPIO4). To make avrdude work, one can follow the instructions from RFM12Pi, the only required change is to edit the autoreset script and change 4 to 23.

I plan on adding more things to the Slice of Pi (which would be next to impossible with RFM12Pi):

  • Add a 3.3V voltage regulator, so that I don’t run out of juice on the board (Pi’s 3V3 is limited to 50mA, which might not be enough if I wire more things there, or if I upgrade the radio to more powerful RFM69HCW).
  • Add a header for a wired Dallas DS18B20 temperature sensor.
  • Maybe add a header for nRF24L01+ radio (I have one sensor with that radio).

There was one hurdle to be scaled: RFµ-328 is wired differently than JeeNodes, so the “stock” jeelib won’t work without some modifications. This has been done for the RFM12B code by the people around OpenEnergyMonitor project and published on github as RFu-jeelib. So in the end I merged the new RF69 code into this project and modified the RF69 portions. The resulting code/library is here (use the rfu branch!). So my whole tiny “fleet” of RFµ-328’s with RFM69CW is happily running the ubiquitous RF12demo sketch.

(In the pic above: a Raspberry Pi + Slice of Pi + RFµ-328; a RFµ-328 on Ciseco’s “developer board”; finally a RFµ-328 on Sparkfun’s Xbee breakout to get from 2mm pins to the standard 2.54mm headers, connected to a Bus Pirate, used for power and serial monitoring.)

Update 2014-10-05:

I soldered a 3.3V voltage regulator to the Slice of Pi and cut the trace from Pi’s 3V3 pad, so that now all 3.3V powered devices on the Slice of Pi get the power from the regulator (so from Pi’s 5V supply), not from the Pi’s 3.3V supply. There are of course also two capacitors (10uF and 0.1uF) to stabilise the regulator’s output.

Update 2014-10-09

I thought I’d document some technical info here for reference. So, here it goes:

  • A link for RFµ-328 schematic - it’s for v1.2, but I think v1.3 is schematically identical, they just switched from 0604 SMT parts to 0402 - so the modifications for HopeRF’s radios get slightly more fiddly.

  • The differences of RFµ-328 wiring with the JeeNode:
    • SEL pin on RFM12B goes to PD4/Digital4 on the ATmega (to PB2/Digital10 on JeeNodes)
    • IRQ pin on RFM12B goes to PD3/Digital3/INT1 on the ATmega (to PD2/Digital2/INT0 on JeeNodes)
  • Additional wiring on the Slice of Pi:
    • Reset line, i.e. pin 5 on RFµ-328 (already has a pull-up to VCC on the RFµ board) is connected to GPIO23 via a 0.1µF capacitor. (This choice was somewhat random - I wanted something between the “upper part” of the connector (with I2C and serial) and the “lower part” (with SPI), so that I can possibly stack things on top over just I2C, or just SPI, and it won’t interfere with this pin.)
    • A LED from Digital9/RFµ pin 16 through a 460 Ohm resistor to ground.
    • I didn’t add any extra 0.1µF caps to for filtering, since the RFµ-328 has some already (one on the supply, one on AREF).