SapFlow Probe
A low-cost HRM probe for measuring a tree's water consumption
|
Macros | |
#define | CLIENT_ADDRESS 1 |
Our LoRa address. | |
#define | SERVER_ADDRESS 2 |
The LoRa address of the base station. | |
#define | RF95_FREQ 915.0 |
Radio frequency (in MHz). More... | |
Functions | |
void | lora_init (void) |
Initialize the LoRa radio. More... | |
void | build_msg (float flow, float temp, float maxtemp, int treeID=0) |
Builds a JSON string to send over LoRa. More... | |
void | send_msg (void) |
Sends a LoRa packet to the base station. More... | |
#define RF95_FREQ 915.0 |
Radio frequency (in MHz).
Make sure this matches the radio you're communicating with. Also, be careful to stay in the ISM band so you aren't transmitting on a restricted channel without a license.
void build_msg | ( | float | flow, |
float | temp, | ||
float | maxtemp, | ||
int | treeID = 0 |
||
) |
Builds a JSON string to send over LoRa.
Builds a JSON string containing sapflow, weight, temperature, time, and tree ID. The string is stored in a global variable to be read by send_msg()
flow | The calculated sapflow |
temp | The baseline temperature of the tree |
time | The date and time from the Real-Time Clock |
treeID | the tree identification number |
References rtc_ds.
void lora_init | ( | void | ) |
Initialize the LoRa radio.
This function turns on the radio, sets the frequency, and prepares it for use. It does not take any parameters.
Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
The default transmitter power is 13dBm, using PA_BOOST. If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then you can set transmitter powers from 5 to 23 dBm:
void send_msg | ( | void | ) |
Sends a LoRa packet to the base station.
Sends the string made by build_json() to the base station over LoRa. Calling this function without first calling build_msg() produces undefined behavior.
References RFM95_CS.