TPYBOARDV102 automatic watering system of Micropython example

Source: Internet
Author: User

1. System functions

Monitoring of soil moisture, ambient temperature, light intensity
Automatic watering according to current environment, cold weather automatically heats soil

2. Required Components

Tpyboard Board 1 pieces
Photosensitive Module 1 Blocks
DS18B20 Module 1 Block
Soil Moisture Detection Module 1 block
DuPont Line several
Relays 2 X

3. Wiring method


4. Source Code

 fromPybImportPin, ADC fromds18x20Importds18x20 GL= ADC (Pin ('Y12'))#300 bright-1700 darkSD = ADC (Pin ('Y11'))#1800 Dry-800 wetWD = ds18x20 (Pin ('Y10')) KS= Pin ('Y9', PIN.OUT_PP) JR= Pin ('Y8', PIN.OUT_PP) whileTrue:Print('\ t light intensity:', Gl.read (),'\ t Soil moisture:', Sd.read (),'\ t Current temperature:', Wd.read_temp ()) Pyb.delay (200)       ifGl.read () <=250:#Plenty of sunshine              ifSd.read () >800:#More WateringKs.value (1)              Else: Ks.value (0)elifGl.read () >=1300:#Insufficient Sunlight              ifSd.read () >1200:#Less wateringKs.value (1)              Else: Ks.value (0)Else:#Sunshine General              ifSd.read () >1000:#Normal WateringKs.value (1)              Else: Ks.value (0)ifWd.read_temp () <18:#temperature is too lowJr.value (1)      Else: Jr.value (0)

TPYBOARDV102 automatic watering system of Micropython example

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.