LCD display and buttons in Python (tutorial and code)

Raspberry Pi related support

Re: LCD display and buttons in Python (tutorial and code)

Postby hondagx35 » 29 Aug 2016, 09:49

Hi riveraXVX ,

what steps are now not necessary (as I understand the latest versions have python2 already on there) to the original post on here?

Yes python2 is already installed.

The links are outdated use:
https://pypi.python.org/packages/c1/a8/ ... 6.2.tar.gz
instead of installing unzip and downloading the zip from github
Code: Select all
wget https://github.com/adafruit/Adafruit_Python_CharLCD/archive/master.zip

Code: Select all
pacman -S unzip

use:
Code: Select all
git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git


Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: LCD display and buttons in Python (tutorial and code)

Postby riveraXVX » 29 Aug 2016, 21:53

hondagx35 wrote:Hi riveraXVX ,

what steps are now not necessary (as I understand the latest versions have python2 already on there) to the original post on here?

Yes python2 is already installed.

The links are outdated use:
https://pypi.python.org/packages/c1/a8/ ... 6.2.tar.gz
instead of installing unzip and downloading the zip from github
Code: Select all
wget https://github.com/adafruit/Adafruit_Python_CharLCD/archive/master.zip

Code: Select all
pacman -S unzip

use:
Code: Select all
git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git


Frank


thanks Frank! that is one area I had problems with earlier and I wasn't smart enough to figure out where/how to grab the updated stuff from a different location! just got our 20x4 this afternoon also! time to tinker tonight!
riveraXVX
 
Posts: 3
Joined: 22 Aug 2016, 00:28

Re: LCD display and buttons in Python (tutorial and code)

Postby hondagx35 » 29 Aug 2016, 22:25

Hi riveraXVX,

feel free to ask if you encounter problems.
Tinkering with these things can be very satisfying, but also very frustrating.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: LCD display and buttons in Python (tutorial and code)

Postby riveraXVX » 30 Aug 2016, 08:58

hondagx35 wrote:Hi riveraXVX,

feel free to ask if you encounter problems.
Tinkering with these things can be very satisfying, but also very frustrating.

Frank


just wanted to extend my thanks again! I'd consider myself almost a total novice when it comes to this stuff..... tech minded but slowly now actually teaching myself a bit more (and learning to repair electronics/learning more how it all works in general)

Image
took me a couple hours of playing around but was finally able to get the 20x4 generic LCD from ebay working with six fully functioning buttons on our pi 3b tonight! I had a bit of trouble originally and had to start over twice - the RPi.GPIO package and git clone link for the Adafruit Python CharLCD stuff was very handy (as it was a point I got crossed up before)

combined with Xplod's newer files pulled via:
Code: Select all
git clone https://github.com/RandyCupic/RuneAudioLCD.git


a few quick changes to the button GPIO's I was using, a few screwturns to adjust the contrast and we were rolling!

:D

I think this officially counts as my first real project with raspberry pi though now I need to actually build it and make a nice case! (this one sadly is for my younger brother not me!)

I'll be sure to snap some good photos once we get things figured out. I guess technically I still need to figure out wiring i the pifi dac+ into everything but other than sitting down for a few minutes and figuring out which pins to tie everything to should be good to go!
riveraXVX
 
Posts: 3
Joined: 22 Aug 2016, 00:28

Re: LCD display and buttons in Python (tutorial and code)

Postby LemPyle » 02 Sep 2016, 17:23

Hi...as per my knowledge if you need I2C and you know what you're doing, you can fix this (get that module). I removed a few lines from Adafruit library which uses I2C, so I will give instructions here how to do it. You will need something to modify files: you can use "nano" editor integrated in bash, but it's not very practical. You use it by executing "nano path_to_file". If you're on Windows, you can use a program like WinSCP.
LemPyle
 
Posts: 1
Joined: 01 Sep 2016, 18:51

Re: LCD display and buttons in Python (tutorial and code)

Postby mecaz » 02 Oct 2016, 10:17

Hello,

I am running rune 0.4beta on Rpi 3
and i am using RuneAudioLCD for my i2c lcd.
it starts successfully when i execute manually. it also starts when i run systemctl start mpdlcd.service
but i cant make it start automatically on startup.


I renamed and used script down below as mpdlcd.service
What should i to solve this issue?

Thanks

hondagx35 wrote:Hi doozboo,

i would use something like this as unit file:
Code: Select all
[Unit]
Description=RuneAudio I2C LC-Display
After=mpd.service

[Service]
ExecStart=/usr/bin/python2 /root/RuneAudioLCD/start.py
TimeoutSec=0
Restart=always
RestartSec=1
StartLimitInterval=30
StartLimitBurst=20

[Install]
WantedBy=multi-user.target


- use "After=mpd.service" instead of "After=network.target", because your script needs mpd to be active not network!
- avoid "sleep" in unit files, because systemd tries to start all services in parallel.
- use "RestartSec=x" to add some delay before restarting

You only have to enable it once:
Code: Select all
sudo systemctl enable ra-i2c-lcd.service

After rebooting your device it should start automatically.

What you can do before enabling it is to test it once:
Code: Select all
sudo systemctl start ra-i2c-lcd.service


Frank
mecaz
 
Posts: 10
Joined: 11 Jan 2016, 19:38

Re: LCD display and buttons in Python (tutorial and code)

Postby hondagx35 » 02 Oct 2016, 11:12

Hi mecaz,

it starts successfully when i execute manually. it also starts when i run systemctl start mpdlcd.service
but i cant make it start automatically on startup.


Code: Select all
systemctl enable mpdlcd.service

This doesn't work? Should start the service on boot.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: LCD display and buttons in Python (tutorial and code)

Postby mecaz » 02 Oct 2016, 13:58

hondagx35 wrote:Hi mecaz,

it starts successfully when i execute manually. it also starts when i run systemctl start mpdlcd.service
but i cant make it start automatically on startup.


Code: Select all
systemctl enable mpdlcd.service

This doesn't work? Should start the service on boot.

Frank


Yes i have already did it. unfortunately it doesnt start automatically.
but i can see it listed on debug page

###### Systemd active startup scripts (ls -lah /etc/systemd/system/multi-user.target.wants/) ######
total 8.0K
drwxr-xr-x 2 root root 4.0K Oct 2 11:13 .
drwxr-xr-x 6 root root 4.0K Mar 13 2016 ..
lrwxrwxrwx 1 root root 44 Feb 15 2015 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service
lrwxrwxrwx 1 root root 39 Feb 8 2015 haveged.service -> /usr/lib/systemd/system/haveged.service
lrwxrwxrwx 1 root root 38 Oct 2 11:13 mpdlcd.service -> /usr/lib/systemd/system/mpdlcd.service
lrwxrwxrwx 1 root root 44 Mar 11 2016 mpd-watchdog.service -> /usr/lib/systemd/system/mpd-watchdog.service
lrwxrwxrwx 1 root root 44 Mar 21 2016 netctl-auto@wlan0.service -> /usr/lib/systemd/system/netctl-auto@.service
lrwxrwxrwx 1 root root 47 Mar 13 2016 netctl-ifplugd@eth0.service -> /usr/lib/systemd/system/netctl-ifplugd@.service
lrwxrwxrwx 1 root root 37 Feb 14 2015 nginx.service -> /usr/lib/systemd/system/nginx.service
lrwxrwxrwx 1 root root 36 Feb 15 2015 ntpd.service -> /usr/lib/systemd/system/ntpd.service
lrwxrwxrwx 1 root root 39 Feb 14 2015 php-fpm.service -> /usr/lib/systemd/system/php-fpm.service
lrwxrwxrwx 1 root root 37 Feb 14 2015 redis.service -> /usr/lib/systemd/system/redis.service
lrwxrwxrwx 1 root root 40 Mar 19 2016 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx 1 root root 43 Feb 14 2015 rune_PL_wrk.service -> /usr/lib/systemd/system/rune_PL_wrk.service
lrwxrwxrwx 1 root root 45 Feb 14 2015 rune_shutdown.service -> /usr/lib/systemd/system/rune_shutdown.service
lrwxrwxrwx 1 root root 43 Feb 14 2015 rune_SY_wrk.service -> /usr/lib/systemd/system/rune_SY_wrk.service
lrwxrwxrwx 1 root root 36 Feb 8 2015 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx 1 root root 48 Feb 8 2015 systemd-resolved.service -> /usr/lib/systemd/system/systemd-resolved.service
mecaz
 
Posts: 10
Joined: 11 Jan 2016, 19:38

Re: LCD display and buttons in Python (tutorial and code)

Postby hondagx35 » 02 Oct 2016, 14:15

Hi mecaz,

please check:
Code: Select all
systemctl status mpdlcd.service

Code: Select all
journalctl

after booting for errors.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: LCD display and buttons in Python (tutorial and code)

Postby mecaz » 02 Oct 2016, 14:30

hondagx35 wrote:Hi mecaz,

please check:
Code: Select all
systemctl status mpdlcd.service

Code: Select all
journalctl

after booting for errors.

Frank


yes there is an erorr :/

[root@runeaudio ~]# systemctl status mpdlcd.service
● mpdlcd.service - RuneAudio I2C LC-Display
Loaded: loaded (/usr/lib/systemd/system/mpdlcd.service; enabled; vendor prese
Active: inactive (dead) (Result: exit-code) since Mon 2016-02-22 15:40:47 CET
Main PID: 352 (code=exited, status=1/FAILURE)

Feb 22 15:40:46 runeaudio systemd[1]: mpdlcd.service: Unit entered failed state.
Feb 22 15:40:46 runeaudio systemd[1]: mpdlcd.service: Failed with result 'exit-c
Feb 22 15:40:47 runeaudio systemd[1]: mpdlcd.service: Service hold-off time over
Feb 22 15:40:47 runeaudio systemd[1]: Stopped RuneAudio I2C LC-Display.
Feb 22 15:40:47 runeaudio systemd[1]: mpdlcd.service: Start request repeated too
Feb 22 15:40:47 runeaudio systemd[1]: Failed to start RuneAudio I2C LC-Display.
mecaz
 
Posts: 10
Joined: 11 Jan 2016, 19:38

support RuneAudio Donate with PayPal

PreviousNext

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 7 guests