__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.[[File:LoRaWANSystemDiagram.JPG|500px]]Network
On the Arduinos that are integrated into the system, we use the [Dragino LoRa shield](https://wiki.dragino.com/index.php?title=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.</br>
[[File:Lora board.JPG|500px]]</br>_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](https://www.seeedstudio.com/LG01-N-Single-Channel-LoRa-IoT-Gateway-p-2935.html).
## Nodes
### master-arduino
The master Arduino measures the battery voltage with the [Adafruit INA260](https://www.adafruit.com/product/4226?gclid=Cj0KCQiA4feBBhC9ARIsABp_nbUfI0ajLIOyZSA2bku_JZfo73gYy_W1wFGoZthBykCbWl1sPe3xmiYaAnboEALw_wcB) and broadcasts information wirelessly to the other Arduinos. The wireless system uses the [[LoRa research|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](https://whimsical.com/rf-states-and-communication-codes-TEZgio2TPLtG5tm47541Hq). The prior link redirects you to the diagram.
Purpose:</br>
- Sense and broadcast battery voltage
### client_arduino_responsive-light
[[File:GlowingBucket.jpeg|250px]]</br>
_The glowing crystal indicates the batterie's charge status._
</br>
Purpose:</br>
- Receive battery voltage and change colors to indicate battery status
Data transmission:</br>
- NA
#### Color legend
- >= 27 V | Violet
- between 25 and 27 V | __Green__
- between 24.3 and 25 V | __Orange__
- < 24.3 V | __Red__
# Repository Sectionssections - coding comments _In this section, code-specific comments and tips can be written down for future collaboration if comments in the code don't feel appropriate._
## master-arduino
The master Arduino, also called a server, measures the battery voltage with the [Adafruit INA260](https://www.adafruit.com/product/4226?gclid=Cj0KCQiA4feBBhC9ARIsABp_nbUfI0ajLIOyZSA2bku_JZfo73gYy_W1wFGoZthBykCbWl1sPe3xmiYaAnboEALw_wcB) and broadcasts information wirelessly to the other Arduinos. The wireless system uses the [[LoRa research|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](https://whimsical.com/rf-states-and-communication-codes-TEZgio2TPLtG5tm47541Hq). 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
The [falstad online circuit simulator](https://www.falstad.com/circuit/circuitjs.html) is great to quickly test a circuit, check its output voltage or behavior.
## Guides and tips
__Real Time Clock Setup for SD3231__