RFM12 Tutorial – Part2

Part 2 – RFM12 Hardware Interface

In this next part of the RFM12 tutorials I’ll be covering the hardware interface, signal descriptions and how you go about hooking it up to the MCU of your choice.


The RFM12 RF module comes in a couple of different packages, DIP and SMD, I’ll mainly be covering the DIP throughout these series, but will touch on the SMD where necessary. There is also a long range version of the RFM12B, this is the RFM12BP and has a reported range of 3000m. The RFM12BP only comes in an extended SMD package, but I won’t be covering it here in the tutorials, although all of the commands will be the same. The only difference is the RFM12BP has an on board power amp, which requires 12V to power the PA portion and has associated control pins for Tx/RX control.


The DIP package uses a 6×2 2mm pitch header to connect the various signals to the MCU, The size of this header is a bit of a problem if you want to do prototyping as it doesn’t breadboard well, initially I didn’t have any 2mmm pitch female headers so I hand soldered on individual wires to the back of each pin, not really good in the long run as the wires kept on breaking off, so I designed a breakout board to bring out all the signals onto a standard 100mil pitch, much easier to breadboard.


There are two version of the SMD module, and from what I can gather the only difference is the crystal, one is the standard HCU form factor, while the other is a ceramic oscillator.

Antenna: The only real difference when using the SMD over the DIP package is there is no on-board antenna connection, the antenna comes out via one of the pins, so you need to design in an antenna connection if using the SMD version.

ARSSI: The SMD package allows access to another useful signal that is not available to the DIP version, this is the ARSSI – Analogue Relative Signal Strength Indicator, which is basically the strength of the signal being received by the module, however it’s not bought out on any of the pins, beats me why? There a digital version of this signal accessible though the software interface, from what I can gather there is a difference from the Digital and Analogue versions of this signal. Anyway what it boils down to if you want to access this analogue signal then you have to manually solder on a wire to access this pad (shown as red circle).

UPDATE:  the onboard DRSSI is a single bit returned in the status word that indicates if the RSSI is above the set threshold.   The ARSSI hack mentioned gives an analogue value that is proportional to the RSSI signal received.

ARSSI Connection


The antenna mostly used will probably be a whip antenna, basically a piece of wire cut to the right length, I won’t be covering antenna theory here, as I don’t know it ;), but suffice to say the approx lengths involved are as follows (measured from factory supplied antennas):

433Mhz – 173mm

915Mhz – 87mm

UPDATED: 03/07/2009

These antenna lengths are calculated for the respective bands

433 1/4 wave = 164.7mm
433 1/2 wave = 329.4mm
433 full wave = 692.7mm

868 1/4 wave = 82.2mm
868 1/2 wave = 164.3mm
868 full wave = 345.5mm

915 1/4 wave = 77.9mm
915 1/2 wave = 155.9mm
915 full wave = 327.8mm

With these lengths I’ve had no problem reaching 30m+ indoors through a number of walls and 120m+ outside, I’ve not yet trie different types of antennas such as SMA connected rubber duck type but they should work as I’ve spoken to tech support at HopeRF and they tell me that the antenna circuit on both modules is balanced to 50 Ohm, this means that most SMA rubber duck antennas in the right frequency range will also work. Make sure that the antenna is matched to the frequency range required to get the best range, i.e. don’t use a wifi antenna for 2.4GHZ on a 433Mhz module, it may work for short distances, but definately won’t be optimal for long distances, also you may damage your RF module (unconfirmed it this is is the case as these are low power devices), but usually antennas need to be SWR matched to stop reflectance back into the transmitter circuit.

There is also some technical documents on Hopes website for PCB based antennas, but I’ve not used these at all so your milage may vary with them.

As mentioned earlier the SMD has no direct antenna connection so you need to design in a connection, either a solder pad on your board or an SMA connector.

The DIP package on the other hand allows you to solder in the antenna right onto the module, usually you will solder in the wire directly, however you need to make sure that you get the right pad, as there are two very small solder pads right next to each other, one is the antenna, one is ground, both are not marked in anyway as to to their function, and the documentation does not show which one is which. You need to solder in the piece of wire to the one not connected to ground, best to check with a multimeter or continuity tester first.

It looks as though you can also uses these two pads on the DIP module to connect an external SMA connector with a pigtail to the module as well (both ground and antenna).

PIN Connections

The pin connections for the module is described below, I have indicated whether the connection is required or is optional when making connections. The basic connections as described will allow data rates of up to approx 12000bps on an 8Mhz PIC using a bit-bashed SPI, polled approach when handling sending and receiving data, higher data rates will require hardware SPI, higher MCU speed and the use of interrupts, these will be discussed in a later tutorial.

UPDATE:  Please see this article for more detailed information regarding RFM12B bit rates and the different pin connections.

VDD (required) – The nominal working voltage is between 2.2v and 3.8v (NOT 5V), make sure that you have bypass filters in place on the supply rails.

nINT/VDI (optional) – This pin can be configured as either input or output, if configured as an input then it’s function is an active low interrupt request from the MCU, The MCU pulls this line low if it want to interrupt the RF module.
If configured as an output then its the VDI, Valid Data indicator, meaning valid data has been detected by the receiver and outputs a high. Factory Default is VDI

SDI (required) – SPI Data input, where the MCUs MOSI signal needs to be connected to.

SCK(required) – SPI clock input from MCU

nSEL (required) – Chip Select (active low). This signal must be pulled low before any signal is sent via SPI to the RF module,

SDO (required) – SPI Data out, where the MCU MISO signal needs to be connected to.

nIRQ (optional) – Interrupt Request output (active low), this is when the RF module wans to signal the MCU an event has occurred. This should be tied high with a pullup resistor.

FSK/DATA/nFFS (optional but requires 10K pullup when not used):
FSK – Transmit data input
DATA – Received Data output
nFFS – If pulled high then the FIFO is selected then data is transmited / received via the internal FIFO acessed via the SPI interface. If the FIFO is not being used then this is where the data is directly clocked into or out of the Tranceiver. Use this mode for high datarates.

DCLK/CFIL/FFIT (optional):
DCLK – is the data clock when no FIFO is used (used in conjunction with FSK/DATA/nFFS pin).
CFIL – is used to connect an external capacitor when using 256K datarates, this is for the analogue filter, normally the internal digital filter is used by default, only lower data rates are achieved with the digital filter.
FFIT – FIFO interrupt, interrupt signal is generated whenever the FIFO interrupt level is achieved (level is configured via SPI and is covered in the software interface tutorial), normally the interrupt level would be set to 8 if using the FIFO so that an interrupt is generated for every byte received. If using the FSK/DATA to clock in the data then the interrupt level should be set to 1, this way an interrupt is set for every bit sent/received.

CLK (optional) – Clock output, defaults to 1Mhz, but can be configured in increments up to 10Mhz, or switched off. This signal can be used to provide a clock signal to the MCU if it has no internal oscillator, i.e. cuts down on an additional crystal required for the MCU. This signal is also used in the calibration of the RF modules and will be explained later.

nRES (required) – this is reported in the Hope RF documentation as an output but is really an input (active low) and needs to be tied high at all times. If pulled low it will reset the module back to POR default (power on reset) settings.

GND (required) – Power Ground.

ANT (on SMD, required) – Where the antenna is connected.

Back – Part 1 | Next – Part 3a

Similar Posts:

Print Friendly, PDF & Email

Author: Stephen Eaton

Geek at heart. Loves to tinker and find out how things work, which inevitably leads to items in pieces and not working for much longer :)

129 thoughts on “RFM12 Tutorial – Part2”

  1. @realheaven

    The TX/RX switching won’t work, at start up I can switch to TX(no received data yet), it sends out the data, after I start to receive the RX mode won’t gather any data, and I can’t switch back to TX mode.

    See my previous posts, I even posted the mode select function.

  2. @ laci 106

    at first, if you want one node at TX mode then you should init it @ TX mode by writeCmd(0x8239). Next, if you want it at RX mode you should switch it to RX mode by writeCmd(0x8299).
    You can also test the TX RX mode with one simple test. For example, you have 2 node A & B.
    1. A (TX) —> B(RX)
    2. A(TX–>RX) & B(RX–>TX)
    3. B(TX)–>A(RX)

    A sends out a byte to B, A immediately switches to RX mode; if B (@ RX)receives a byte and check if it’s from A then B switches to TX mode and sends out a byte; @ A you can easily check the data from B by send it to PC using RS232.

    ps : you should test both two nodes that can transmit and receive data first to be sure that there’s no fault at any stage of the process.

    good luck!

    (feel free asking, rite!) 😉

  3. I will make a more thorough debug, maybe I made some stupid mistake somewhere… until then I remain skeptic 🙂 just won’t switch between tx/rx remains blocked somewhere 🙂

  4. Hello Stephen,
    Really thanks for these nice tutorials!!!
    i thought i gave up on that rfm12!!! i used the hm-tr from hope rf wich uses standrd rs232 protocol but they are very expensive !!! my question is if i want to use the hardware spi will the code be the same as the programming guide??

    Note: I am Using Mikroc And has an spi library (hardware)(Pic16f876a)

    Thanks Alot Stephen .

  5. @Nart_schinakow

    I would suggest you look at other examples of code other than the ones supplied from HopeRF. I had no end of problems with them. However in saying that I did have some problems getting the hardware SPI working with the PIC and the RFM12B, this was a couple of years ago though.

  6. Hi,
    I am trying to interface a at89c52(5V) with the RFM12B(~3.6V) module. Whether I need to take care about including any delimiting resistors or other kind of level shifters between the SPI bus pins.
    thanks in advance

    1. @geo

      The RFM12B has 5V tolerant I/O, however in saying that I wouldn’t leave it running at 5V for an application as it may shorten it’s life. When I first started development I didn’t use shifters etc and all ran ok.

  7. @ geo 116

    you may choose RFM12 instead of RFM12B because RFM12 can run well at 5V so there’s only one power supply for the two devices and to manipulate those RF is the same.

  8. Hi Stephen
    I have been researching and developting an application using the RFM12B.The data on this module is not good,
    What i have noticed is a Digital signal analyzer or scope is required becasue of the lacking data sheets as to correct program flow.
    What would be a good start is if an experience rfm developer(yourself) could provide timing diagrams showing the state of lines
    NSEL,SCK,SDI,SDO,nIRQ, and VDI in relationship to el,et,synthersizer/pa etc,etc when running a sample program.
    Now i am using a scope things are becoming much easier to grasp

  9. @chippchipp

    Yes I can certainly appreciate what rfm12 newbies go through. the biggest problems is what comes first the chicken or the egg, e.g. is the problem in the Tx, or is it in the Rx side of things.

    I certainly agree with you. I could not have got my original design working without an oscilloscope watching the CLK and the MOSI/MISO however this was a pain as I only have a two channel CRO, I’ve since treated myself to a logic analyser that can decode SPI and find this invaluable when I troubleshoot.

    When I get around to finishing off the tutorials I’ll look at putting some timing diagrams on.


  10. hi,
    The last time I contacted you was Dec 2010.
    Now have my project working fully and I think I understand about 55% of the workings of the RFM12b.
    The two modules communicate 100% no problems.
    One thing I have notice.
    I replaced my original Rfm 12b modules with two new rfm12b which I purchased in july 2011.
    After power up i found problems with the first second and maybe third communication data packet occurs now and then but after say the fourth data packet the two modules will communicate continuously, not missing any data thereafter until I power off and power up or I move one of the modules out and then back in range.
    I reverse fitted the new modules (swapped them round on my embedded application) and guess what.
    I modules communicated perfectly from power up??
    Have you seen this or have any ideas to what to change to debug or tune this out.
    The two modules are embedded on exactly the same pcbs..
    Just one module acts as the master and the other the slave.
    I have increased the preambles.No change
    Are there any parameters which you could point me to look at


  11. hello friends
    plz help me
    i worked on rfm12b for 1 month i have a problem that make me crazy
    when i turn it on everything is good and a read status with 4000 hex
    but when i initialize the module and switch to tx mode from ideal
    the status run to a100 hex
    i cannot solve the issue
    plz help me i beg u friends

  12. Hi, i’m a debutante in Arduino and RFM communications.

    I’m trying to develop a project in which a led turns on according to the distance that is between an transmitter and a reciever.
    I’ve followed all your connecting instructions, followed the “Simple RFM12B demos” and connected the “pin15” by welding the ARSSI.
    Now I recieve only “0” and there is no way to change it. I’ve change the jeelib as CapnBry from the jeelabs.net said in “Homemade BMP085 Node in a Garden Light” (http://forum.jeelabs.net/comment/6203.html) to amplify the reading of the signal but there’s no good result.

    Does someone has a simple “hello world” ARSSI demo or some further instructions to achieve the reception of different values acording to the distance?

    I hope someone can help me.
    Thank you,


Leave a Reply