My Second RPI Volumio project !!!

Dear All,
I’m proud to share with you some pictures of my last -nearly finished - project.
It is based on a RPI b+ with a PI DAC+ and an amplifier PI-AMP+ both from IQAUDIO.
I add a 2x16 lcd display that displays :

  • At startup a welcome message and the IP Adress from power on to end of boot.
  • As soon as mpd start playing, the song , the artist, and time are displayed thanks to mpdlcd.
  • The volume is displayed 3 seconds when it is changes and the display return to mpdlcd
    I add also add buttons :
    front face : previous
    next
    stop
    play - pause
    a rotary coder to set the volume
    back : a shtudown button
    a unused yet button (reboot or some info I don’t know, I’ll see later)
    Buttons are from a old remote :smiley: and I bought some micro switch (<2€ on ebay /100 shipping included :sunglasses: ).
    I wrote several python scripts to managed all that. A script unmute the amp after boot ( thank you Gordon). A other script check every 10 sec if mpdlcd is still alive because some tags (due to some tag software) hang it. … The only option is to retag all the song with this problem… But with the script it restart
    asap you change the song :wink:
    The power supply is the one sold with the PI AMP+
    The stainless steel case is home designed, and realise in lasercut and sheetmetal bending.
    Now I’m looking for a nice button for the volume setting.
    I use a wifi dongle and the music is store a NAS (D-link).
    The sound : Great ! :smiley: The amp drives 3 ways loudspeakers (old 3A 420). It’s very impressive how a 2x20w amp drive it!
    That it!
    vuense2.JPG
    volip.JPG
    hag.JPG
    favs.JPG
    facvol.JPG
    bottom.JPG
    back.JPG
    ardr.JPG

Looks awesome - please share pictures of the speakers too - and yes the little Pi-AMP+ does bang out some beats!

Gordon@iqaudio.com

As asked, a picture of the speakers !!!
3a 420.jpg

Hi,

Great project!
Would be nice if you could share the code for the script, I see you have build some nice scripts for the LCD

Iam also working on a new project. Akind of stand-alone radioplayer (not really high-end) but there is some woodwork, painting etc involved. so that takes some time…

THNX

Harry

Hi!
Of course I’ll share it, but this week end because I can’t do it before… Just want to precise that even if my scripts work, there is probably tons of things to remove / correcting… I am not a programmer and it took me a long time to find the good way to make it work :wink: .
Now I want to add the following : a short press on “next” button jump to the next song, and a long press seek several seconds forward in the song. Both commands work separatly but I can’t achieve to detect properly the buton press duration. If you could help ! :smiley:
Thank you

As promise, my scripts attached…
To manage physical buttons and rotary encoder : button-rasp.py
To display ip adress until mpd start and then launch mpdlcd and check every 10sec if it is alive and relaunch it if needed : monip.py
To display Volume each time volume is change via rotary encoder, webui or any mpdclient.
This scripts are far from being perfect. But they work! Feel free to improve/correct it and share . :wink:

Edit : I update the script monip.py because the one I have post had a syntax error …
Edit : March 2nd 2015 . Update script button-rasp.py to add seek when a long press on next and previous buttons
script-volumio.zip (3.52 KB)

Bonjour,

Take a look at this great tutorial about GPIO: http://raspi.tv/rpi-gpio
In the advanced section there you can learn/read something about a Threaded call.

A nice example of a Threaded call with a “count” of the time a button is pressed can be found over here: http://www.raspberrypi.org/learning/morse-code/worksheet/

By the way did you " kill" the Pi in your latest Hifi-project?

Harry

Hi!
@ buckler : Thank you for the links. Thank to that I add the “seek” function when a long press is done on next or previous button. :smiley: It is still not exactly what I want to do, because you have to maintain and release button to get the action. My exact feature is : short press : next song. Long press (>2sec) seek by step 8sec as long as you maintain button. I’m working on that :wink: .
I have updated my script above.
Yes this the Rpi used in my last project that I have burned… :astonished: I have already change it…

Hi!
A new picture of my project with a nice volume knob ! Thank you Gordon(gswg) for it :wink:
Now, it’s nearly finished…
isoavbutton.JPG

Hi Everybody,

I’m trying to install a lcd with the same pcf8475 controller than you and I have some issues.
Could you explain how you’ve installed all the software part of your project please ?

I’ve searched on google and find lots of tutos but it’s still not working at all.

I’ve installed I2Ctools and trying the I2Cdetect -y 0 fonction but I have an error message saying the files or directory is not existing !

Please help me if you can because I dont see any solutions !

Thank’s a lot !

Hi!
In linux, commands are case sensitive.
Are you sure to type i2cdetect -y 0 ?

Thank’s for the answer, i’ve find the solution for i2cdetect issue, it’s been because i’m in 3.18 kernel so I’ve modified config.txt to activate i2c !

Now i have another problem, the pin of my backplat is different than the normal configuration. I’ve found a modified hd44780 driver with the right pin out conf but I dont know how to put the hd44780-i2c.c files in lcdproc.

In usr/lib i dont have any lcdproc folder to put the files in.

balbuze,

I have the same I2c extender than you like you said here lcd-i2c-problems-t2863.html

but no way to use it with volumio ! Can you tell me how to fix this ? I’m french like you so you can send me a message in french if you want !

thank’s a lot !

@getdown
As I’m off for some days, I can’t answer now… I’ll try next week :wink:

Hi balbuze,

tried to connect an i2c display using your scripts, but could not succeed so far. It would be great if you could give some more information on how you prepared the RPi, which packages needed to be installed and where and how your scripts get included in the whole thing…

Sorry, I am still a total noob, and after reading dozens of different tutorials in the last days, I am now even more confused, so an end-to-end description would be highly appreciated.

Cheers!

Hi,
The RPI was a B+
I did it several month ago, but in my notes I wrote :


sudo apt-get install python-smbus i2c-tools

sudo apt-get install lcdproc

sudo apt-get install python-mpd

sudo apt-get install python-pip

sudo pip install mpdlcd

wget http://sourceforge.net/projects/raspberry-gpio-python/files/raspbian-wheezy/python-rpi.gpio_0.5.9-1armhf.deb
(you 'll need to modify the version with the one available)
sudo dpkg -i python-rpi.gpio_0.5.8-1_armhf.deb

sudo update-rc.d LCDd defaults

sudo nano /etc/init.d/bootmisc.sh

In /etc/modules
add
i2c_dev

my script are launch by adding the following in /etc/rc.local

python /home/pi/button-rasp.py &
python /home/pi/monip.py
python /home/pi/vol.py &

I have customised some files - see attached file. Remplace originals by it.
I think there is other things to be done…
custom.zip (12 KB)

Hi balbuze,

thanks for your description. I followed all steps, but after everything is done, the display shows only one row of blocks and when trying to connect to mpdlcd, I get the well-known error message:

root@volumio:~# sudo mpdlcd --no-syslog
WARNING mpdlcd Connection failed: [Errno 111] Connection refused
WARNING mpdlcd Connection failed: [Errno 111] Connection refused
WARNING mpdlcd Connection failed: [Errno 111] Connection refused
ERROR mpdlcd Unable to connect to lcdproc localhost:13666.

After installing all files you described, the i2cdetect did not work at first, after adding

dtparam=i2c1=on
dtparam=i2c_arm=on

to the /boot/config.txt file, it is detected on port 0x27.

mpdlcd does not seem to run, so actually the same problem I ran into when trying to connect the LCD without the i2c interface.

Any ideas?

Cheers!

Edit: I will start over again tonight and do a detailled description of all steps I take, maybe this helps in troubleshooting. I’ll post a guide once I finally get this up and running.

Ok, here are the steps I took, I tried to describe as detailled as possible:

Hardware

  1. Connect HifiBerry to P5 header using jumper cables to keep the GPIO pins exposed.
  2. Connect the I2C adapter on the display to following GPIO pins on the RPi:
    GND -> Pin 6
    VCC -> Pin 2
    SDA -> Pin 3
    SCL -> Pin 5

Software

  1. Install Volumio 1.55 to SD-Card using Win32DiskImager
  2. Install HifiBerry driver via Volumio settings menu
  3. sudo apt-get update
  4. sudo apt-get install python-smbus i2c-tools
  5. sudo apt-get install lcdproc (following substeps taken from AndyPi’s tutorial)
    5.1 press “q” during PHP installation
    5.2 Perform automatic configuration upgrade -> Yes
    5.3 php.ini -> Keep the local version currently installed
    5.4 php-fpm.conf -> keep default option “N”
    5.5 www.conf -> keep default option “N”
    5.6 php.ini -> Keep the local version currently installed
  6. sudo apt-get install python-mpd
  7. sudo apt-get install python-pip
  8. sudo pip install mpdlcd
  9. wget http://sourceforge.net/projects/raspberry-gpio-python/files/raspbian-wheezy/python-rpi.gpio_0.5.11-1_armhf.deb
  10. sudo dpkg -i python-rpi.gpio_0.5.11-1_armhf.deb
  11. sudo update-rc.d LCDd defaults
  12. sudo nano /etc/init.d/bootmisc.sh
    12.1 add su pi -c "mpdlcd --no-syslog &" before last colon.
  13. sudo nano /etc/modules
    13.1 add i2c_dev
  14. sudo nano /etc/rc.local
    14.1 add python /home/pi/button-rasp.py & python /home/pi/monip.py python /home/pi/vol.py &
  15. add to /home/pi: button-rasp.py monip.py vol.py as provided in your post.
  16. replace the config files with the files you provided
  17. sudo nano /boot/config.txt
    17.1 add dtparam=i2c1=on dtparam=i2c_arm=on
  18. sudo reboot

During reboot, I already see the warning that mpdlcd connection failed because the connection is refused. Furthermore, there’s another error message: startpar: service(s) returned failure: rc.local… failed!

I checked the file but cannot see what’s wrong with it:

[code]#!/bin/sh -e

rc.local

This script is executed at the end of each multiuser runlevel.

Make sure that the script will “exit 0” on success or any other

value on error.

In order to enable or disable this script just change the execution

bits.

By default this script does nothing.

/var/www/command/player_wdog.sh startup & > /dev/null 2>&1
python /home/pi/button-rasp.py &
python /home/pi/monip.py
python /home/pi/vol.py &
exit 0[/code]

The display only shows blocks in the first row, trying to connect to mpdlcd results in the same “connection refused” message.

This is so weird. Exactly at the same point I get stuck when trying to connect the display without interface… what the hell am I doing wrong? :imp:

Hello,
I remember that I had a problem until I found a other driver for HD44780 because the one provide was not ok.
The problem is that I don’t own anymore this project… :frowning:
But I made a image of the SD. I’ll try to restore it and send you…
edit : have you had a look here https://www.raspberrypi.org/forums/viewtopic.php?f=35&t=63412

That would be so cool! I am struggling with this for months now…