Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

This is a Python3, Maker and DIY project where I am building a self watering system for a plant using a Raspberry Pi, sensors, diods and other nifty little things.

Notifications You must be signed in to change notification settings

mickekring/Self-Watering-Empire-Pot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self Watering Empire Pot

What is this? Well, it's a simple DIY/Maker/Python3 project which I created to learn more about electronics but it's mostly about learning Python. So the basics are; to design and 3D-print all parts, which will be a pot, a speaker, a water tank and some kind of housing for the Raspberry Pi. After that, I'll attach a couple of sensors measuring soil moisture, temperature, humidity and a couple of more things hopefully. We'll see what I can come up with.
When the soil moisture levels are below a certain number a water pump will pump water into the pot.
So why "empire"? Well, I wanted to throw a bit of Star Wars at it. :)

Work in progress - working!

22 jan 2018: This project is now up and running with all the bugs taken care of. It will still be sort of a work in progress. I may still add functionality.

Disclaimer

My Python skills are at best on a beginners level so I'll gladly take on any good advice. But what you see is what you get. I'm not better than this.

Where I'm at - at the moment - startup sequence

The project is more or less finnished and I'm currently making a demo movie. Here's the startup sequence for the plant pot.

What it is and what it does

  • It's a plant pot, where a plant grows
  • It detects whether the soil is too dry, and if it is, switches on a relay which controls a water pump, which gives water to the plant
  • It reads temperature and humidity via a sensor where the plant is
  • It grabs outside local temperature, humidity and the weather via API from openweathermap.org
  • It has a speaker and an amplifier which makes it able to "speak" via gTTS (google text to speech)
  • It has a couple of led diods, blue, red and green so it can display alerts, code greens and stuff using PWM (pulse width modulation). It also looks kind of cool
  • It sends SMS to eg warn if the tank level is low and needs a refill
  • It can send status updates and recieve commands via Twitter
  • It logs stuff and errors to a csv file
  • It logs stats, which it sends to a web server via SFTP, where it can be displayed using http://dygraphs.com JavaScript charting library
  • It keeps me company, when alone ;)
  • It's got some fail safes if something is wrong with the sensor measuring soli moisture, like only beeing able to water the plant for two times a day, then sends a warning SMS that something may be wrong, and it can only text that message once per day
  • It's designed and 3D-printed by me, except the stormtrooper and the empire logo, which I found on Thingiverse and 3D-printed
  • Since it's pretty internet-dependent, it will try-except everything if no connection is available and log it and store locally, for later upload, when it's back online again. Core functionality must keep running

Updates

  • 22 jan 2018 - v1.3 - Added power LED and up and running
    All the bugs have been taken care of and the pot has been running flawlessly for a couple of days now. I also added an power LED to the water tank module so that I know that the project is powered. That's that with the hardware for now. Next on the list is to make a short video demoing the project.
  • 17 jan 2018 - v1.2 - Bug hunt
    I've been running the script for a couple of days and have found some bugs. First, the script broke and stopped at midnight a couple of times. That seems to correspond to internet being down. But, since core pot functionality should keep running I've been hunting the problem. I added some more Try - Excepts. Last night, internet went down again, but the logs showed that the program continued to run. Hopefully that's that with that.
    The second problem I'm dealing with is the Twitter functionality. It sorta works, but not for long. At first I thought that I've been requesting data too much and broken the Twitter limits, but that doesn't seem to be the case. So I changed method for getting user timeline and I'll monitor if that works. It seems so at the moment.
  • 07 jan 2018 - v1.2 - Fail safes
    Sometimes the moisture sensors misread or are badly tuned or are simply just worn down. To prevent over watering or similar problems, I've coded a fail safe. When watered more than two times, it will send an SMS to check problems and lock watering for the rest of that day.
  • 06 jan 2018 - v1.1 - Error logging
    Added some error logging to external file for easier debugging. Test running the program for longer periods of time now, for bug finding.
  • 04 jan 2018 - v1.0 - Up and running
    No more test program. v1.0. Everyting is running by itself and it responds to tweets, sends SMS if water tank levels are getting low... and most important of all, it waters the plant if the soil is too dry.
  • 02 jan 2018 - v0.9 - Added weather data from openweathermap.org
    Outside temperature, humidity and weather conditions are now a part of the program.
  • 01 jan 2018 - v0.8 - SMS and more Twitter
    The program can now accept commands via Twitter, from users who are entrusted. It will be one of the main forms of interactions with the program. It can now send SMS.
  • 29 dec 2017 - v0.7 - Twitter capabilities
    The program is now able to tweet, using Tweepy within Python. A function is setup and it's tweeting whatever is stored in the variable tweetMessage.
  • 29 dec 2017 - v0.5 - Initial upload
    Today is the day when I decided to start this GitHub project. More info will be added, but most importantly, this is a work in progress. I've been working on this project for a while, but I thought I ought to document it, so stay tuned.

Hardware

Here I'll post the hardware that I'm using and where I bought it. Mostly, it's off Aliexpress, but you can find these generic part pretty much anywhere. I'll add to the list as the project expands.

3D models

Here you can find links to the 3D parts that I've designed in TinkerCAD. They are public, so you can grab them and remix them if you like. I'm using an Ultimaker 2 GO, which is a small printer, so these models should easily print on about any machine.

Python libraries and stuff

In this project I'm using a couple of libraries that you'll probably have to install to run the program. Google how to install these on your system.

  • Paramiko - Uploading of files via SFTP to server
  • Adafruit_DHT - To make easy use of the DHT11 sensor
  • gTTS - Google text to speech
  • YAML - To store and retrieve credentials from external yml file
  • Tweepy - so that the pot can tweet on Twitter
  • alsaaudio - to control volume levels
  • gpiozero - to get the cpu temperature - for statistics
  • twilio - to get twilio and sms functionality working

Modules

I'll explain what the different modules do here.

Speaker / Light module



The speaker module contains a small speaker and an amplifier (the red little board), with a pot for volume as you can see on the left side of the picture. You can also see the LED diods that I have soldered to a prototype board with resistors. Everything is then glued on.
To the right you can see the front, where I've glued on an empire (Star Wars) logo as speaker grille. Above the speaker you see a sort of see through pane which I created (once again) out of glue. This makes the LED lights looking a bit cooler (in my opinion), since you don't really see the individual diods.
There's also a separate top and back which will be glued on.

Pot module

There's not really that much to say about this module, more than that this is where the plant resides.

Water tank module



At the bottom if the tank I've glued down the water pump. The tank holds about 10-11 cycles of watering (3 seconds).

Road map and goals

This is sort of what I want out of the project. As I get new ideas, this will grow.

  • gTTS - Google text to speech - The pot should be able to communicate through speech.
  • STT - Speech to text - preferably I'd like to speak to the pot (which is healthy for it as well) as my main input This will not be implemented, since I find it to unreliable and slow. Main means of communication will be trhough Twitter, where I can send commands.
  • Temperature sensor - record temperature near the plant for statistics
  • Humidity sensor - record humidity near the plant for statistics
  • Soil moisture sensor - to sense whether the plant needs water or not
  • Light sensor - record the amount of light the plant gets That will be for another project...
  • Proximity sensor - Sense when people are near the plant for automatic status updates That will be for another project...
  • PWM - Pulse Width Modulation - for a pulsating light effect when red and green alert and for blue when pot is speaking
  • Check internet connection and warn if off
  • Log sensory inputs in a csv-file
  • Send logs to a web server via SFTP and serve graph charts
  • Relay - Control water pump
  • Camera - It would be cool if I could hook up a camera and use it to take a snap now and again, which will be sent to a web serverThis will not be implemented, since I think it would be kind of useless after a while.
  • Design and build casings and pots using 3D-software and printing - I'm designing it by using modules. A pot module, speaker/light module, water tank and so on.
  • Design and solder some simple circuit boards - Must learn to solder
  • Send warnings and status via e-mail or sms or slack or... It will be communicating via SMS and Twitter.
  • Twitter - The pot should be able to tweet. It's twitter account is @empireplantbot
  • Try / Except - Make sure that the core functions keeps running and logging is done locally only if eg internet goes down
  • Fail Safes - Make sure the plant can't be over watered in case of malfunctioning sensors or other.
  • Network messaging - Merge this project with earlier project and make the two RPi's talk to each other
  • Glue gun - Glue the s--t out of everything
  • Get weather data from openweathermap.org to display and log. Could be interesting to see how much outside temperatures affects the amount of watering needed.
  • Message me when the water tank needs refill. Now, the pump is on for 3 seconds. That's enough for 10 waterings.

About

This is a Python3, Maker and DIY project where I am building a self watering system for a plant using a Raspberry Pi, sensors, diods and other nifty little things.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages