POWAR by Pablo Zuloaga Betancourt is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.Its Open Source for personal experimentation or educational use, but for commercial purposes, it is registered as a utility model in Spain, and protected by European laws.THE IDEA:
POWAR, The Plant Observatory of Weather Adaptability for Resilience, comes from my Master in Design for Emergent Futures thesis, which focuses on how to make small-holder farmers more resilient to climate change with technology.
According to a study made by ETH Zurich (click to see the map), It is predicted that by 2050 London will have a climate similar to that of Barcelona at the moment, and Madrid to that of Marrakech, so I wondered, how could we grow our food today in the climate predicted for the future of a certain place to see how they will grow?
MAIN USE:
- Education: It can be used in education as a STEAM device, to teach kids of different ages about climate change, digital fabrication, electronics and coding, helping students to understand how climate change will affect the food security on our planet, more experientially. POWAR is part of a methodology I'm developing to teach Planet Centered innovation in K12 schools, which involves the use of different sensors to help students have a better understanding of the environment through electronic sensing. It is designed in low-cost materials so that it can be manufactured anywhere in the world where you can get a laser cutter, a 3D printer and some basic electronic components.
For educational use, the idea is that each school can buy a kit, which includes 1 POWAR BOX to be built, and 4 P-Bits, which are basically smaller device that runs on the same POWAR board, so that Kids can use them at home or school to sense their environment with different sensors.
That's what I liked most about the WIO, that it made me think that the same KIT I was creating with the POWAR board, could be easily done with the WIO TERMINAL:
- 1 POWAR BOX, controlled by a WIO, to grow plants under different future weathers, and compare their results with kids in other schools in the world growing different plants.
- 4 SenseCAP Kits for the Kids to experiment by themselves, understanding their environment through sensors, with some excersices to help their teachers in the learning process.
- Agriculture: POWAR's main intention is to empower smallholder farmers with relevant information and data on how climate change may affect what they grow today, to help them become more resilient to the future. The more people who use POWAR in different parts of the world, experimenting with different plants and climates, an open knowledge database could be created to feed an artificial intelligence model that makes predictions about the best way to grow them in different extreme weathers.
Climate change-related crises, such as floods or drought, affect the lives and livelihoods of millions of people, exacerbating poverty, hunger and social tensions. POWAR helps communities and governments understand these growing risks and take specific action to manage the impact of climate crises on food security.
- 2 - Zero Hunger.
- 4 - Quality Education.
- 10 - Reduced Inequalities.
- 11 - Sustainable Cities and Communities.
- 12 - Industry, Innovation and Infrastructure.
- 13 - Climate Action.
- 15 - Life on land.
POWAR already exist as a working prototype, with a TRL 4 (Technology Readiness Level), that has only been tested in a lab (my house). I built the previous version as my FabAcademy project with a tailor-made circuit board designed by me, which the Italian engineer Pietro Rusti helped me improve.
It worked using an ESP32 as the main processor, and mainstream sensors like the DHT22, a Capacitive Moisture sensor, a Water Tank level sensor, and an LDR sensor. And for the actuators, I use a Water Pump, Led Strip Growing Lights, a Halogen Lamp for heating and a ventilator for cooling (I also have a version with a Peltier cell, but I'm still experimenting with it).
Fab Academy Version Documentation
The main problem with the previous version was that it needed a CNC to be built, and electronics knowledge to build the circuits from the schematics. I also created a simpler, solderless, prototype that works with a breadboard and relay and MOSFET modules so that it requires less electronic knowledge to build it.
This version was used to give product design students a workshop in Portugal about coding and electronics for IoT, in which they learned by building it in groups, also including the codes for testing each sensor and actuator separately, and building the NodeRed interface (you can find it all in www.powarstem.com)
You can find more documentation, codes and design files of the POWAR previous versions in:
Here is a description of how POWAR works, showing the logic between the connections, the hardware and the process that make it able to simulate certain weathers.
Power Management:
All the POWAR sensors work with 3v3 / 5v DC, and most of the actuators work with 12v DC except the halogen lamp that I use for heating, which works with 110/220v AC. It is possible to use 5v actuators too but in my experience that reduces a lot the strength of the water pump, fans and Peltier cells (when used for cooling), and also, I already had the 12v components for the previous versions.
- The 110/220v AC go connected to the POWER SUPPLY and to the RELAY that controls the halogen lamp.
- The POWER SUPPLY turns the 110v/220vAC current into 12v DC that goes connected to a BUCK CONVERTER MODULE.
- The BUCK CONVERTER turns those 12v into 5v.
- The 12v goes connected to the RELAY MODULES that control the actuators and to a MOSFET MODULE that controls the strength of the growing lights.
- The 5v goes connected to a shield that gives power to the WIO TERMINAL, the SENSORS and the AI CAMERA.
Sensing / Actuating:
Inside the POWAR box, there are several sensors that measure characteristics of the environment and the plant, and send this information to the WIO TERMINAL through the shield, and the WIO TERMINAL sends them to a NODE RED server using MQTT protocol. The server is programmed to download weather information from an API, and turns on the actuators inside POWAR to try to simulate or equilibrate those weather characteristics. For the weather simulation, you just need the TEMPERATURE AND HUMIDITY sensor, the rest of them are used to gather additional research data.
Sensors:
- Groove SHT40 (temperature and humidity).
- Groove Soil Moisture Sensor.
- Groove VOC and eCO2 Sensor.
- WIO terminal Integrated LDR sensor.
Actuators:
- Irrigation: Water Pump
- Cooling: Fan / Peltier cell kit.
- Heating: Halogen lamp.
- Moisture: Piezoelectric Moisturizer.
AI Camera:
The AI CAMERA would give POWAR the possibility to take daily pictures of the crops and generate a database that could later be compared between boxes growing the same plant, under different weather conditions. In that way, if we start mixing the different weather characteristics, the database could feed an AI predictive model, with a better understanding also supported by additional information of sensors like CO2, pH and others.
Full Diagram:
In this diagram, you could visualize how the whole model works together. Most of these connections could be simplified by using SEEED STUDIO Groove Shield for Raspberry Pi, and also their Relays, but at the moment I made it, I didn't have them, and also would take too long to order them from China. But for sure that would have saved me a lot of work.
2 - Building the Box:This shield could be replaced by a SEEED STUDIO RASPBERRY PI GROOVE SHIELD, but I didn't have much time to finish it, but here are the schematics, and some images of my previous shields or boards I used for the project when it ran on ESP32.
For your codes, it's important to remember that the WIO TERMINAL pinouts go as follows:
Here you can find all the processes that you will need to follow, from Installing Arduino, the libraries, and how to test each code separately, before building the main code.
First of all, you will need to update the firmware in the WIO terminal, install Arduino IDE on your computer, and add the board and some basic libraries to your IDE so that it can connect to the WIO terminal and upload codes into it. You can read more about it in the WIO terminal starting guide.
Getting Started with WIO terminal.
- 1 - Download Arduino IDE and install it:
- 2 - Open Arduino and add the WIO TERMINAL BOARD LIBRARY:
File > Preferences, and copy the URL below to Additional Boards Manager URLs:
https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
- 3 - Download the SEEED SAMD Boards library:
Click on Tools > Board > Board Manager and Search Wio Terminal in the Boards Manager.
- 4 - Select your board and port
You'll need to select the entry in the Tools > Board menu that corresponds to your Arduino. Selecting the WIOTERMINAL.
Select the serial device of the Wio Terminal board from the Tools -> Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Wio Terminal board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.
- 5 - Test with Blink Code:
Upload blink code and the BLUE LED under the WIO should Blink.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
- 6 -Install additional libraries:
First, download the needed library as a zip Library (I added the link for each needed library under each code), open your Arduino IDE, and click on Sketch > Include Library > Add.ZIP Library. Choose the zip file you just downloaded,and if the library installs correct, you will see Library added to your libraries in the notice window. This means the library is installed successfully.
Here I'm explaining how each of the sensors I used work, including the separate codes before making them work together. I do this using the secondary (back) pins of the WIO TERMINAL, also to check that each one of them can work on a different GPIO PIN without conflicts. For this, I'm using a protoboard connected to a 40-pin GPIO EXTENSION BOARD for Raspberry Pi. I insist that this could have been easier and better with a GROOVE SHIELD FOR RASPBERRY PI.
NOTE:Check with a multimeter, because this kind of extension board might invert the pins.
This code will make the TFT monitor screen turn GREEN, and then print "POWAR". I add it to understand the Sequence of writing, so I can start visualizing the values on the screen instead of the serial print.
#include <LGFX_TFT_eSPI.hpp>
The TFT library stopped working, so I had to add a new one "Pradeep" suggested me on Discord.
#include <LGFX_TFT_eSPI.hpp>
//#include"TFT_eSPI.h"
TFT_eSPI tft;
void setup() {
tft.begin();
tft.setRotation(1);
tft.fillScreen(TFT_GREEN);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(4);
tft.drawString("POWAR",150,120);
}
void loop() {
}
- 6.2 - Grove Moisture Sensor:[Wiki] Grove - Moisture Sensor
This Moisture Sensor can be used for detecting the moisture of soil or judging if there is water around the sensor, letting the plant in your garden be able to reach out for human help when they are thirsty. This sensor is very easy to use, you can just simply insert it into the soil and read the data. With this sensor, you can make a small project that can let the plant send a message to you like " I am thirsty now, please feed me some water."
- A0
- GND
- VCC
I added a map function to the code so that it shows me the values on a percentage. To calibrate the value that determines the Highest value, which will represent the "100% value", I suggest putting the sensor legs inside a glass of water.
map(value, fromLow, fromHigh, toLow, toHigh)
int MoisturePin = A0;
int MoistureValue = 0;
int MoistureMap = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
MoistureValue = analogRead(MoisturePin);
MoistureMap = map(MoistureValue, 0, 500, 0, 100);
Serial.print("Moisture = " );
Serial.print(MoistureMap);
Serial.println("%");
delay(1000);
- 6.3 - Grove SHT40 Temperature and Humidity Sensor:[Wiki] Grove - Temperature & Humidity Sensor
This Grove SHT40 digital sensor is based on Sensirion's industry-proven humidity and temperature sensors. It can provide constant temperature and humidity accuracy over an extensive measurement range And with the grove platform, you are ready to plug and play the SHT4x sensor on any microcontroller (Arduino) or microprocessor (Raspberry Pi).
- GND
- VCC
- SDA
- SCL
LIBRARY NEEDED:(download and install as.ZIP)GitHub - Sensirion/arduino-i2c-sht4x: Arduino library for Sensirion SHT4x sensors
#include <Arduino.h>
#include <SensirionI2CSht4x.h>
#include <Wire.h>
SensirionI2CSht4x sht4x;
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(100);
}
Wire.begin();
uint16_t error;
char errorMessage[256];
sht4x.begin(Wire);
uint32_t serialNumber;
error = sht4x.serialNumber(serialNumber);
if (error) {
Serial.print("Error trying to execute serialNumber(): ");
errorToString(error, errorMessage, 256);
Serial.println(errorMessage);
} else {
Serial.print("Serial Number: ");
Serial.println(serialNumber);
}
}
void loop() {
uint16_t error;
char errorMessage[256];
delay(1000);
float temperature;
float humidity;
error = sht4x.measureHighPrecision(temperature, humidity);
if (error) {
Serial.print("Error trying to execute measureHighPrecision(): ");
errorToString(error, errorMessage, 256);
Serial.println(errorMessage);
} else {
Serial.print("Temperature:");
Serial.print(temperature);
Serial.print("\t");
Serial.print("Humidity:");
Serial.println(humidity);
}
}
- 6.3 - Grove 2 Channel Relay[Wiki] Grove - 2-Channel SPDT Relay
- GND
- D2 / D1
- D3 / D4
- VCC
USE: Control the Heating and Cooling actuators, and also the Water Pump and the Peltier Moisturizer.
I used a mainstream 2 Channel Relay Module because I don't have the SEEED STUDIO one at the moment, but it should work better with that. In my project, I use 4 relays, so maybe an even better option would be to use the SEEED STUDIO 4 Channel Relay module. All of them could also be integrated into the POWAR SHIELD.
The Grove - 2-Channel SPDT Relay has two single pole - double throw (SPDT) switches. It only requires low-voltage and low-current signals to control those switches. Specifically, you can use 5V DC to control max.250V AC or 110V DC. The best thing is that you can control the two channels separately. For instance, controlled by SIG1, you can connect the COM1 to NC1 or N01 as your wish. It is so convenient and reliable that it can be applied to massive products or projects which need to switch high voltage/high current devices.
#include <Arduino.h>
int PUMP = D2
int FAN = D3
void setup() {
pinMode(PUMP, OUTPUT);
pinMode(FAN, OUTPUT);
}
void loop() {
digitalWrite(PUMP, HIGH);
digitalWrite(FAN, LOW);
delay(2000);
digitalWrite(PUMP, LOW);
digitalWrite(FAN, HIGH);
delay(2000);
}
- 6.4 - Mosfet Module[Wiki] Grove-MOSFET
- D5
- VCC
- GND
USE: Control the LED STRIP Light's intensity, so they can simulate the intensity of the sun, according to the intensity of the sun in the selected location to be simulated.
I used a mainstream Mosfet Module because I didn't have SEEED STUDIO MOSFET MODULE, but another option would be to have the module integrated into the POWAR SHIELD by default.
Grove – MOSFET enables you to control higher voltage project, say 15V DC, with low voltage, say 5V, on microcontroller. MOSFET is also a kind of switch, but its switching frequency can reach up to 5MHz, much faster than normal mechanical relay. There are two screw terminals on the board. One for outer power source and the other for device you want to control. Grove – MOSFET will pass the power from one end to another when closed. But if outer power source is absent, your device can still draw power from microcontroller via the Grove interface.
int LED_LIGHT = D5;
int full_sun = 255;
int half_sun = 130;
int light_sun = 100;
int cloudy = 50;
int dark = 0;
void setup()
{
Serial.begin(38400);
pinMode(LED_LIGHT, OUTPUT);
Serial.println("Light Demo");
}
void loop()
{
analogWrite(LED_LIGHT, full_sun);
delay(2000);
analogWrite(LED_LIGHT, half_sun);
delay(2000);
analogWrite(LED_LIGHT, light_sun);
delay(2000);
analogWrite(LED_LIGHT, cloudy);
delay(2000);
analogWrite(LED_LIGHT, dark);
delay(2000);
}
7 - The Networking:Here is a fast explanation of how all in POWAR WORKS.
Node-RED is a flow-based development tool for visual programming developed originally by IBM for wiring together hardware devices, APIs and online services as part of the Internet of Things. Node-RED provides a web browser-based flow editor, which can be used to create JavaScript functions.WIKIPEDIA.Node-Red Helps you to interconnect through a web browser-based platform, a lot of different inputs and outputs that work as nodes, which you can program in different ways. This is a visualization of how I connected some nodes to create a visualization for my project. Dashboard tutorialMosquitto Pub-SUb Pub extra documentation
MQTT:MQTT is a protocol that sends messages to a broker, with different types of information, organized on different topics.It works basically like WhatsApp: You have different groups (TOPICS)To which you send different MESSAGESPeople (or devices) can SUBSCRIBE to a group to get the messages you PUBLISH.The topics can have many subtopics inside:POWAR / CITY / TEMPERATUREPOWAR / CITY / WINDPOWAR / CITY / SUNPOWAR / HOUSE / LIGHTPOWAR / HOUSE / TEMPERATUREPOWAR / LED
WEB SCRAPING:
This is a visualization of live sensing and web scrapping data from a weather API. The upper data is the real weather from Barcelona and Bogotá, gathered from the Open Weather Map. I learned how to do it following a tutorial.Open Weather Map APITutorial for the API + NodeREDIn the lower part, the sunlight measure is being sensed through an LDR, and the lower one is sensed or directly commanded to be like that.
I wasn't able to finish converting my whole project from ESP32 to the WIO terminal on time, causa had some troubles with the device and libraries in the end, which I wasn't able to debug during the weekend, but I discovered on the WIO a new world of possibilities for my project since it is pretty easy to remove, code and reload. Also to change in case it gets damaged, which was a problem I was having with the previous versions that ran on ESP32 attached to the board.
Also, I think the project could work way better using a mix of Azure and the Blynk APP. I discovered Azure also has Weather MAPS for Web scrapping the data I need for POWAR, but I needed extra credits, and again, time to learn how to do it. So I had to use the old Node-Red, which does not let me add different users for each device, without creating a new Node-Server for each. I know Blynk could give me this possibility, not sure yet if also Azure can do it.
Anyway, I'm pretty happy with the results I have at the moment, I learned and discovered a lot of new things in the process and I will keep on experimenting with them since this new version is the one I'm going to start using for my workshops in schools.
Here are some videos of the mounted POWAR box, controlled by the WIO terminal.
- Finish the Code integration with the WIO terminal.
- Test and understand the Azure networking platform, dashboards and
Comments