Raspberry PI + Moisture Sensor with Python (wiring, code, step-by-step walk-through)
Data36 - Online Data Science Courses
0:00 / 0:00
Raspberry PI + Moisture Sensor with Python (wiring, code, step-by-step walk-through)
30 910 просмотров · 5 лет назад
Data36 - Online Data Science Courses
6,85 тыс. подписчиков
30 910 просмотров · 5 лет назад
Growing Strawberries with a Raspberry Pi, on autopilot, EP#2
In this episode, I'll start to add the specific hardware that my automated gardener needs. And the first piece will be the moisture sensor.
00:00 Intro
01:15 What’s the best moisture sensor?
02:13 Wiring
03:53 Rasperry PI via command line
05:17 Installing prerequisites (apt-get update, etc.)
06:45 Installing text editors for coding
08:47 Installing moisture sensor packages and libraries
14:39 Testing the moisture sensor code!
15:36 ERROR!!! (No I2C device at address: 0x26)
16:40 It works!
18:14 Let’s try to understand and modify the code!
22:28 Prototyping the water pump logic with a simple if statement
24:37 Conclusion
THE TOOLS I USE IN THIS VIDEO:
Raspberry Pi 4 (Model B)
Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor: https://www.adafruit.com/product/4026
LINKS AND CODE BASE FOR EACH STEP:
STEP #1 - wiring: https://learn.adafruit.com/adafruit-s...
STEP #2: Prerequisites:
https://learn.adafruit.com/circuitpyt...
STEP #3: Installing mcedit and Sublime Text:
sudo apt-get update mc
OR
https://data36.com/sublime-text-data-...
STEP #4 - Python Installation of seesaw Library:
https://learn.adafruit.com/adafruit-s...
STEP #5 - Enabling I2C, SPI and installing RPI.GPIO + adafruit-blinka:
IMPORTANT! After I’ve recorded this video, Adafruit changed their tutorial, so you EITHER follow their new stuff, here:
https://learn.adafruit.com/circuitpyt...
OR you follow the stuff in the video by running these lines:
sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools
sudi raspi-config
sudo reboot
sudo i2cdetect -y 1
sudi raspi-config
sudo reboot
ls /dev/i2c* /dev/spi*
pip3 install RPI.GPIO
pip3 install adafruit-blinka
STEP #6 - Testing Blinka:
https://learn.adafruit.com/circuitpyt...
STEP #7 - Actually installating the seesaw Library:
https://learn.adafruit.com/adafruit-s...
STEP #8 - Using the moisture sensor code:
https://learn.adafruit.com/adafruit-s...
STEP #9 - The modified version of the script that I used at the end of the video:
https://github.com/tomimester/automat...
OTHER LINKS MENTIONED IN THE EPISODE:
Newsletter: https://data36.com/newsletter
Free mini-course: https://data36.com/how-to-become-a-da...
ALL EPISODES:
• Building an Automated Gardener with a Rasp...
NEXT EPISODE:
• Moisture Sensor Automation and Accuracy Qu...
IMAGE SOURCES:
COVER: Photo by Isaac Quesada on Unsplash
-------
Check my website: https://data36.com
Get access to more data science tutorials, join the inner circle: https://data36.com/inner-circle
Find me on Twitter: / data36_com