I2C LCD display? differences from old 3.8? - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: Community (https://moodeaudio.org/forum/forumdisplay.php?fid=18) +--- Forum: General Discussion (https://moodeaudio.org/forum/forumdisplay.php?fid=21) +--- Thread: I2C LCD display? differences from old 3.8? (/showthread.php?tid=7191) |
I2C LCD display? differences from old 3.8? - lcipher3 - 12-11-2024 Hi! I've been using MoodeAudio at version 3.8 and now I'm trying to update to version 9.1.5 I successfully created the USB (I previously enabled USB boot) with the image and the player boots and I can access the IP address and SSH into the Raspberry Pi 3B that it's running on. Great. My help is needed to get my LCD I2C display working. I had an IC2 2x40 display running on the 3.8 version. I had some python lcd code that was provided by Matt Hawkins (i2c-40x2-lcd.py I think). To get it to run I had to first enable the I2C in the PI
works great... ---------------------------- So is that still the process on version 9 or is there a more streamlined way to get the I2C display to update? Do I still need SMBUS and i2c-tools and are they still out there for this version (3.11?) of python? Pointers to any setups or previous info would be appreciated. I looked but not too much on the older LCD type displays. I know its quite a leap from 3 to 9 versions so trying to avoid missing the simple way to do things! Any help appreciated. RE: I2C LCD display? differences from old 3.8? - Tim Curtis - 12-11-2024 Below is the default 9.1.5 /boot/firmware/config.txt It shows I2C bus enabled: dtparam=i2c_arm=on Code: ######################################### And it looks like the python3-smbus and i2c-tools packages are already present Code: pi@moode9:~ $ dpkg -l | grep python3-smbus RE: I2C LCD display? differences from old 3.8? - lcipher3 - 12-11-2024 thanks ! - so looks like I should be able to add the line (sudo python /home/pi/i2c-40x2-lcd.py) to the rc.local and run my i2c-40x2-lcd.py How does the moode config for "other peripherals" "lcd updated" and the "starter scrip" in /var/local/www/commandw/ directory work? Is this another way to do it? RE: I2C LCD display? differences from old 3.8? - Tim Curtis - 12-11-2024 As long as i2c-40x2-lcd.py runs under python 3 you should be ok. The LCD updater and its companion script can be used to update an LCD but you would need to figure out whats needed in the companion script. This script can't contain any while(true) loops since its being executed by an upstream system-level while (condition) process (inotifywait). /var/www/daemon/lcd-updater.sh Code: #!/bin/bash RE: I2C LCD display? differences from old 3.8? - lcipher3 - 12-12-2024 Thanks again - I have it working as before with my current script - had to update a few commands for current python (looks like the previous was python 2). I'll probably see if I can write my own version and use the companion script just for fun. The code you just posted answers what I was wondering on how the lcd_updater.py gets triggered. The new moode version has quite a bit more! Looking forward to exploring all the new features RE: I2C LCD display? differences from old 3.8? - lcipher3 - 12-13-2024 Curious - what's the difference between using: /var/local/www/currentsong.txt /home/pi/lcd.txt RE: I2C LCD display? differences from old 3.8? - Tim Curtis - 12-13-2024 Its just a file created by the stub script /var/local/www/comandw/lcd_updater.py You would put your own code that parses currentsong.txt and writes to your display in this script file Code: #!/usr/bin/python3 RE: I2C LCD display? differences from old 3.8? - Nutul - 12-13-2024 (12-13-2024, 03:14 PM)Tim Curtis Wrote: Its just a file created by the stub script I do admit that Python is not my strength, but... why copy a file line by line, when a cp would suffice??? Or indeed the culprit is "replace the line-copy cycle with your own code"...? RE: I2C LCD display? differences from old 3.8? - lcipher3 - 12-13-2024 Ah got it - it's just using currentsong.txt and showing an example. >>why copy a file line by line because you would need to process the currentsong.txt line by line to extract whatever you want to display, so read a line, strip whitespace, the = sign, fix "special characters" like ã etc depending on your display, etc For my 2x40 display I just use the artist (album) and title. And I check "state" to display if stopped, pause, etd The currentsong.txt looks like this: Code: file=USB/Elements/John Coltrane/Atlantic Recordings/disc4/4-01 Village Blues.flac RE: I2C LCD display? differences from old 3.8? - Tim Curtis - 12-13-2024 (12-13-2024, 05:33 PM)lcipher3 Wrote: Ah got it - it's just using currentsong.txt and showing an example. Correct. The example shows a basic method to read each line of currentsong.txt |