Computing stuff tied to the physical world

Adding an RFM69 radio

With so many additional I/O pins on the LPC812, it’s easy to dedicate a few to a wireless radio module, such as the RFM69. We’ll use the following mapping, just 4 pins for now:

  • NSS = chip select (active low) = PIO0_8 = pin 11
  • SCLK = master SPI bus clock = PIO0_6 = pin 15
  • MISO = master in / slave out = PIO0_11 = pin 7
  • MOSI = master out / slave in = PIO0_9 = pin 10

No need to play trick with diodes or re-use pins, as we had to do with the 8-pin LPC810.

These radio modules are nice, but unfortunately they use a 2.0 mm pin distance, not the usual 0.1″ (2.54 mm) of breadboards. So again, let’s create a little adapter, on both sides:

DSC 5000

Now we can implement this circuit (adding a 10 µF electrolytic capacitor across the power supply to handle better any power consumption spikes from the radio):

DSC 5001

(note: that orange 0.1″ cap should really be placed next to the LPC812 chip to be useful)

As firmware, we’ll use a little RF69 “ping” test application and upload it:

$ make
uploader -s /dev/tty.usbserial-AH01A0EG build/firmware.bin #build/firmware.bin
found: 8120 - LPC812: 16 KB flash, 4 KB RAM, TSSOP16
hwuid: 3C200411C9981AAEF39EDF51031900F5
flash: 0940 done, 2364 bytes
entering terminal mode, press <ESC> to quit:

[rf_ping] dev 8120 node 12
OK 800d4f0102030405060708090a0b0c0d0e (139-56:3)
 > #46, 46b
OK 800d500102030405060708090a0b0c0d0e0f (139-56:3)
 > #47, 47b
OK 800d510102030405060708090a0b0c0d0e0f10 (140-38:3)
 > #48, 48b

The code sends a message about once a second, and reports all properly received packets.

Evidently, you will need to run this on at least two different setups, to be able to test proper transmission and reception. The “OK” lines are the incoming messages, the “>” lines are about messages being sent out. The payload length is increased each time until the limit is reached, then it restarts with a 0-length payload.

That’s it, we now have a brand new network (of 2 nodes), sending packets to each other!

[Back to article index]