Receiving OOK/ASK with a modified RFM12B.¶
by JGJ Veken
The RFM12 is a transceiver module designed only for FSK transmission,here
is a solution to receive OOK/ASK with a modified RFM12B module.
2. How to initialize the RFM12 as an OOK receiver.¶
Control commands (8027 - c040) to initialize the RFM12 registers Receiver.
(0x8027); // 868 Mhz;disable tx register; disable RX fifo buffer; xtal cap 12pf (0x82c0); // enable receiver ; enable basebandblock = 430.2400 - 439.7575 (0xa68a); // 868.2500 MHz exact frequency a060 - af3f = 860.4800 - 879.5150 (0xc691); // datarate 2395 kbps 0xc647 = 4.8kbps (0x9489); // VDI; FAST;200khz;GAIN -6db ;DRSSI 97dbm (0xC220); // datafiltercommand ; ** not documented command ** (0xCA00); // FiFo and resetmode command ; FIFO fill disabeld (0xC473); // AFC run only once ; enable AFC ;enable frequency offset register ; +3 -4 (0xCC67); // pll settings command (0xB800); // TX register write command NOT USED (0xC800); // low dutycycle disabeld (0xC040); // 1.66MHz,2.2V NOT USED see 82c0
- use the same crystal load capacitance 12pf if another jeenode is used as transmitter.
- if a 433Mhz RFM12B module is used , you can use value 0x8017 for the 433 MHz band.
- if another jeenode is used as transmitter use the same frequency
- if a remote OOK-transmitter is used do as follows. <pre>. try to find the frequency of the OOK-transmitter with a radio-scanner(AM modulation). keep the distance between OOK-transmitter and radio-scanner as far as possible. . adjust the frequency of the RFM12B to this frequency. . adjust again the frequency of the RFM12B on receiving OOK commands as far as possible. . frequenties on user manuals from wireless controls are usually not precise or may even be wrong. </pre>
- This control command is a not-documented command ,it is not in the datasheets from Silicon Labs or Hope RF. More info see this link http://www.mikrocontroller.net/topic/161885 Autor : Holger Sch. Output/Input FSK/DATA/nFSS is now the output for an OOK pulstrain.
3. Modification of the RF12B module.¶
fig 2. nearby receiver bad . medium distance ok.
The initialization of the RF12B with these values has some disadvantages , signals cannot be
received from nearby or from far away.When a nearby OOK pulstrain is transmitted for instance
bit 0 = 400 uS high and 400uS low , what will be received is 460uS high and 340uS low.(see fig 2).
The RF12B is also not sensitive enough for far signals transmitted far away this results in
random bits or no signal at all.
The replacement of the C_arssi capacitor with a value 150 pf will further improve sensitivity on short and long distances. What the concequences are for the FSK mode? I’m not sure ,this will be tested by Jee Labs. (location see fig 3).
fig 3. location C_arssi 4.7 nF
4. Input Output¶
- The output FSK/DATA/nFSS signal is connected by a resistor 100 ohm with analog input AI0 PC0 Port1 jeenode connector ATMEGA 328 = pin 23. see fig 4.
fig 4. pinning RFM12
5. Receiving software (Jee Labs)¶
Receive / decode FS20, (K)S300, and EM10* signals using a modified RFM12B as an 868 MHz OOK receiver.
Output sketch tested with Arduino 0017
Serial port is ready spi_init rf12_init_OOK_mode [recv868ook] RFM12B_receiving_OOK868 5 81 99 0 20 206 - handsender FS20 command RFM12B_receiving_OOK868 5 81 99 0 19 205 - handsender FS20 command RFM12B_receiving_OOK868 6 178 188 0 58 79 253 - pir transmitter Pira FS20 extended command RFM12B_receiving_OOK868 6 178 188 0 58 79 253 - pir transmitter Pira FS20 extended command RFM12B_receiving_OOK868 5 27 27 3 18 81 - jeenode used as transmitter RFM12B_receiving_OOK868 5 27 27 3 18 81 - jeenode used as transmitter
6. Transmitting software if a jeenode is the transmitter. (Jee Labs)¶
A jeenode is used as a transmitter ,which transmits the following FS20 commands in a loop.
fs20cmd(0x1b1b,0x03,0x12) // decimal = 27 27 3 18
Output from the receiver will be.
RFM12B_receiving_OOK868 5 27 27 3 18 81 // 4=S300 5=FS20 6=FS20 Ext 7=KS300 9=EM10 RFM12B_receiving_OOK868 5 27 27 3 18 81 // 81 = (27+27+3+18+6) 6=FS20 magic number
Control commands (8027 - c040) to initialize the RFM12 registers Transmitter .
rf12_xfer(0x80C7 | (band << 4)); // EL,EF,12.0pF rf12_xfer(0x8209); // enable xtal, disable clk pin rf12_xfer(0xA68a); //(0xa68a FS20 868.250) 90khz ) rf12_xfer(0xC606); // c606 57.6Kbps (38.4: 8, 19.2: 11, 9.6: 23, 4.8: 47) rf12_xfer(0x94A0); // VDI,FAST,134kHz,0dBm,-103dBm rf12_xfer(0xC2AC); // data filter rf12_xfer(0xCA83); // FIFO8,SYNC,!ff,DR rf12_xfer(0xCE00 | group); // sync byte rf12_xfer(0xC483); // @PWR,NO RSTRIC,!st,!fi,OE,EN rf12_xfer(0x9850); // !mp,90kHz Devation rf12_xfer(0xCC77); // pll settings rf12_xfer(0xE000); // NOT USE rf12_xfer(0xC800); // NOT USE rf12_xfer(0xC040); // 1.66MHz,2.2V
7. Distance free air..¶
Antenna’s different lengths
868 1/4 wave = 82.2mm sensitivity ok 0.7 - 70 meter 868 1/2 wave = 164.3mm sensitivity ok 0.7 - 100 meter 868 full wave = 345.5mm sensitivity ok 0.7 - 120 meter