---
# System prepended metadata

title: Untitled

---

### **POS – Plant Observation System**

Moritz Denke
ID: md222tz
I tried to create a system to give easy access to the temperature and humidity around a plant as well as the soil moisture.
It should take no longer than 30 minutes to put my project together, since I am using a breadboard. This project is intended for indoor use only, since it is not waterproof. 


### **Objective**
Since many people in appartements have limited gardening experience, causing their indoor plants to die quickly, I have decided to design something that gives gardeners a better understanding of the watering cycles of their plants, as well as the conditions (temperature and humidity) they are situated in. This should allow for a better understanding of the influence of said factors on the plant’s lifecycle. Often, the influence of air moisture and temperature on the need for watering is overlooked, especially in winter which can go along with very dry air. The dry air causes the soil moisture to evaporate quicker, which can make changes in the watering-schedule necessary. I hope that it will be possible to monitor these changes easily and conveniently, using my device.

### **Material**
The components necessary for the setup are a laptop, and a micro-usb cable.
List of material
| Material     | Link | Price | Specification |
|--------------|------|-------|---------------|
| LoPy4 with headers  | [link](https://www.sparkfun.com/products/14674) | $47.95 | Network development Board, runs micropython |
| Expansion board 3.0   | [link](https://www.sparkfun.com/products/14675) |  $21.95 | Used to provide GPIO, used to connect sensors and stuff |
| Antenna  | [link](https://www.sparkfun.com/products/14676) |  $11.95 | Used to extend signalrange |
| USB cable  | [link](https://www.electrokit.com/en/product/usb-kabel-a-hane-micro-b-hane-15cm/) |  16kr | Used to connect LoPy4 to computer |
| 3 * B10K Potentiometer   | [link](https://www.electrokit.com/en/product/pot-10kohm-lin-p160kn-b10k-mittlage/) |  19kr/st | Used as an adjustable resistor  |
| DHT11 moisture and temperature sensor  | [link](https://www.electrokit.com/en/product/temp-moist-sensor-dht11/)| 39kr | Measures temperature and air humidity |
| Breadboard | [link](https://www.electrokit.com/produkt/solderless-breadboard-840-tie-points-2/)| 69kr | Used to facilitate connections without soldering |
| 10 * Jumper wires M/M  | [link](https://www.electrokit.com/produkt/jumper-wires-1-pin-male-male-150mm-10-pack/)| 29kr | Used to connect components and as part of the moisture sensors |
| 10k Ohm Resistor | [link](https://www.electrokit.com/produkt/resistor-metal-film-0-125w-1-10kohm-10k/)| 2,40kr | Used to run the DHT11 sensor |

*I have used 3 B10K Potentiometers as resistors, since I had them at hand. You can also use a single resistor, as long as it is stronger than 30k Ohm.

### **Computer and device setup (Windows 10)**
You need to install three things, before you can start with the project.
1.	Node.js [link(https://nodejs.org/en/)]
2.	An IDE of choice, I am using Visual Studio Code [link](https://code.visualstudio.com/docs/setup/setup-overview)
3.	Pymakr plugin (used to communicate with the Pycom device) [link](https://docs.pycom.io/gettingstarted/software/vscode/)
To assure a successful start, it is recommended to flash the firmware on the expansion board, to get the latest firmware. Instructions can be found here: [link](https://docs.pycom.io/updatefirmware/expansionboard/) Next I recommend to follow pycoms tutorial to make sure that your LoPy4 is up to date [Pycoms tutorial](https://docs.pycom.io/updatefirmware/device/). After that you can develop your code in Visual Studio and upload it to the LoPy4, using the upload button received through the plugin. 

Discussion:
Originally, I wanted to use capacitive soil moisture sensors instead of making my own sensor, to avoid the problem with corrosion. The problem is that the sensors that I bought don’t support the use of Micropython, therefore I had to change my plan after I spent a lot of time on research. If I would do this project again, I would try to use another device than the LoPy4, probably an Arduino. I mitigated the corrosion-problem by using cheap, long cables that I will have to cut shorter and strip again, when the measurements accuracy is starting to drop too much.

### **Putting everything together**

**Circuit diagram**
![](https://i.imgur.com/OjCCXwb.png)

In my diagram I have replaced the three potentiometers with a fitting resistor, since that was my initial plan. This setup is ok for in-home use since it is not waterproof. I also want to test it over the winter, to see if I have to change things to improve the functionality and then I will think about making a more permanent installation. 

### **Platform**
I chose Pybytes to present my data, thanks to its simplicity. Pybytes is a cloud based platform free of charge, made for Pycom devices. It offers options for simple visualization, however scaling my idea up or individualizing it may be difficult on this platform.

### **The code**
I have kept the code simple, since I want to improve it after a long-term test. I have also experimented with using the LED as a signal light for the status of the soil, but I was not pleased with the result. I am importing ADC, PIN and DHT. These give me access to the pins and to the DHT sensor. I also import time and pycom. I have set up my lopy4 to register my phones hotspot as a wigi and to log into it, following this tutorial: [link(https://hackmd.io/@lnu-iot/r1bGPUOhu)]. It is configured to send the current values (humidity, soilmoisture and temperature) all 10 minutes, using this code:
![](https://i.imgur.com/eHg41Lv.png)

As you can see, the code also checks if the results are resonable. If they should reach a point that is not seen as valid (0 degrees and 0 air moisture), it will wait and re-check the values to assure that only valid values are uploaded. 


### **Transmitting the data / connectivity**
I have chosen to transmit my data using Wifi, since my project is intended for indoor use only. Wifi tends to be more power-hungry than other options like LoRa, but since the device will be plugged in a wall plug, it is not depending on low power consumption. I am using the mqtt protocol, provided by pycom, to send data all 10 minutes, to allow for a continuous picture and understanding of the moisture development, while still protecting the sensor from corrosion due to constant checking. 

### **Presenting the data**
I am presenting the data in three widgets, one for Soilmoisture, one for Humidity and one for Temperature. Pybytes saves the data for one month, which is enough for my usecase. 
![](https://i.imgur.com/G07lXjl.png)


### **Finalizing the design**
![](https://i.imgur.com/h0sIJbN.jpg)

Here you can see my final project. I am pleased with the outcome, since it does what I intended for it to do, but I would have been happy if I would have had some other LEDs or something similar to use. I also think that it was not ideal that I had to use the three potentiometers as a replacement for the resistor, but it worked. I think that LEDs, used in a street-light style would have been a nice indication for the user, or a little screen that could have shown the values in real time. But since the course was more about sending values to the cloud, which has worked really well, using Pybytes, I am happy with the result. 

![](https://i.imgur.com/JvyaUOl.jpg)
