LCD display and buttons in Python (tutorial and code)

Raspberry Pi related support

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

Postby Hairybiker » 04 Jul 2015, 11:39

I'm lazy as well, that's why I don't like too much typing :D
If I am re-using code then it goes into a procedure and is forgotten about :lol:

Given Python's strict layout issues, I find it is simpler to dump into a proc and just call it rather than paste/edit.
Been looking into MPD but there doesn't seem to be much you can read from it, no info like playing/left time etc.
Might be better reading it from the rune webpage and scraping the result.
DRM is to rights management like DDT is to pest management.
Happy Linux Mint User. Check it out at www.linuxmint.com for a COMPLETELY FREE OS.
User avatar
Hairybiker
 
Posts: 14
Joined: 01 Jul 2015, 15:31

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

Postby XploD » 04 Jul 2015, 12:53

Actually, there are lots of of commands for MPD. I'm using MPD Python library, here you find all the commands: http://pythonhosted.org/python-mpd2/top ... mands.html

On the same way I'm getting artist and title, I think it's possible to get all other (current time, total time, bitrate, filename, size etc etc) but I will implement my own counter for elapsed time which will be syncronized on each change (new track, play/stop/pause). So it will be reseted to zero on song change and on pressing stop. And while playing, it will count independently. Because, it's not very good for optimization to "spam" MPD every 1 second to get elapsed time from it.

Since my college semester is done, I moved to my parents house during summer and now I'm facing a small problem: I have only one ethernet cable in my room for connecting my laptop and Wi-Fi signal is very poor in my room so I'm not able to listen to internet radio and SSH and RuneUI are pretty slow due to this. I will have to get an ethernet switch or something to connect it via cable or get a Wi-Fi repeater.

Here is my current setup: http://i.imgur.com/qe1mlA8.jpg :mrgreen:
Music taste:
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi:
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

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

Postby Hairybiker » 04 Jul 2015, 12:54

Cheap switch is the best way, unless all your stuff is wifi.
DRM is to rights management like DDT is to pest management.
Happy Linux Mint User. Check it out at www.linuxmint.com for a COMPLETELY FREE OS.
User avatar
Hairybiker
 
Posts: 14
Joined: 01 Jul 2015, 15:31

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

Postby XploD » 05 Jul 2015, 12:05

Attachments
FMCPZRTG8LWOHW9.LARGE.jpg
FMCPZRTG8LWOHW9.LARGE.jpg (228.58 KiB) Viewed 3271 times
Music taste:
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi:
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

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

Postby XploD » 21 Jul 2015, 13:28

Music taste:
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi:
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

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

Postby Hairybiker » 21 Jul 2015, 14:12

It's python2-i2c-tools if you are using python2 like I was, i2c-tools will install the python3 version, since python3 is the default in Arch Linux.
DRM is to rights management like DDT is to pest management.
Happy Linux Mint User. Check it out at www.linuxmint.com for a COMPLETELY FREE OS.
User avatar
Hairybiker
 
Posts: 14
Joined: 01 Jul 2015, 15:31

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

Postby XploD » 21 Jul 2015, 16:17

Music taste:
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi:
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

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

Postby schinken » 22 Jul 2015, 14:55

Hello!

This looks very promising and I orderer the i2c-interface and an 20x4 LCD.
While surfing ebay, I found a color LCD, too with SPI interface for same price as the 20x4+i2c.

Would be cool if we get this one running, showing the CD-cover or weather or whatever.

What do you all think?
schinken
 
Posts: 8
Joined: 13 May 2015, 10:25

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

Postby XploD » 23 Jul 2015, 11:18

Hello,

For a TFT screen, take a look at this topic: configuration-of-a-pitft-touchscreen-t731.html

I was thinking about buying a color screen as well but they are mostly to small or to expensive, so for now, I'm using a 20x4.

I'm currently rewriting the whole program for this to have more options, to work with 20x4 and I2C interface and for the code to be more tidy (I'll turn it from procedural to object-oriented). Once I finish, I will publish the code and the video to show it. Also, I put the code to github for easier access and updates.

Some screens so far:
Attachments
DSC_1548.JPG
DSC_1548.JPG (53.57 KiB) Viewed 3145 times
DSC_1549.JPG
DSC_1549.JPG (54.36 KiB) Viewed 3145 times
DSC_1547.JPG
DSC_1547.JPG (66.31 KiB) Viewed 3145 times
Music taste:
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi:
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

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

Postby XploD » 23 Jul 2015, 11:19

And more (due to only 3 files per post):
Attachments
DSC_1545.JPG
DSC_1545.JPG (70.3 KiB) Viewed 3145 times
DSC_1546.JPG
DSC_1546.JPG (59.57 KiB) Viewed 3145 times
Music taste:
Audio source: Raspberry Pi 2 + Sabre ES9023 DAC + WD 500 GB HDD + TP-Link TL-WN722N Wi-Fi + D-LINK Dub H7 USB hub
Hi-Fi:
Mixer: Nady Audio MM-242
Misc: Tube Stereo Vumeter (Magic Eye)
User avatar
XploD
 
Posts: 77
Joined: 24 Mar 2015, 18:32
Location: Croatia

support RuneAudio Donate with PayPal

PreviousNext

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 16 guests
cron