A face for your plant that might help you remember to water it, with a web frontend that lets you check how fast your plant dries up.
- Raspberry Pi Zero W. This should (probably) work with any Pi, but the Zero is a good size. I'm not a very confident solderer, so I got a Zero WH.
- Some kind of micro SD card to store the data for the Pi, and a way to copy data to it—maybe a Micro SD to SD card adapter, and an SD card reader if your computer doesn't have one.
- 2.13" E-Ink Display for Raspberry Pi
- Capacative moisture sensor
- Grove base HAT for Raspberry Pi Zero
I found it a bit tricky to connect the display to the board—it's kind of a flimsy ribbon cable that you need to push pretty firmly in to its connector.
The capacative moisture sensor is an analog sensor. Connect it to port A0 on the Grove base HAT.
You should be able to stack the Grove HAT and E-Ink display. First push the Grove HAT (with the moisture sensor attached) in to the Pi, and then push the E-Ink display in to the Grove Hat's 40 pin connector. They don't fit as snug as they could, but it should make sufficient contact for everything to work.
I used the Raspberry Pi Imager to put a Raspberry Pi OS Lite image on the Pi. In order to be able to SSH to the Pi, I also added the following files to the SD card before inserting in to the Pi.
- A
wpa_supplicant.conf
file so that the Pi will connect to the desired Wi-Fi network. - An empty
ssh
file (see "Enable SSH on a headless Raspberry Pi") to enable SSH access when the Pi boots.
You'll need to install Sqlite3 to save your plant's moisture readings and show them on the web server.
sudo apt-get install sqlite3
After SSHing in to your Pi (by default you should be able to do ssh pi@raspberrypi.local
with password raspberry
, which you'll be prompted to change), you'll need to do some initial setup to install the libraries that allow all the hardware to work.
- Complete the "Enable SPI Interface" and "Libraries Installation" steps (on the "Hardware/Software setup" page) from the Waveshare 2.13" e-Paper HAT guide. Be sure to use the Python 3 instructions.
- If you'd like to download and run the examples (not necessary to build this project), you'll need to change the pin definitions as described in this guide. For the E-Ink display I used, the epd_2in13bc_test.py file worked.
- Use the Python 3 steps to install Seeed Studio's Grove.py library.
- You can test that you're getting readings from your moisture sensor by running the
grove/grove_moisture_sensor.py
file—note that the default ranges seem to be off in my tests, they may be for a resistive moisture sensor (the output of the above script will always read "wet").
You do not need to clone this respository to your Raspberry Pi—the deploy script can be used to sync your code from your development computer to the Pi so you can easily iterate on the code.
Copy .env.sample
to a .env
file to set up your configuration.
cp .env.sample .env
Edit .env and update the values according to your needs. PI_USERNAME
and PI_HOSTNAME
may need to be changed if you changed your pi username/hostname after setting up the raspberry pi. You may need to change SSH_LC_CTYPE
if you see error messages related to LC_CTYPE
when deploying the code to your pi, but the default setting should work if you haven't changed language settings on your pi. WEB_PORT
is used to set the port if you want to test the web server locally.
If you've set up your .env
file, you should be able to deploy the necessary files to your raspberry pi by running ./deploy
. You may be prompted twice for your Raspberry Pi's password. If you'd like to avoid this, you can follow the instructions for passwordless SSH access on your Pi.
If all has gone well, you should be able to see your E-Ink display flash a few times and show an image based on the moisture reading its receiving from the sensor!