Categories
Connected Farm

MySensors.org LoRa IOT for Farming, Part 2 Stemedu LoRa Sensor Nodes

For the Sensor nodes I’m using the Stemedu LoRa Radio Node V1.0, these are based on the Arduino Pro mini and have an RFM95 LoRa radio on board, they also have a 14500 battery holder making them almost ready to go nodes. The Radio is connected to the board following the same wiring convention as MySensors.org use but one link requires manual connection, these are marked D5 and DI01 on the back of the board.

Unfortunately the link requiring connection dose not have a pin header so some soldering is required.

I opted for soldering on pin headers which can be linked using jumpers or dupont cables. This offers grater flexibility for future use and also access to some extra digital pins. Alternatively a more permanent soldered link could be used.

#define MY_RADIO_RFM95

#define MY_RFM95_FREQUENCY (RFM95_868MHZ)
#define MY_TRANSPORT_STATE_TIMEOUT_MS  (3*1000ul)
#define RFM95_RETRY_TIMEOUT_MS  (3000ul) 
#define MY_RFM95_MAX_POWER_LEVEL_DBM (1) //1mW = 0dBm 10mW = 10dBm 25mW = 14dBm 100mW = 20dBm
#define MY_RFM95_MODEM_CONFIGRUATION  RFM95_BW125CR48SF4096
#define MY_NODE_ID 40Code language: PHP (php)

The radio config is simpler than the Heltec ESP32 board that I used for the gateway device as there is no need to re-define the radio pins from default settings.

Changing MY_RFM95_MODEM_CONFIGRUATION and MY_RFM95_MAX_POWER_LEVEL_DBM will effect range and battery life. (Note: the incorrect spelling of configuration is necessary as that is how it is spelled in the MySensors library) https://www.mysensors.org/apidocs/group__RFM95SettingGrpPub.html

BW = Bandwidth in kHz CR = Error correction code SF = Spreading factor

CONFIGBWCRSFComment
RFM95_BW125CR45SF1281254/5128Default, medium range
RFM95_BW500CR45SF1285004/5128Fast, short range
RFM95_BW31_25CR48SF51231.254/8512Slow, long range
RFM95_BW125CR48SF40961254/84096Slow, long range
RFM95 modem configuration.

The longer spreading factor greatly increases range but this is at a cost to power consumption due to longer air time, it takes a full 3 seconds to broadcast one packet using RFM95_BW125CR48SF4096, this is also the reason for the long timeouts in the config, these can be reduced with lower SF. Long range sensors can save power by long sleep times, it may not be necessary to have regular updates from all sensors, for example I’ve set some sensors to only wake and report data 3 or 4 times a day. It is necessary that nodes and gateways use the same SF.

#define MY_NODE_ID 40Code language: CSS (css)

Each sensor node requires a unique ID, multiple sensors can be attached to a single node and will be assigned a child ID for example 40_0, 40_1.

It is also possible to increase range using repeater nodes but these will require a better power source as they will be unable to sleep when inactive. This Link, https://www.mysensors.org/about/network contains info about repeater nodes, you can ignore 20 to 60 meter range as it refers to NRF24L01 radios which have considerably lower range than the RFM95 radios which can operate up to about 2KM. To make any node a repeater simply add

#define MY_REPEATER_FEATURECode language: CSS (css)

and remove any sleep statements and add a more substantial power supply such as a mains USB phone charger or solar power.

Facebook Comments