This is OpenSprinkler pi I2C LCD python script which gets data from OpenSprinkler API and sends to I2C LCD.
features:
- 16x2 and 20x4 I2C LCDs are supported (PCF8574T based, after some changes MCP23008 is supported too)
- first two lines are identical to LCD on OpenSprinkler 2.x (with icons)
- third and fourth lines are displaying information based on ospi status (remaining watering time, water level in %, E1 stations status)
- LCD backlight is controlled from OpenSprinkler GUI (Brightness = 0 ->> OFF, Brightness > 1 ->> ON)
- LCD is refreshed in one minute interval (can be changed in cron)
- this script in combination with Raspberry pi and I2C LCD can be used as remote OpenSprinkler LCD
Install RPLCD library directly from PyPI using pip:
$ sudo pip install RPLCD
Intall smbus and i2c tools:
$ sudo apt-get install python-smbus i2c-tools
Intall ospiLCD script:
$ cd /home/pi/
$ wget https://raw.githubusercontent.com/stanoba/ospiLCD/master/ospiLCD.py
$ chmod +x ospiLCD.py
Solder 2x3 pin header to ospi board:
Remove two 4K7 pull-up resistors from I2C LCD backpack:
Resistors are feeding 5V to Raspberry pi GPIO pins = not safe.
Connect I2C LCD to ospi pin header:
Run I2C scanner to detect all available address:
$ sudo i2cdetect -y 1
You should see I2C LCD at address 0x27:
Edit parameters (osAddress, osPort, md5hash, LCDcols, LCDrows) according your ospi and LCD in /home/pi/ospiLCD.py:
$ nano /home/pi/ospiLCD.py
Test the script if is working:
$ /home/pi/ospiLCD.py
If the script is working without error, schedule it via cron:
$ crontab -e
Add folowing line into cron:
*/1 * * * * python /home/pi/ospiLCD.py
Note: Script is executed every minute.
You can find LCD adapter PCB in HW folder.
PCB can be ordered from PCBs.io. ($0.89 / 4pcs)