allenpomeroy/GardenPi
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
This repository contains all the code components for my Garden automation system that is based on Raspberry Pi 4 and it's built in GPIO interfaces.
Hardware:
- Raspberry Pi 4 running Debian Bookworm Linux
- PiControllerV2.2, 5.1 and 7.1 expansion PCB
- MCP23017 for 16 additional GPIO lines accessed via I2C
- MCP3008 Analog Digital Converter accessed via native GPIO SPI interface
- Daylight level 3V3
- Wind Direction 3V3
- 3x Soil moisture 3V3
- Water pressure 5V
- PowerController 5V monitor
- Auxillary 5V input
- PowerControllerV2.4.2
- MCP23017 for control of
- 5 24VAC relays
- 2 12VDC pump relays
- 60Hz 120 VAC frequency measurement
- 3 additional GPIO input lines
- Native GPIO lines on the Raspberry Pi
- Rain, Wind sensors
- Native I2C hardware (Bus 1) and software (Bus 3) busses
- Si7021 Temp+Humidity sensors internal and external
Software:
- python3 now enforcing virtual env needed to install third party libraries such as the Adafruit CircuitPython
- need to install the libraries prior to using these scripts
- need to use following to setup env:
sudo python3 -m venv /opt/garden/python3
sudo /opt/garden/python3/bin/pip3 install adafruit-circuitpython-mcp230xx
- Uses Adafruit libraries for both MCP23017 and MCP3008 chips
https://docs.circuitpython.org/projects/mcp230xx/en/latest/api.html#adafruit_mcp230xx.digital_inout.DigitalInOut
- since many clients could be accessing the MCP23017's or the MCP3008 simultaneously, I've chosen a small number of daemons to provide exclusive access to the chips without reinitializing on every access
- client programs communicate to the daemons via sockets and implement an exclusive lock to ensure only one client of each daemon is communicating with the daemon at a time
- daemons / clients:
- irrigation-daemon.py / irrigation.py - control valves and pumps, turn on/off, get status
- adc-daemon.py / adc.py - read voltage of any of the ADC channels
- exp-gpio-daemon.py / exp-gpio.py - control LEDs, trap interrupts for GPA side, GPB side (switches, motion), and powerline Hz from PowerController MCP23017
- valves/pumps for on/off/status, the ADC channels for read and expansion 23017