OLED spectrum display on Volumio on Raspberry Pi Zero W

I was unable to reproduce the error, but reviewing the code I found a mistake in a check for a valid integer. I have pushed a fix for this. Hopefully it will clear the error you are seeing.

The value that is meant to be an integer is the volume value from the Volumio status. If you are able to retrigger the error, I would be interested to see the Volumio status from following command

curl http://localhost:3000/api/v1/getstate

Thanks

Adrian.

Thank Your.
Now its work fine !

I have made the OLED display program compatible with other players, and renamed it to mpd_oled. The project location is now

github.com/antiprism/mpd_oled

Adrian.

Hi Adrian,

I installed it uncountable times now, each time on a fresh system, different RasPI’s - today i gave the updated system a try.
It is working as expected - the only problem that still comes up is - after about 2 to 4 hours running the display freezes.

I created a cron job that runs every 90 minutes and doing a restart of the display…

sudo systemctl stop mpd_oled sudo systemctl start mpd_oled
but i think this is not the “golden” solution… :wink:

Is there any specific log i could have a look at - or send it to you, that could explain the hog up ?


Another thing:

90% the title is too long to be displayed completely and is cut in the second line.
I guess it could be doable somehow to let this line scroll to show the whole title This would be really great.

Where do i find the screen configuration ?

Thank you for this excellent work - it is really looking great.

  • Josef

Hi Josef

I am pleased it is largely working for you!

I am not sure what is causing the freeze. I have been running the latest mpd_oled code on the latest Volumio since yesterday, and playing some music now the display is working correctly, but I haven’t been playing a lot of music today. I’ll run it for a while playing music tomorrow. I got a second OLED on Thursday and have just set up another player so I will try it with Volumio on that too.

To troubleshoot, when the display is frozen you could: run top and see whether mpd_oled and cava are running, run ls /tmp and see if you can see the FIFOs mpd_oled_fifo and cava_fifo, you could look at the logs less /var/log/volumio.log and `dmesg | less’.

Is it a complete screen freeze, or just the spectrum analyser?

I am not sure what you mean by screen configuration. mpd_oled -h will print the command line options. Or if you want to change the layout, the function that draws all the screen elements is draw_spect_display in main.cpp. The screen elements are like widgets and so it is possible to create alternative screen layouts by modifying this function. I might provide an option for some different layouts. The text widget doesn’t currently support scrolling (I had scrolling on an LCD display and didn’t like it!) but I can look at adding it in, with an option for the scroll speed.

Adrian.

Hi Josef

In testing today, one of the displays froze after eleven hours of playing music. There is nothing of interest in the logs. The freeze is because mpd_oled is no longer running. The most likely explanation is that it has crashed. I will run it from the command line next and see if there is any error message when it stops.

Adrian.

I ran mpd_oled from the command line, and it ran for 18 hours before stopping. Unfortunately there was no error message. I’ll carry out a general review of the code next.

Quick update. I added some extra error handling but the program still failed. I did however see a crash error message relating to incorrect use of dynamically allocated memory.

I reviewed the program code carefully for this, but couldn’t spot an error. I therefore ran mpd_oled in an environment that monitors memory access (valgrind) to see where the problem was occurring. However, 24 hours of playing music later and the program is still running and there are no messages.

In another test I have been running mpd_oled on Moode while playing music. It has now been running 48 hours without any problems.

In a current test, it is possible to specify a replacement memory allocation implementation that is “safer” (works around programming errors) and can also warn about incorrect memory use. I am not seeing any immediate errors with it. I will leave it running to see if the program still stops when using it.

MALLOC_CHECK_=1 sudo ./mpd_oled -o 6 -b 21 -f 25

I will also look at compiling mpd_oled with -fsanitize, which will provide extra diagnostic messages. I will also check if the program fails when it is built with Clang rather than GCC.

Hi Adrian,

I’m happy you are working on the stability as i like it really a lot.

I’m just testing marco79cgn’s 1st version of his “Radio Paradise” plugin, that is working good so far.
Can you imagine why the station and title isn’t passed to the display. (May be this is out of scope currently - but could be you have an idea)
Where do i find the display config ?

Thank you

Josef

Hi Adrian,

me again… I know working on the stability is currently for sure the most important thing.

Just another thing (why i asked for where to find the display config):
The bitrate display seems to be limited to 3 characters while there would be enough space to show a 4th character.
If you play flac this leads to end with 999 if the bitrate gets over 1000kBps.

Also i forget to paste the direct link to Marco’s “Radio Paradise Plugin”:
https://volumio.org/forum/radio-paradise-t9886.html#p48639

Josef

Hi Josef

I can add an extra digit for the kbitrate.

The reason for the missing information with the Radio Paradiso plugin is that it is not available to MPD. Compare the output of the Volumio and MPD status commands

volumio@volumio3:~/proj/mpd_oled$ volumio status { "status": "play", "position": 1, "title": "The Wailin' Jennys - Arlington", "artist": "The Wailin' Jennys", "album": "40 Days", "albumart": "http://img.radioparadise.com/covers/l/B0002IQGMQ.jpg", "uri": "https://apps.radioparadise.com/blocks/chan/0/4/1687836-1687837.flac?src=alexa", "trackType": "flac", "seek": 150715, "duration": 281, "samplerate": "44.1 KHz", "bitdepth": "16 bit", "channels": 2, "random": null, "repeat": null, "repeatSingle": false, "consume": false, "volume": 20, "mute": false, "stream": "flac", "volatile": false, "service": "radio_paradise" }

volumio@volumio3:~/proj/mpd_oled$ mpc status https://apps.radioparadise.com/blocks/chan/0/4/1696274-1696277.flac?src=alexa [playing] #1/1 6:39/14:02 (47%) volume: 40% repeat: off random: off single: off consume: on
I can read the Volumio status, and currently use the volume value from it. However, it is very slow to get a status update when a track changes, generally taking around 7 seconds. The MPD status is always returned quickly, but you can see above that besides the missing titles, it also has a different track length/progress. Maybe the Volumio status slowness is only a Pi Zero issue, and it is quick enough on a regular Pi (I don’t have one to test on). I posted about it here
determine-current-volume-from-t9493.html#p47431
It makes sense to add the Volumio status values back in as an alternative to the MPD values when running on Volumio.

I am currently 10 hours in to tests of the alternative malloc on one machine, and the Clang build on another. Hopefully both displays will still be running in the morning!

Adrian.

Just to note that, testing again now on the latest Volumio the Volumio status response is improved. I can run ‘volumio volume’ repeatedly around 2-4 times per second, and when changing track there are delays ranging 1-4 seconds over around a 10 second period.

You can see the delays by running this command and changing tracks in the Volumio UI (CTRL-C to stop it).

while true; do volumio volume; date; done

Adrian.

Hi Adrian,

I understand. Thank you.
I’m on vacation for some days now and will have a deeper look into it next week.

Josef

Hi Josef

I believe I have found and fixed the bug that was causing the screen to freeze after several hours. With the fix applied, I have been able to play music continuously for 48 hours without any kind of issue.

I also changed to using Volumio status values (when running on on Volumio), which now makes the display compatible with the Radio Paradise plugin. I also added support for the full display of kbitrates with up to 4 digits.

I have uploaded the changes to Github.

Adrian.

Hi Adrian,

Thank you - it is running stable now for more than 22 hours.
And thank you for adding the 4th digit to the bitrate.

i already posted to Marco’s “Radio Pardise” topic because i’m not sure who of you both could fix this:

What i see on the display is:

Interpret
Interpret - title

… where i see the interpret twice what doesn’t make much sense IMHO
should be:


Radio Paradise
Interpret - title

  • Josef

Hi Josef

Marco has put the radio station name as the artist, available in the plugin Github code, which fixes this issue. When I tested I simply overwrote a plugin file, so if you grabbed a zip of the plugin it might not have been be included in the latest zip at that time.

Adrian.

Hi Josef

I uninstalled the old version of the Radio Paradis plugin, and installed the new official version. The artist is reported by ‘volumio status’ (and displayed on the OLED) as “Radio Paradise”

"title": "Ennio Morricone - The Good, The Bad & The Ugly", "artist": "Radio Paradise", "album": "An Hour with Ennio Morricone", ... "service": "radio_paradise"

Adrian.

Hi Adrian,

Yes - it’s working and it’s working really stable now for more than 3 days !!! :smiley:
Also the title and radio station issue with the Radio Paradise plugin is fixed. (Has been an error by me) Thank you and Marco.

The only thing i would wish now is a scrolling “Artist - Title” line as this is nearly always cut off on the small display.
Do you think this would be doable in the future ?


Also i have the “dream” of putting 2 of these displays in line and span the text. (Maybe using the rest of the second display to show other data - temperature, alarm clock time, date, weather forecast, left and right channel of the spectrum analyser separated or whatever…)

I had a closer look at the display (i also own some of the cheap 4 pin SD1106 version types) and found one can change the I2C address by changing a 0-ohm resistor on the back side of these.

I wished i had more time to improve my own coding skills to be more helpful instead of only offering my “dreams”…

Anyway i’m more than happy with what i have now.

Maybe some day there also will be found a volumio developer that is able to build a real plugin around that to make it available to the rest of the community. It’s really looking awesome.

Thank you again for all that effort. Don’t think there are many out there that are able to fix those stability issues the way you did.

  • Josef

Hi Josef

I haven’t forgotten your request! I have just pushed some changes that add scrolling for the station/artist and title fields.

I have implemented the scrolling as: start with a delay, then scroll continuously, adding five spaces between the end of the text before the beginning appears again at the right. The scrolling rate and delay can be specified with option -s. The scrolling rate might be close to the frame rate, and this unfortunately affects affects the smoothness of the scrolling.

There are quite a lot of other changes relating to option processing and reporting generally, and I also changed the timing code to allow more screen updates in the paused state, so it is possible there might be some issues.

I also recently added clearing the screen on shutdown.

Adrian.

Hi Adrian,

That’s really fantastic news. Thank you so much. :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

I will immediately update and test. What value would you recommend for setting the -s parameter if i use an update rate of e.g 20 ?

  • didn’t find an update in the docu regarding that.

Josef