Skip to content

ameer1234567890/gardenr

Repository files navigation

Build Status

Gardenr

An indoor gardening assistant

How it works

  • When ./gardenr.py is run, it reads temperature, humidity and soil moisture level.
  • It then updates these values to ./www/data.json for later use by web frontend.
  • It then updates the 15x2 LCD with the current time and soil moisture level.
  • A preset moisture threshold is compared against the moisture level, and a notification is sent via IFTTT if soil is drier than the threshold.
  • A python web server is then run with root ./www/.
  • The resulting frontend uses Javascript to query updated sensor data using AJAX.
  • Now, all the collected data can be accessed by reaching https://localhost or Raspberry Pi's hostname.
  • I use a the domain name gardenr.ameer.io which is signed with a LetsEncrypt certificate.
  • Since https is used, the resulting frontend is a fully compliant Progressive Web App (PWA).
  • The notification threshold can be changed from web interface.
  • ./gardenr.py can be made to run on startup, by installing systemd unit file ./gardenr.service.
  • Note: ./testdht.py, ./testsht.py ./testlcd.py and ./testmoisture.py are test scripts which are used for testing individual sensors.

TODO

  • Fabricate improved PCB.

Components Used

  • Raspberry Pi 3B+
  • DHT22
  • Soil Moisture Sensor KY70
  • Analog to Digital Converter (ADC) YL-40
  • 15x2 I2C LCD with PCF8574 as driver

Pinout for DHT22

Raspberry Pi  -  DHT22
-----------------------------
5V            -  VCC (Pin 1)
GND           -  GND (Pin 4)
GPIO4         -  DATA (Pin 2)

Pinout for Soil Moisture Sensor KY70

Raspberry Pi  -  Soil Moisture Sensor KY70
------------------------------------------
5V            -  VCC
GND           -  GND

ADC YL-40  -  Soil Moisture Sensor KY70
------------------------------------------
AIN3       -  A0

Pinout for ADC YL-40

Raspberry Pi  -  ADC YL-40
--------------------------
3.3V          -  VCC
GND           -  GND
SDA           -  SDA
SCL           -  SCL

Pinout for 15x2 I2C LCD

Raspberry Pi  -  15x2 I2C LCD
-----------------------------
5V            -  VCC
GND           -  GND
SDA           -  SDA
SCL           -  SCL

Libraries used

Pictures

Credits

Make Raspberry Pi's root filesystem read-only

if grep -qs 'overlay=yes' /proc/cmdline; then
  textred=$(tput setaf 3)
  cat <<END_HEREDOC

${textred}==>WARNING: Root filesystem is read only.
None of the changes you make will be preserved after reboot.
To disable read only mode change 'overlay=yes' to 'overlay=no'
at kernel commandline.
END_HEREDOC
fi