Statistics
| Revision:

root / RF12 / examples / RF12demo / README

History | View | Annotate | Download (4 KB)

1 4727 jcw
RF12DEMO
2 4727 jcw
========
3 4727 jcw
4 4727 jcw
The RF12demo sketch can be useful to test proper operation of RFM12(B) modules.
5 4727 jcw
It lets you set up two nodes and send test packets between them via commands
6 4727 jcw
entered on the serial USB connection. The basic settings are stored in EEPROM
7 4727 jcw
so that you can configure a board and then use it at the remote end without
8 4727 jcw
connecting it to a second computer.
9 4727 jcw
10 4727 jcw
11 4727 jcw
HOW TO SET UP A SMALL WIRELESS TEST
12 4727 jcw
===================================
13 4727 jcw
14 4727 jcw
1.  First of all, get two units hooked up as described here:
15 4727 jcw
        http://news.jeelabs.org/2009/02/10/rfm12b-library-for-arduino/
16 4727 jcw
    I use "JeeNodes" for this, but that's just me:
17 4727 jcw
        http://news.jeelabs.org/2009/03/05/jeenode-v2-pcb/
18 4727 jcw
19 4727 jcw
2.  Compile and upload this RF12demo sketch to both boards. The serial baud
20 4727 jcw
    rate is set at 57600, you can change it in the source code if needed.
21 4727 jcw
    You will need to install the "RF12" Arduino library module - eg. on Mac OS X
22 4727 jcw
    I copied the "RF12/" directory to /Applications/arduino/hardware/libraries/.
23 4727 jcw
24 4727 jcw
3.  When run, the demo gets config settings from EEPROM to set up the RFM12(B).
25 4727 jcw
    If this is the first time, it'll probably report "A i1 g212 @ 433 MHz".
26 4727 jcw
27 4727 jcw
4.  Change the node ID as follows: enter "<N>i" with <N> a number from 1 to 26.
28 4727 jcw
    For a first test, you could just pick node ID's 1 and 2 for the two units.
29 4727 jcw
30 4727 jcw
5.  Change the frequency band as follows: enter "<N>b" with <N> one of: 4, 8, 9.
31 4727 jcw
    These are the 433 MHz, 868 MHz, and 915 MHz frequency bands, respectively.
32 4727 jcw
    You should pick the same band as your RFM12B modules, preferably.
33 4727 jcw
34 4727 jcw
6.  Set the network group (aka "house code") with the command "212g". Groups
35 4727 jcw
    1..250 are available for the RFM12B, the RFM12 module *only* works with 212.
36 4727 jcw
    Make sure you set all units to the same group or they won't see each other.
37 4727 jcw
38 4727 jcw
7.  You're all set for the first unit, disconnect and repeat for the other one.
39 4727 jcw
40 4727 jcw
8.  Ok, time to try sending a packet. First make sure both units are powered up.
41 4727 jcw
    It helps to have both units connected to the same machine so you can set up
42 4727 jcw
    terminal windows for both of them, but if you only have one unit connected
43 4727 jcw
    to the terminal window and the other just powered up that's ok too.
44 4727 jcw
45 4732 jcw
9.  Enter "0s" on one unit. The other unit should report "OK" plus a number.
46 4732 jcw
    If you can't see the output of the other unit, use "a" instead of "s". This
47 4732 jcw
    will send a packet and also request and acknowledgement. If all is well
48 4732 jcw
    you'll see a short "OK" response on the same unit as where you typed "a".
49 4727 jcw
50 4727 jcw
10. In the above test, you're sending packets with no actual data other than
51 4727 jcw
    what the protocol itself requires to function properly. To include some test
52 4732 jcw
    data use "1,2,3,0s" or "1,2,3,0a" with "1,2,3" being the actual data. This
53 4732 jcw
    sends a test packet with 3 data bytes (you can send up to 66 data bytes).
54 4732 jcw
    The "t" commands is available as shorthand for "0,1,2,...,63,64,65,0a".
55 4727 jcw
56 4727 jcw
11. To do some range tests, carry the second unit to a remote location and use
57 4732 jcw
    "0a" or "t" to try and send some data across and get an acknowledgement.
58 4727 jcw
    At some point you'll see packets drop out (which could either be the data
59 4727 jcw
    or the ack return). Longer packets tend to drop out more quickly, because
60 4727 jcw
    there is a larger chance of them getting disturbed by noise along the way.
61 4727 jcw
62 4727 jcw
12. You may see "?" replies instead of "OK". These are packets with an invalid
63 4727 jcw
    checksum. These are either random noise or incorrectly received packets.
64 4727 jcw
    If you leave the demo running long enough, you'll probably also get such "?"
65 4727 jcw
    messages occasionally when the radio picks up some random noise.
66 4727 jcw
67 4727 jcw
13. Note that you *can* configure an RFM12(B) module to send/receive on another
68 4727 jcw
    frequency band than the one it was designed for. You'll just get a lower
69 4727 jcw
    range because the RF components will not be optimally tuned for these cases.
70 4727 jcw
71 4727 jcw
14. The code is fully open source - feel free to browse and make changes as you
72 4727 jcw
    see fit. The latest version of this software is always available here:
73 4732 jcw
        http://jeelabs.org/view/libraries/RF12/
74 4727 jcw
75 4727 jcw
That's it - have fun!