LowPowerLab Forum

Hardware support => Moteino => Topic started by: cubes on August 17, 2014, 12:08:30 PM

Title: RFM12B as transmitter with Arduino (328p)
Post by: cubes on August 17, 2014, 12:08:30 PM
Hello Team,

I use the library https://github.com/LowPowerLab/RFM12B with my 328p and have a question.

My problem is related to transmitter only.
I use the two AA batteries(3V) and Atmega328 with Arduino.

When turn on the transmitter (I use the SEND example) nothing is going on.
When I unplug the IRQ wire comes from uC(PIN D2) from the RFM12B and plug it again into the test PCB, the frame will be send.
And loop: When I plug it back and put it in again, the frame will be send.
When the wire is put in permamently, nothing will be sent.

I also noted that during the pause (wire putted in), the uC seems to work constantly, becouse when I plug the wire in, there will come not the 'next' frame to the receiver(every next payload comes as extended with one char more) but
the frame which is currently processed by uC.

What is more -> when I connect whole test PCB to arduino uno pcb(without uC of course) and launch the 'monitor' it starts to send frames fine.
Now I disconnect all wires except the DC and the frames are still being sent.

I'm going to use 3xAAA (3,6V), but I'm afraid of situation, when the DC drop down to less than 3,3v.

I'll be appraciate for any hints.

Regards,
Jakub
Title: Re: RFM12B as transmitter with Arduino (328p)
Post by: Felix on August 18, 2014, 08:34:55 AM
Hmm.. did you try jeelib for instance? Does that work?
I think the issue might be with your wiring.
Title: Re: RFM12B as transmitter with Arduino (328p)
Post by: cubes on August 19, 2014, 02:27:17 PM
Hello Felix,
thanks for response.

Problem is solved. It was due to low voltage. I used the 3,3V and it works(this is 16MHz circuit).

BTW: I analyzed your(and also jeellib) library, and I can't find the method(or file), which is responsability for particular bits, which are being sent by RF12.
I would like to send some additional synchronization bits before and after the whole packet.
With AVR I use simple:

RF12Send(0xaa);
RF12Send(0xaa);
RF12Send(0xaa);
RF12Send(0x2D);
RF12Send(0xD4);
RF12Send(..messagebyte..);

I'm doing this to extend the range.

Could you please give me some hint where to put it or how to modify correct method to achive this?

Regards,
Jakub
Title: Re: RFM12B as transmitter with Arduino (328p)
Post by: Felix on August 19, 2014, 05:41:20 PM
It's in the void RFM12B::InterruptHandler()
It's a state machine which goes through several states. In this case it only uses 2 SYN bytes, the second one being the network ID. You could inject another but you will need to change a few places in the library for that.
Title: Re: RFM12B as transmitter with Arduino (328p)
Post by: cubes on August 20, 2014, 05:27:33 AM
Thanks.

As I know based on: http://jeelabs.org/2011/12/11/inside-the-rf12-driver-part-2/

in the original jeelib there are three preambles before the two SYN packets. I hope it's the same in your lib.
If yes, the beginning will be fine for me.

I will need to add the three preamble bytes (0xaa) also in the end of packet (after the last CRC byte).
I'll try it on my own.

Title: Re: RFM12B as transmitter with Arduino (328p)
Post by: Felix on August 20, 2014, 08:13:24 AM
My header is a bit different than that in the jeelib. I needed to be able to tell the source AND the destination ID, not just one of them. See changes here: http://lowpowerlab.com/blog/2012/12/28/rfm12b-arduino-library/