RFM69RADIO
A Node module for sending and receiving through RFM69 radios on the Raspberry Pi.
Ported from etrombly's python version of the LowPowerLab code.
Hardware
This version tested on a pair of Adafruit RFM69HCW Radios with this NodeJS code running on a Raspberry Pi 3 Model B.
The default wiring is:
RFM pin | Pi pin |
---|---|
3v3 | 17 |
DIO0 | 18 (GPIO24) |
MOSI | 19 (GPIO10) |
MISO | 21 (GPIO09) |
CLK | 23 (GPIO11) |
CS (NSS) | 24 (GPIO08 CS0) |
Ground | 25 |
RESET | 29 (GPIO05) |
See here for the Raspberry Pi 3 GPIO pins.
The second radio is connected to an Arduino UNO running the code in frm69_test.ino and connected according to the instrucitons from Adafruit.
Install
npm install rfm69radio
Usage
Create the module.
const RFM69 = ;const rfm69 = ;
Initialize the radio. Provide an address for the node and optionally a 16 char encryption key. Then, register callback to handle recevied packets. Then, read the temperature of the radio ic. Then, calibrate the radio. Then, send some packets.
rfm69 ; { console;} { console;}
The initialize parameters and their defaults are:
freqBand = 'RF69_915MHZ' // 'RF69_315MHZ' or 'RF69_433MHZ' or 'RF69_868MHZ' or 'RF69_915MHZ' depending on radio hardware address = 1 // Address for this node networkID = 100 isRFM69HW = true // Is High Power radio? Must be true for RF69HCW, RF69HW powerLevelPercent = 70 // Transmit power between 0 and 100 interruptPin = 24 // Pin number of interrupt pin. This is a GPIO number (GPIO24 = pin 18). resetPin = 5 // Pin number of reset pin. This is a GPIO number (GPIO5 = pin 29). spiBus = 0 // SPI bus number. spiDevice = 0 // SPI device number. promiscuousMode = false // Accept all packets encryptionKey = 0 // Key for AES encryption. Must be 16 chars long or no encryption set autoAcknowledge = true // Automatically reply with Ack verbose = false // Verbose logging to console
Dependencies
- GPIO access and interrupt detection: onoff
- SPI Interface: spi-device