a raspberry pi project with e-Ink display that employs 3 Ic2 sensors to monitor my greenhouse
The display includes, Temperature, Humitity, Lux, and Pressure graph. It also includes Wifi Strength and battery Level, as well as the date time the display was updated (since e-ink does not require power to run)
Powered by Solar Cell and Packaged in waterproof case
This Python display is for the Pimeroni Inky pHAT It also uses 3 Adafruit sensors
Install Python Libraries
sudo pip3 install inky
pip3 install RPI.GPIO
pip3 install adafruit-blinka
sudo pip3 install adafruit-circuitpython-veml7700
sudo pip3 install adafruit-circuitpython-ads1x15
I wanted to echo the display on the InkyPhat to a webpage It was not clear in the Pimeroni docs, but adding a pallate I was able to output the image to both the display and to a file.
inky_display.set_image(img)
inky_display.show()
img.putpalette([255,255,255,0,0,0,255,0,0])
img.save("currentDisplay.png")
Route port 80 to port 8080 (add this to /etc/rc.local)
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 8080
I followed this guide to reduce power consumption on the Pi Zero W
/usr/bin/tvservice -o
echo none | sudo tee /sys/class/leds/led0/trigger
echo 1 | sudo tee /sys/class/leds/led0/brightness
I found that I can save another 20 to 25 mA by disabling the Wifi. I implemented 2 different stategies to decide when to keep the Wifi on or off.
- Wifi Power Schedule (Wifi is on at the top 20 min of every hour and off all night)
- Lux triggered Wifi (Wifi is on only in the Day)
I also diabled bluetooth
sudo nano /boot/config.txt
Add below, save and close the file.
# Disable Bluetooth
dtoverlay=pi3-disable-bt
Disable related services.
sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service
I scavenged a charge/regulator from a USB powerbank
and hooked it to 2 3.7v Lithium cells in parallel (18650)
On sunny days the solar cell fully charges the batteries, but in the spring and fall I sometimes have to charge it.
To find the range of battery voltages I charged the battery untill it stopped rising. Then I rand the unit with no charging until it died.
From this I used 3.2v as 0% and 4.096v as 100% (WRONG)
Little did I know the ADS1015 default gain can only measure a max of 4.096. after setting the gain to 2/3 (I know right) The new max voltage is 4.1612v
From the datasheet:
Table 3. PGA Gain Full-Scale Range | |
PGA SETTING | FS(V) |
2/3 | ±6.144V(1) |
1 | ±4.096V(1) |
2 | ±2.048V |
4 | ±1.024V |
8 | ±0.512V |
16 | ±0.256V |
Edit /etc/rc.local and add
/usr/bin/tvservice -o
cd /home/pi/GreenHouse
python3 GreenHouse.py &
then reboot.
The display is available on the e-Ink and on a webpage on port 8080 http://greenhouse:8080