The electrical control unit is a wireless communication system that monitors the battery voltage and broadcasts other information. Please refer to the GitHub Repository "WoodlandHarvestControlSystem" for the code for all Arduinos. The over-the-air communication works on the LoRa system at 915 Mhz.
If you feel lost regarding working with any sensors or boards used in the system, check Useful Guides section at the bottom of this page.
Feel free to change the code on the Arduinos and platforms. Visitors and students can get editing access to the repository from Leon Santen or Odalys Benitez.
LoRaWAN network on the farm
LoRa WAN is the internet-based version of LoRa. While LoRa communication only works between generally two devices, LoRa WAN can communicate between hundreds of devices by the means of a gateway. LoRa WAN consists of end-nodes and at least one gateway. Communication between the gateway and the nodes is bidirectional and based on LoRa radio communication. Refer to the LoRa research section for more info on how LoRa works and useful tutorials. This section is for on-the-farm system-specific information.
On the Arduinos that are integrated into the system, we use the Dragino LoRa shield. In the image below, you can see how the pins on the Dragino LoRa shield are assigned. This is useful as not all pins on the shield are useable. This is especially important on Arduino Unos that don't have as many pins as the Arduino Megas.
The Dragino LoRa shield. Blue-boxed pins are not used by the shield and are free to be used.
Gateway
Our gateway is the LG01-N Single Channel Gateway.
Nodes
The following nodes are curently in use:
master-arduino
Purpose:
- Sense and broadcast battery voltage
Data transmission:
- float of battery voltage
client_arduino_responsive-light
_The glowing crystal indicates the batterie's charge status._
Purpose:
- Receive battery voltage and change colors to indicate battery status
Data transmission:
- NA
Repository Sections
master-arduino
The master Arduino, also called a server, measures the battery voltage with the Adafruit INA260 and broadcasts information wirelessly to the other Arduinos. The wireless system uses the LoRa protocol to communicate at 915 Mhz. For detailed information on what LoRa is and how it works, please refer to the LoRa research page. The diagram for states and communication codes is on Whimsical. The prior link redirects you to the diagram.
client_arduino_responsive-light
This unit receives the battery voltage from the master Arduino in the mudroom. Based on the voltage, the LED crystal shines in different colors.
- >= 27 V | Violet
- between 25 and 27 V | Green
- between 24.3 and 25 V | Orange
- < 24.3 V | Red
anemometer
We are using a Vortex wind sensor. One revolution per second equals 2.5 mph. Since our anemometer has a relay (a mechanical switch), it creates a switch bounce. Therefore, we need a debounce circuit.
A bug with the current code seems to be related to saving the dateTime string. The dateTime string is saved incorrectly when there should be a trailing 0 in front of the minute reading. I believe that the current code does not include an additional 0 to save minute readings below 10.
Opportunities to improve the system
- We are currently supplying power to the Arduinos via USB. If we use efficient Buck converters from the batteries to the Arduinos, we might save some electricity.
- install a gateway for a LoRa WAN network
Helpful tools and guides
Tools
The falstad online circuit simulator is great to quickly test a circuit, check its output voltage or behavior.
Guides and tips
Real Time Clock Setup for SD3231
Download DS3231 library on GitHub
Data logging on SD-card
this randomnerdtutorial.com leads you through SD-card usage with an arduino.
Wireless communication with NRF24L01
We have long-run antennas for wireless communication (NRF24L01 Tutorial).
You should solder a 10uf electrolytic capacitor between the power leads.
How to connect several SPI devices to Arduino.
Non-invasive AC Current Sensor ANSANE SCT-013-030
Outputs approximately 1 V for every 30 A.
LoRa Overview on Digikey
https://www.digikey.com/en/maker/blogs/introduction-to-lora-technology
Voltage measuring with voltage divider circuit
For precise voltage measurements, it is recommended to use (analogRead(pin) + 0.5) * 5.0 / 1024.0
1.