Sensors Box for Greenhouse

by BorisV2 in Circuits > Sensors

716 Views, 1 Favorites, 0 Comments

Sensors Box for Greenhouse

cover.jpg
wemosd1pro.jpg
dht22.jpg
ds18b20.jpg
psu.jpg
soil.jpg
tripplebase.jpg

Hey. I want to present one more project of mine to the wide society.

The project aims to automate the greenhouse I have built in my backyard. This is the first step- creation of a complex of sensors for the greenhouse. Later in the future, based on data from sensors, I plan to automate irrigation and ventilation. The device is based on Wemos D1 mini Pro. Software for this project is written in MicroPython. Data from sensors flows to Domoticz server running on Raspberry Pi Zero.

Now let‘s go deeper into details.

Supplies

For this project you need:

1. Wemos D1 mini Pro

2. Wemos trippler base

3. Power supply shield (Optional, you can power D1 via USB).

4. OLED display

5. DHT22 sensor

6. SOIL sensor

7. 18b20 temperature sensor

8. Housing

9. Dupont cables

10. Running Domoticz server ( I am using Raspberry Pi Zero)

11. Pyhon files. All files you will need are here.

Firmware and Micropython Drivers

I will not delve into how firmware is installed on the device. The procedure is described in details in one of my previous posts here.

Although there is one thing you have to know about installing firmware on WemosD1 mini Pro. Normally when I am installing firmware I use the following command:

python esptool.exe --port COM5 --baud 460800 write_flash --flash_size=detect 0 C:\path_to_firmware\

But it doesn't work with D1 mini Pro version. It works with D1 mini, but not with Pro. After installing firmware in this way, D1 goes into infinite loop – it reboots constantly. Somewhere on the internet I found that it is necessary to describe flash memory size it will use. You have to use command below:

python esptool.exe -p COM8 write_flash -fs 4MB 0 C:\path_to_firmware\

So after you have installed firmware, upload files mentioned above in 11.) except main.py, by using ampy for instance. You will need to edit main.py later, so do not upload it now :).

Connections

inside1.jpg
inside2.jpg
inside3.jpg

Connect all hardware.

1. Soil sensor:

Red wire ======> +3.3V

Black ======> GND

Yellow (data) ===> A0

2. OLED display:

GND ======> GND

VCC ======> +5V

SCL ======> D1

SDA ======> D2

3. ds18x20:

Red ======> +3.3V

Black ======> GND

White (data) ==> D6, also via pull up 4.7kOhm resistor connect to +3.3V

4. DHT22:

GND ======> GND

VCC ======> +3.3V

OUT ======> D3

Add Sensors to Domoticz

setuphardware.jpg
hardware.png
devices.jpg

Add sensors to your Domoticz server.

1. Select SETUP/HARDWARE to add hardware.

2. Add "Dummy" from drop-down menu.
When hardware is added, the overview of all defined hardware will be shown.

The new hardware should be in the list and there should be a button "Create Virtual Sensors".
Click this button. Choose type of the sensor you have created. Please note IDX number of your sensor.

Enter idx numbers for every sensor into main.py file. You need it in your Python script to address data from sensors to virtual sensors.

To see the devices list, click on SETUP tab and then select DEVICES.

Also, enter the IP addressof you Domoticz server to main.py file.

Now you can upload main.py to Wemos D1 mini Pro.

Result

wifimgr.png
sensors.jpg
SOILse.jpg
1st.jpeg
soilsensor.jpg

Power on the device.

After ESP starts, find a new WiFi network called "Wifimanager". Connect to it with your PC or phone by using password: "tayfunulu", then go to IP address 192.168.4.1.. Here you can connect your ESP to local WiFi network. Choose WiFi network you are going to use, type in password, hit "Submit". If everything is correct, you will see message " ESP successfully connected to XXXX network". Your ESP now is connected to your WiFi network and ready. As soon as it connected to WiFi it will connect to Domoticz server and start to send data from sensors. You can track the process in "Setup"/"Log". Display newly created sensors by clicking "Temperature" tab. The sensor image will be shown.

Soil sensor will be shown under "Utility" tab.

Mark sensors like "favorite" by clicking the star sign, to see thme all on "Dashboard" tab.

Since the errors handling is implemented in the code, the device will not crash, but only reboot in case of an error.

So now you will know, what i going on in your Greenhouse.

Good luck :)