Setting up an RFM12 v2 on a Raspberry Pi

Hi,

I recently bought a RFM12 v2 receiver and connected it to my Raspberry Pi. I also have some transmitters but I can't make all of this work.

When I start my Raspberry Pi, the green LED on the RFM12 is on during a few seconds and then is off. I tried to use the RCSWITCH-PI library with the following code but I can't make it work:

int PIN = 11;
putenv("WIRINGPI_DEBUG=SomeValue");

if(wiringPiSetup() == -1)

       return 0;

mySwitch = RCSwitch();
mySwitch.enableReceive(PIN);

while(1) {

      if (mySwitch.available()) {

        int value = mySwitch.getReceivedValue();

        if (value == 0) {
          printf("Unknown encoding");
        } else {

          printf("Received %i\n", mySwitch.getReceivedValue() );
        }

        mySwitch.resetAvailable();

      }

 

Thanks,

Mickael

glyn.hudson's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

Hi Mickael,

See here for RFM12Pi documentation: http://openenergymonitor.org/emon/emonbase/raspberrypi

If you follow the links under the software section it will take you to http://emoncms.org/site/docs/raspberrypigateway. Here you will find setup instructions for setting up a raspberry pi using the RFM12pi to receive data from wireless nodes and post to an emoncms server using our ready to go SD card image. If your interested in how this image is build follow the 'build from scratch link' : http://emoncms.org/site/docs/raspberrypigatewaybuild

Best of luck

Miko95's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

Hi Glyn,

Thank you for your help.

Until now I thought that using the GPIOs allows using the RFM12Pi without any driver. Is there a PIN that is supposed to receive data from the RFM12Pi? If yes, why can't I simply use the rcswitch-pi library to get the received data?

I'm new to this domain and I'm trying to understand the global picture. I saw a lot of examples that show we can write or read a value to/from a PIN on the GPIO. I guess the RFM12Pi module receives the wireless signal, translates it to series of bits and writes this series of bits on a particular PIN of the GPIO. Am I wrong? Where can I find documentation about how the RFM12Pi works?

Thanks,

Mickael

Jérôme's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

The RFM2Pi communicates with the Pi through a serial port that uses a few pins in the GPIO block.

There's nothing complicated in the protocol but you don't have to reinvent the wheel: the dialog code already exists. If you want your own code, you should at least use a library that deals with serial port communication.

Miko95's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

Hi Jerome,

I followed the tutorial that explains how to disable login on serial port. (I've modified the /etc/inittab and /boot/cmdline.txt files as explained there and rebooted).

When I run the following command:

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

the minicom terminal opens but I can't see anything. I have multiple RF433 transmitter that should send signals using this frequency but I don't see anything in the minicom terminal.

Any idea?

Miko95's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

I would like to check that my transmitters are okay. Do you know if the green LED should be ON when a signal arrives to the RFM12?

EDIT: I'm able to communicate with the RFM12 using minicom. I receive the following help:

Available commands:
  123 x      - Toggle configuration change protection, 1=Unlocked
  <nn> i     - set node ID (standard node ids are 1..26)
  <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
  <nnn> g    - set network group (RFM12 only allows 212, 0 = any)
  <n> c      - set collect mode (advanced, normally 0)
  ...,<nn> a - send data packet to node <nn>, with ack
  ...,<nn> s - send data packet to node <nn>, no ack
  <n> l      - turn activity LED on DIG8 on or off
Current configuration:
65 i1 g212 @ 433 MHz  Lock: 1

Is the configuration okay?

Thanks

Miko95's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

Hi,

After a lot of research, maybe I found what the issue is. It seems that the transmitters I have (movement sensor, door opening sensor) use the ASK or more particularly OOK modulation. After looking at the specification of the RFM12B module, it seems it uses FSK modulation.

Can you confirm it's really an issue? If yes, is there a way to receive signals modulated with ASK/OOK using the RFM12Pi?

Thanks,

Mickael

Jérôme's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

The RFM2Pi board does not give you direct access to the radio module. It has a microcontroller that manages the communication protocol between the TX and the base.

https://github.com/mharizanov/RFM2Pi

Someone corrects me if I'm wrong, but I don't think you can plug any radio transmitter and see what comes in. I mean it might be not only the modulation but the whole communication protocol that differs.

Miko95's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

I intended to use the RFM12Pi to communicate with multiple sensors (including the emonTH). One of the sensor is a door opening sensor with a SC2262 chip (http://vrtp.ru/index.php?act=Attach&type=post&id=516717).

Is it expected to not be compatible? If yes, is there some sort of generic RF module that can receives from multiple types of components?

 

Jérôme's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

I would say no, but I may be totally mistaken. Your best shot here is Martin, who develops the RFM2Pi board.

Note that with the RFM2Pi v2, you can program the microcontroller from the Raspberry Pi, so you could modify the code on the board to adapt it to your different components.

In other words, your decoding work could take place in the micro that controls the RF chip and that micro is on the board. The RPi does not address the RF chip directly (for real-time reasons, I guess).

Robert Wall's picture

Re: Setting up an RFM12 v2 on a Raspberry Pi

Can I just add that attempting to use different modulation systems (AM, FM) and different protocols on the same channel is very unlikely to be either easy or successful. You will find it easier to use two receivers on different channels feeding data separately into your software. Whether the RPi can handle 2 receivers, I don't know.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.