Vinduino
The great Reiner van der Lee created the Vinduino project out of necessity to manage the irrigation on his small Southern California vineyard, by monitoring soil moisture at different depths and at several vineyard locations: "Soil moisture monitoring systems have been around for decades, but they cost hundreds to thousands of dollars and -because these systems are proprietary- there will be ongoing cost to customize and maintain these systems. As a small vineyard owner, I needed something low cost and flexible. The open source Arduino platform, together with low cost gypsum soil moisture and salinity sensors, provides all that. While I first envisioned the Vinduino project (Vineyard + Arduino) for my personal interest and needs, but now the scope has broadened to providing easy to use, open source, low cost solutions for agricultural irrigation management."
To date, the Vinduino project has provided the following results, published on the Vinduino blog, Hackaday, and Github:
DIY calibrated gypsum soil moisture sensors (Watermark SS200 is also supported)
Hand held sensor reader (soil moisture, soil/water salinity, water pressure)
Solar powered remote sensor platform (Vinduino R3), available on Tindie.com Options include: 4 electrically separated inputs for soil moisture sensors Wifi (ESP8266) or Globalsat LM-210 LoRa module for long range (6 miles) Irrigation valve control, optional pressure sensor for valve operation feedback several options for temperature/humidity sensors Built in solar battery charger Built in real time clock for precise irrigation timing
Gateway to connect multiple LoRa end nodes to the Internet via Wifi (Vinduino Gateway)
All publicly released programming and documentation is available for free under the GNU General Public License 3.0.
Web site:ย www.vanderleevineyard.com
Materials for four Vinduino stations
3m PVC x 4
2m PVC x 4
1.5m PVC x 4
1.0m PVC x 4
so...3m x 10
6 x 4 clear plastic platesย
27 x 6mm bolts, screws, and washers
27 MTB corks, tu use as separators
Silver, Purple, Orange, White, and black spray paint
16 PVC caps
4 x enclosure (Lalo's birdhouse)
4 x vinduino boards
16 x watermark sensors
4 x solar panel
4 x battery
4x GlobalSat LM-210 LoRa module and antennaeย
Updated budget for sensors and actuators
Vinduino
PRODUCT | QTY | RATE | AMOUNT |
---|---|---|---|
VIN-PCB | 6 | 38.75 | 232.50 |
Other | 6 | 35 | 210 |
VIN-BATT | 6 | 10 | 60 |
Other | 6 | 15 | 90 |
Other | 6 | 10 | 60 |
GATEWAY BRW | 4 | 225 | 900 |
Shipping & Handling | - | 0 | 0 |
ย | ย | TOTAL | $1552.50 |
Amazon and others sites in US
PRODUCT | QTY | RATE | AMOUNT |
---|---|---|---|
ย | ย | ย | ย |
ย | ย | ย | ย |
Building the soil moisture probe mounts
Cut the PVC pipes into the appropriate lengths.
Cut the plate plastic into the appropriate lengths.
Drill holes into the plates and corks.
Paint the exposed portions of the PVC pipes, according to length.
Paint the PVC caps.
Drill the drainage holes in the PVC tubes.
Drill the cable holes in the top of the PVC tubes.
Install each tube and sensor.ย
soak the sensor for 30 minutes in the morning
allow to dry during the day
soak overnight
Test the sensor readings dry, vs. wet.
Route the sensor cable through the pipes.
Attach the sensor to the end of a PVC pipe with glue
Installing the humidity sensors.
Dig the pit 2m deep.
Collect soil samples from 30cm, 60cm, 90cm, and 180cm deep from each pit.
Perform chemical and fertility analysis on each sample.
Photograph and video test pits
Wash away dirt from the root structure in the PV and MB2 (Vinduino 1 and 4) test pits.
Dig a groove into the side of each pit for four PVC tubes for the four sensors.
Fill up the test pits (except for the big rocks, which should be taken to the center of the vineyard.
Fill up around the tubes with slush and mud to make sure there are no channels for the water to pass.
Vinduino R3 hardware connections.
This is the Vinduino R3 board:
It is based on the Arduino Pro Mini, with the ATMega328, 3.3V 8Hz processor.
The Vinduino software can be found here:
https://github.com/ReiniervdL/Vinduino
Connect the LoRa radio and antennae.
The telemetry radio unit used in the Vinduino project follows the recent LoRa standard, which allows long range wireless networking. The unit is FCC approved in the USA for license-free use in the 915 MHz band.
Range is dependent on the conditions. With the supplied antennas typically 1-3 miles is possible. With line-of-sight and external antennas, considerable longer distances are possible.
The unit can be re-programmed for different output power levels and frequency. The default settings are 915 MHz and 100mW power. Frequency change is only needed in vase of strong local interference from other users of the frequency or in case of installation in Europe where 868MHz is used for LoRa.
The LM-210 module works on 3.3V and the Vinduino board is designed for that. Before programming the Arduino microcontroller board with a USB adapter cable, the LM-210 module should be removed to avoid USB level voltages (5V) reaching the module.ย
Working with the Globalsat modules is straightforward, data in = data out. The interface bitrate comes as default 9600 bps. The RF signal rate can be programmed between 0.81 and 18.23 Kbps. RF output power is 20 dBm (100mW), and can be reduced in 7 steps of 2 dB.ย The LM-210 connects with a 7-pin header.ย
The module has two mode selection pins, that are pretty interesting to play with.
Mode 1, P1=0 and P2=0: the channel is opened and the module is active. This is also the mode with highest power consumption: 13 mA typical for receive and 120 mA for transmit.
Mode 2, P1=0 and P2=1: difference with mode 1 is that every transmission now starts with a preamble needed to wake up a receiver in wake-up mode (see mode 3), and RSSI data is added.
Mode 3, P1=1 and P2=0: Power saving mode. The receiver is in sleep mode and wakes up at a set interval. If a transmission preamble is detected, receiving starts until the transmission is ended.
Mode 4, P1=1 and P2=1: Setup mode. Changing frequency, output power etc is done by sending hexadecimal string in this mode. This is also the setting that takes the least power (2.2uA) as RF and UART as closed.
ย
Notes:
For Vinduino, the Arduino board in the remote stations toggle between Mode 4 (sleeping mode) and Mode 1 (transmission).
Theย Rasberry PI Vinduino gateway is always on, actively receiving, and remains in Mode 1.
Connect the four watermark sensors.
The Vinduino R3 has inputs for 4 soil sensors. The soil sensor wires connect to the wire connection block. Sensor 1 wires are connected on the right side. The type of wiring is not critical for the accuracy or performance of the soil moisture measurement, however we connected the ridged wire (white stripe) to the ground on the vinduino.
Connect the battery and solar panel
Connect the solar panel
Test the solar panel polarity.
Test the battery pack polarity.
Remove the solar panel alligator clips
Connect the solar panelย
ย
The vinduino station is designed for continuous unattended operation. It is powered by a small solar panel, and the battery charger keeps the battery fully charged to keep the system working during the night and during periods with dense cloud cover. A green LED on the electronics board indicates that the charger is operational.
The battery voltage is measured and sent together with the sensor data. A healthy battery should provide a voltage between 4.2V and 3.6V. Below 3.6V, the battery is close to empty.
The battery connector is also used to switch the system on or off. Disconnect the solar panel before disconnecting the battery to avoid the system continuing on solar power.
Important: the solar panel is connected to the wire terminal block. The red wire connects to the โ+โ, and the black wire connects to the โ-โ. Connecting the solar panel with the wires with reversed polarity will damage the battery charging chip.ย
Connect temperature sensors (optional)
The Vinduino printed circuit board is designed to support a DHT11 or DHT22 sensor (temperature and relative humidity). These sensors are not waterproof and can only be used for measuring inside the enclosure. These were not configured for OpenVino.
For temperature measurement outside the enclosure, soil or air temperature, a waterproof temperature sensor like the DS18b20 can be used.ย
Other sensors can be attached using the โAccessoriesโ connector on the electronics board. This connector gives access to 2 digital pins, an analog input, and a switched 3.3V power supply pin that can be used for sensors that require electric power. Future use of the accessories connector is to control an irrigation valve and water pressure sensor.
Testing the Vinduino board
First connect to the Vinduino board using a USB-FTDI cable.
The color code is as follows: BLACK = GND, BROWN = CTS, RED = VCC, ORANGE = TXD, YELLOW = RXD, GREEN = RTSย
Using the Arduino serial monitor (9600) you should see this:
The values returned from Vinduino are:ย
Start of packet $
API key
sensor 1
sensor 2
sensor 3
sensor 4
battery voltage
temperature
rel humidity
End of packetย !
In this instance, the temperature and relative humidity values are not returned because of the lack of these sensors.
Test the watermark sensors
Start the Arduino IDE and set it to:
And run the program :ย ย https://github.com/ReiniervdL/Vinduino/blob/master/Vinduino-R3/Vinduino-R3__Test/Vinduino-R3__Test.ino ย
Submerge sensor 1 in a wineglass full of water. The values should now reflect a number reaching closer to zero in the sensor 1 field, something like this:
ย
For each watermark sensor, test as follows:
soak the sensor for 30 minutes in the morning
test the sensor reading from vinduino
allow to sensor to dry during the day
test the sensor reading
soak overnight
Test the sensor reading again
record the values in the following table
Sensor | 30 minute test | 12h drying test | Overnight soak |
---|---|---|---|
1.1 | 309 | ย | ย |
1.2 | 255 | ย | ย |
1.3 | 260 | ย | ย |
1.4 | -- | ย | ย |
2.1 | 274 | ย | ย |
2.2 | 356 | ย | ย |
2.3 | 274 | ย | ย |
2.4 | -- | ย | ย |
3.1 | 282 | ย | ย |
3.2 | 293 | ย | ย |
3.3 | 345 | ย | ย |
3.4 | -- | ย | ย |
4.1 | 404 | ย | ย |
4.2 | 280 | ย | ย |
4.3 | 293 | ย | ย |
4.4 | 300 | ย | ย |
Prepare to flash each Vinduino board
Create a separate vinduino.ino file for each vinduino board (Here a sample:ย https://github.com/ReiniervdL/Vinduino/blob/master/Vinduino-R3/Vinduino-R3__DS18B20/Vinduino-R3__DS18B20.ino ย )
Edit each file, modifying the file name and substituting the "your ThinkSpeak API here" with the Write API Key
Install the following library files in Arduino IDE: DallasTemperature, OneWire, LowPower,ย
Disconnect the LoRa module from the Vinduino board. (If you don't do this, the upload will fail)
Connect the vinduino board using the USB-FTDI cable
Verify the compilation
Upload the appropriate vinduino.ino file
NOTE:
If you are having difficulty uploading, make certain that you have the FTDI driver loaded.ย
If you want to get the temperature in degrees Cยบ, please update the following code lines:
ย
Setting up theย Raspberry Pi LoRaLAN gateway for Vinduino
The Vinduino gateway receives LoRaLAN sensor data from the Vinduino sensor stations and forwards to a ThingSpeak account. Theย gateway uses a LD20-H USB LoRa dongle from Globalsat. This dongle is basically a USB version of the Globalsat LM-210 LoRa module used in the Vinduino sensor station, and, alike the module, works as a wireless UART. Combined with a serial terminal program, this makes a great debug tool to check out the LoRa network and sensor stations.
The Vinduino LoRa gateway can handle up to 300 sensor stations within a range of 5 miles. The software is based on the operating agnostic Python-3 programming language,and can function as a gateway on Raspberry Pi. For increased traffic handling, more USB dongles can be added, working on different frequencies.
Theย Python-3 gateway script, although tested to be working reliable for its basic gateway function, can be customized/improved as needed. For locations where access to Internet is not reliable, or intermittent, we added a SQLite database to store all sensor data locally.ย
The Globalsat LD20-H is available onย Tindie
ย
LD-20H features
Ultra-high sensitive receiving ability by LoRa spread spectrum modulation technology
Long-distance transmission (1KM to 10KM)
Easy to use and easy to configure
Multiple dongles for multi-channel gateway
Programmable parameters:
Frequency: 862-1020 MHz
RF data rate: 0.81K, 1.46K, 2.6K, 4.56K, 9.11K, 18.23K bps
Max TX power: 5-20 dBm (100mW max)
UART baud rate: 1200-57600 bps, parity non, odd, even
ย
LED Definition
Color | Definition | Description |
---|---|---|
Orange | Rx | On: Receiving data. |
Green | Tx | On: Transmitting data. |
Red | P1 | On: Power-saving mode It would be Off in normal mode and wakeup mode. |
Blue | BZ | On: Idle state It would be Off while transmitting/receiving data. |
ย
Gateway Installation
ย
The Raspberry Pi assumes that the LD-20H connected to the USB serial port is an AT-command modem. A solution for this is to bypass the ModemManager:ย
sudo systemctl mask ModemManager.service
Check to see if the Raspberry Pi recognizes the LD-20H USB connection:
ย
pi@openvinopi:~ $ lsusb
Bus 001 Device 004: ID 04b4:0003 Cypress Semiconductor Corp.ย
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.ย
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
ย
Test the connection to the LD-20H.
A great way to test out the serial port is to use the minicom program:
sudo apt-get install minicom
Now run up minicom on the Raspberry Pi using
minicom -b 9600 -o -D /dev/ttyAMA0ย
ย
CypressDriverInstaller_0.exeย LoraConfig_1509181.exe
Example: A LD-20 programmed to work on an allowed frequency in the 868MHz European Lora band.
ย
Thingspeak-SQLite.py
SQLite-Vinduino3.py
vinduino.db
ย
Make sure we have the correct version of python
edit the SQLite-Vinuino3.py and Thingspeak-SQLite.py files to begin with:
Also, the following Python modules are needed for the Vinduino gateway script:
serialย
time
thingspeakย
sqlite3
ย
Edit the Thingspeak-SQLite.py file to reference the proper serial port.
ย
9.Test the gateway script
ย
Assuming the gateway script works properly, you should see data published into your Thingspeak URL's.
ย
10. Create the startup script for the LoRa gateway
ย
ย
11. Register the service
12. Create a Vinduino user
13. Move the vinduino.db to the new user home
14. Edit the gateway file to point to the new directory for the database:
15. Start the gateway
16. Check to see if the gateway is running:
ย
ย