Rezodo: Educational goals
Le "100e Singe" is a Third Place, in vicinity of Toulouse, half-farm half-office, combined with an agricultural incubator that welcomes and experiments with new forms of work: cooperatives, collaborative, with meaning and impact on major societal issues.
They welcomed Natacha a young trainee from Toulouse ENSAT Engineering Faculty of Life Sciences. She had a thesis topic to define « methodologies » to help local farmers to better understand how to manage water resources in a context of climate change. This involves, for example, a better understanding of the irrigation system, but also of the soils and their capacity to retain water and the water needs of each crop.
I am acting at 100singes on a volunteer basis in my spare time. I simply make the bridge between users/students/farmers and technical solutions to cover their needs.
Summarizing EnergyPedia we can read : While 2 litres of water are often sufficient for daily drinking, it takes about 3,000 litres to produce the daily food needs of one person.[1] Around 70 percent of freshwater withdrawals go into agriculture.
Appropriate water resource management strategies allow for the conservation of water and energy while increasing production. These include for example irrigation scheduling or crop specific irrigation management.
The wise use and conservation of irrigation water is essential, as it is not only a limited and energy consuming resource, but also competes with surrounding ecosystem water requirements.
2021 study explains that, in France, only 50% of farmers are concerned by local weather monitoring
- rainfall measurement is the most important parameter to monitor
- then comes local temperature
- less important are humidity, wind direction and strenght, pressure
After several workshops held with Natacha and 100singes' farmers Romain and Sarah, the concept of Rezodo was born.
- a distributed irrigation system
- a complementary weather Station
- a fully working modular home automation system
In a few sentences
- Rezodo will be as cheap as possible to offer open source tools to farmers to "educate" them to monitor their cultures.
- Rezodo will help to make them aware of the environmental challenges of water management at a local scale.
- Rezodo will also be a tool for students like Natacha to "see" sensors, to calibrate them and to play with IoT solutions applied in real world conditions.
- Rezodo is the fundation of a fully modular wireless and long range home automation system
Rezodo: functional description
Rezodo is not an intellectual concept, it is a working project that can be reused and built by any hacker interested in :
- home automation
- low power devices
- long distance networking
- gardening
- weather monitoring
Rezodo will be a set of devices connected into a tree network. Each device (pink circle) will be able to speak to the others and to control automations (green circles) and/or monitor sensors (green circles).
In the first prototype of Rezodo
- controls will be irrigations valves (but could be anything else)
- sensors will monitor: soil moisture, temperature, pressure, humidity, wind direction and strength as well as rain fall,
- number of devices should be unlimited and they will be interconnected with Timm Bogner's excellent FDRS (Farm Data Relay System) - with slight modifications-.
- distance between devices could be in the range
- 100m - 200m using ESPnow Long Range wifi
- 200m - 5000m using lora network.
- network of devices will be time synchronized
- devices will be solar powered
- a "master device" will interface with home automation system
- interface will use MQTT protocol for command/control
- interface could be done with ThingSpeak platform
- interface may be upgraded to any other IoT platform if needed (code is open and free)
- Home Automation will be supported by home Assistant platform (free and open source)
Don't be afraid by this list of features, at the end of this project you will have learnt a lot and you will own a fully open system that you will be able to tune for your own needs!
Stay tuned !
My advice, not to be lost into the various pages and logs, would be to read the whole description (this long page!) and then jump into the logs.
Alternatively here is a Table of Content that you can follow to directly access specific topic into logs.
Table of Content
building a Rezodo device
setting up a simple Rezodo network (3 devices)
Adding sensor monitoring to the network
Adding a Home Automation platform
- installing home assistant
- adding a MQTT broker
- adding switches to control the irrigation system
- adding a calendar to home Assistant
- Automate your irrigation system with "calendar triggers"
Adding a weather Station (there is now a devoted project)
Here starts the real technical description of the project
Building a Rezodo device
The Rezodo device has on a single board the following capabilities:
- solar panel
- solar charger for single cell Li-ion battery
- ESP32 MCU
- real time clock
- stepUp boost DC/DC converter
- motor drivers to pilot the irrigation valves
- Lora module
Schematics
more details will be given into the Rezodo device schematics log.
Price for this board shoud be less than 45€ (GTW1 Lora 4 valves)
pcb
At the very end of febuary, PCBWay proposed to sponsor this project. I did place the order and received the parcel less than one week later.
Rezodo PCB is also published on PCBWay shared projects pages. If you want to have them produce the PCB simply go to this page : Rezodo device board at PCBway
When soldered the board is very compact with "shields" on both faces of the board.
You should visit the PCB assembly log to get more information on this board.
setting up a simple Rezodo network (3 devices)
As an example we will try to build our first irrigation system including three devices (also named "gateway"):
- a device "zero" (GTW0) connected to internet with also lora communication,
- a device"one" (GTW1) connected to GTW0 via lora and having also ESPNow connection
- a device "two" (GTW2) connected to GTW1 via ESPNow
GTW1 and GTW2 will have each 4 irrigation valves and one soil moisture sensor
GTW0 is only there to manage the network and interface with IoT internet platforms
This configuration, although simple, is already representative of a real world situation in 100singes where the first gardens connected to the GTW0 with 4 irrigation valves are quite far from the farm (GTW0) and need a lora network to be reached. Then, as the distances are smaller, ESPnow network can be used to interconnect the second garden (GTW2) to the first one.
All these gardens being into the fields where no electricity comes, we really need low power solar systems to handle this situation. Irrigation pipes have been deployed into these gardens and are ready to be used.
We now need a software solution to manage the internet/lora/ESPnow network. And here comes the magic of FDRS!
FDRS
Timm Bogner is a farmer and wrote the excellent FDRS library for ESP32 MCU. Farm Data Relay System is an easy way to communicate with remote IoT devices without relying on WiFi or LoRaWAN infrastructure. It establishes a series of inexpensive, low-power access points and repeaters to provide ESP-NOW and LoRa coverage for remote devices.
I started to use FDRS with the help of Timm, but I soon realized that, due to my Rezodo board design, FDRS "philosophy" wouldn't totally fullfill my needs. So I decided to "slightly fork" FRDS library. This is explained into this log that I highly recommend to read before going further: The FDRS Library and my modifications.
You know now how FDRS is working to exchange "messages" between gateways and you know as well how to generate/intercept these messages on the devices to send controls or get back sensors values.
But we still need to learn how to configure the network to describe its topology. All this will be explained into the "Configuring the FDRS network" log.
source code of this project
The source code of this project is available on my Github page
Adding sensor monitoring to Rezodo network
As an example we will add a simple moisture sensor to each gateway.
An ultra cheap capacitive soil moisture probe
As you can see this probe is only a piece of pcb with two wires. You have four of them on the rezodo PCB!
It's a capacitive probe without any component! You can see into this log how it works : Soil Moisture probe
Interface with ThingSpeak platform
To collect the results I did use ThingSpeak platform
Results are pretty good, Values are ranging arounf 150 for wet soil to 350 for dry one:
Here is a display with values averaged twice per day (every 12h), while raw values are captured every 10 minutes!
We can very clearly see when watering was done. It takes 3,5 days for my plant to dry!
Although we "see" that they work, next steps regarging these probes will be to calibrate them. Natacha will help to do this. A calibrated soil moisture psensor is a must for farmers.
I found a paper on how to calibrate these sensors. Read it, it's very informative. This paper can be derived to help calibrating our soil moisture sensor. This is still to be done!
Adding a home automation platform to our project
Our Rezodo project is almost finalized from an hardware point of view, but we still need an effricient way to control it from our home (or farm!)
We will add an home assistant to this system to open Rezodo to the next level of automation.
Installing home assistant
Home Assistant is a powerful open source home automation system.
It is perfect for automation tasks :
"Once you have integrated all your devices at home, you can unleash Home Assistant’s advanced automation engine to make your home work for you.
- Turn on the light when the sun sets or when coming home
- Alert you when you leave your garage door open"
So it should work for Rezodo automation!
Installation of Home Assistant is possible on many devices from RaspberryPi to old laptops. As I had my PC running on windows seven 32 bits I thought it was impossible to run HA on it... But I was wrong.
Follow this log to see how to install home assistant on a PC.
You know now how to launch the virtualBox virtual machine of Home Assistant.
We will now add important components to HA.
The first one will be an MQTT broker
Adding an MQTT broker to home assistant
MQTT stands for "Message Queuing for Telemetry Tranfert" it was invented in teh 1990s and is now widely adopted for IoT projects.
"MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT). It is designed as an extremely lightweight publish/subscribe messaging transport that is ideal for connecting remote devices with a small code footprint and minimal network bandwidth. "
This publish/subscribe protocol is ideal for sensors to send their values to the broker and for a back end system to control devices depending on these sensors values.
So we need now to install a MQTT broker into our home assistant virtual machine!
Adding switches to Rezodo project in home assistant
This being done we need to add switches to home assistant to control manually the Rezodo network.
It should be something like this
We will have 8 switches that we can commute either one by one or all at once via the big top slider.
Adding these switches is not very complex and is explained into this detailled log.
It is important that you read this log if you want to learn how to configure the Rezodo. But you can skip it if you only want to use it...
And now the fun part : automate your Rezodo with calendar events
automate your Rezodo with calendar events
We first have to integrate a new component into Home Assistant : a LocalCalendar which is a brand new addon introduced end of 2022. It has all features expected from modern Calendars + automation ones!
LocalCalendar integration is explained into this log.
Now that we have a Calendar for Rezodo, we will use it to automate watering.
Take your time read and read again this log to see how to create automation using the Rezodo Calendar.
When done, you will be able to add this kind of event into your calendar.
Which means that the calendar will open the valve (coil) number 3 into the garden 1 today between 7 pm and 7:10 pm and of course close it the rest of the day.
You will be able to add other events during the day, Program repeating events and much more!
But does it really work ?
The answer is YES video to come soon !
But beforre the video, here is are two screenshots of my PC showing the status of Rezodo when the end of the calendar event occured. (left side = Home assistant log, right side are two Serial logs of GTW1 (top right) and GTW2 (bottom right)
Switch "serre1coil3" is indeed at off and the relevant action has been sent to the Rezodo GTW1 which has switched off the coil3 !
The calendar has finished to trigger the watering event at 7:10 pm. (note that Rezodo boards work internally with UTC instead of Paris local time... 2 hours delay but exactly the same time !). Rezodo is indeed time synchronized.
Use your MQTT broker to keep track of weather station sensors into HASS
This wil lbe explained into this log
And as an example here is the result when susbscribing to temperature and humidity sensors
Licenses
Unless otherwise stated, all works presented here that are not based on software/code are subject to the Creative Common Attribution license .
The complete legal text can be found here
Unless otherwise stated, all software/code-based works presented here are subject to the GNU General Public License v3.0
The complete legal text can be found here