Yes, I did it too - created a web radio and music player with the Raspberry Pi! It works pretty well with the little Pi. What is special about my variant, you can read here.
- Play MP3
- ID tag display
- Level meter
- NAS access
- Web radio
Meanwhile, the small device has quite a lot of features. But until then it was a long way. It started about 2 years ago.
The first version is already 2 years old and will not be used anymore. It was the classic setup that can be found almost everywhere on the net:
A 16x2 display, multiple buttons, as a media player in the background mpc / mpd and a Raspberry Pi 1.
Since my children work more and more in the hobby workshop in the cellar (the location of the player), I needed a simpler service. There was also a new requirement: they wanted to listen to their radio play CD's, like the Three Investigators.
That's why I have chosen other hardware. It should be a 3.5" display. The operation via the keys remained the same, but with new functions.
- Raspberry Pi 2 B +
- 3.5" LCD display for plugging in to the GPIO ports
- 4 buttons for operations
- NAS connection for the MP3 files and PC speakers
As an extension and simplification, there was now a scroll-down menu with functions for radio, file selection for MP3 files and settings. The MP3 player already showed the ID3 tags with the stored pictures from the MP3 files.
As a programming language I chose Lazarus for the first time on the Raspberry. Lazarus is still passable on a Raspberry Pi 2 - but it's not fun! Information on Lazarus on the Raspberry can be found at the bottom of the blog under Links.
Lazarus offers almost the same support for GPIO pins as Python for the Raspberry. But it can play its strengths in graphic programming much better. For me Lazarus has one of the fastest IDE's for designing forms and surfaces.
The "Version Two" was already quite a hit with us and is still running in the hobby cellar. But as my son has gotten his first stereo system, he wanted the same for his room.
The 3.5" screen was also too small for us, so I took a deep breath and ordered for 75 EUR the 7" display of the Raspberry Pi Foundation. For the display, my son then built himself a small housing next to the stereo system.
Then I had a look at the player software.
The software had to be completely redesigned, because with the chic touch display, we didn't want a tedious operation via push buttons anymore. In addition, some features should be added.
Some special requests:
- Wallpapers and colors (that was really the most important thing!)
- A clock in the radio, Ö3 style (Austrian radio station) should be integrated
- Weather information should be displayed
Lazarus itself is almost sufficient in the basic installation. I have integrated the following free extensions (packages):
- BASS library for MP3 and web radio
- Functions for the ID tag
And this is the current result: Our TACTbox is connected to the stereo system via audio-in.
In the gallery you will find some impressions of the touch version of the software with Lazarus.
The cool thing about Lazarus as a programming language in this case is that the same source code can run on many operating systems.
With it I was able to program high-performance under Windows and then transferred it to the Raspberry and only compile there.
As long as no GPIO pins are used, I have now as a bonus the player software under Windows, because it works perfectly on a PC or Windows tablet.
Of course, the development continues. The second device is already in my daughter's room. This time with a few additional LED effects and integrated speakers.
And there are plenty of other ideas.
To be continued…
Sorry the source code isn't ready to be publish. But I think in 4 weeks it will. So stop by later in this project.
- Website of the Lazarus Project http://www.lazarus-ide.org/
- All about the Raspberry with Lazarus at http://wiki.freepascal.org/Lazarus_on_Raspberry_Pi
- BASS Library for Lazarus at http://www.un4seen.com/
- ID tag tools at http://www.gausi.de/mp3fileutils.html
- Blog article Weather for Lazarus
- PS: Wenn Sie diesen Artikel in Deutsch lesen möchten, schauen Sie auf techpluscode.de.