Micropython how to use Turnipbit to make an automatic watering device

Recently, I am researching the Turnipbit board, and I plan to connect a camera module. I am in the process of experimenting. At that time, I found that there were a lot of bugs in the trick, and I cut them all out. Looking at the empty flowerpot, I remembered watering. Can we make a device to realize the function of automatic watering by detecting the soil humidity? Before the device was made, I wondered if the Turnipbit and the Turnipbit expansion board could be used to make an alarm prompt when the soil moisture reaches the set value. Please give some advice on how to do the specific device.                                                                                        

need some devices

1. Turnipbit board and Turnipbit expansion board together

2. Several DuPont lines

3. One soil moisture detection module

4. One USB cable

 

Let's first look at the principle of soil moisture detection module

The soil moisture detection module is mainly used to measure soil volumetric water content. It uses the principle of electromagnetic pulse to measure the apparent dielectric constant (ε) of the soil according to the propagation frequency of electromagnetic waves in the medium, thereby obtaining the soil volumetric water content (θv). .

 

 

 

 

 

 

 

The corresponding table of Turnipbit expansion board and LED interface is as follows:

 

Turnip expansion board

Soil Moisture Detection Module

3V3

VCC

GND

GND

P5

DO

 

 

 

 Regarding the code, first open the Turnipbit visual programming interface http://www.turnipbit.com/

I used programming code and visual programming to achieve this.

from microbit import *


while True:
if pin5.read_digital():
display.show(Image("09990:99999:00090:09000:00900"))
else:
display.show(Image.HAPPY)

 

 

Visual programming diagram

 

 


 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325193090&siteId=291194637