![]() ![]() ![]() ![]() ![]() Alan numitron clock Clapclap 2313/1386 SNES Pi Webserver USB Volume/USB toys Smokey amp Laser cutter WordClock ardReveil v3 SNES Arcade cabinet Game boy projects cameleon Home Presence Detector ![]() AlanFromJapan ![]() ![]() ![]() Akizukidenshi Elec-lab Rand Nerd Tut EEVblog SpritesMods AvrFreaks Gameboy Dev FLOZz' blog Switch-science Sparkfun Suzusho Datasheet Lib Reddit Elec Ermicro Carnet du maker (fr) |
raspi webradio playerLast update: Tue Nov 28 13:28:49 2023
![]() PresentationPrincipleSeems you just need to MPD/MPC to play the web streams, a way to output the sound (I have somewhere an eBay soundcard or default sound output?), a display of what is the current track, and some way to control it (change station at least).Points of interrestImplementationBill of materialsSchematicsMake sound from a raspi zero without soundcardExplained here and here, you need to redirect 2 pins on their alternate pin, and make a small low/high pass filter with resistors and caps.User account "radio" preparationBecause you should never run any non-interactive program with sudoer-rights account (root, pi, ...) so make a separate account that has the minimum necessary rights.
Source code : with VLCVLS is more power hungry but this Raspi will only play radio so... even if it uses 40% CPU, it won't make a difference.
Now it should work, so listen to music with:
vlc your-URL-here -I dummy vlc your-URL-here -I dummy --verbose=2 amixer -D pulse sset Master 85% amixer -D pulse sset Master 7%+ Source code : with MPCMPC/MPD does work, though I used VLC because it's simpler to configure. However as far as I tested the below setup works, you can take it from there and finish. I ended up uninstalling it because mpd was consuming the CPU though I don't use it.
Display screenUsing a small 2.13 inch I2C SSD1306 (address 0x3c) with Adafruit library (for python3):sudo apt-get install python-pip python3-pip sudo python -m pip install --upgrade pip setuptools wheel #doesn't work - unmaintained since 2014 #sudo pip install Adafruit-SSD1306 sudo pip3 install adafruit-circuitpython-ssd1306 sudo python3 -m pip install pillow sudo pip3 install futures #install necessary packages sudo apt-get install python-smbus python3-smbus #to check that you can see the 0x3c on the I2C bus #1 i2cdetect 1Now the Ladyada code should work, however change the samples for my component: Power considerationI'd like to put the raspi zero W in sleep mode when unused to minimize power consumption AND maximize the benefit on start time. There's no real power management on the Raspi HW, so basically you have to cut the power on everything that is unused to save a few watts.Here's a few links I found: /usr/bin/tvservice -o (-p to re-enable) from hereAutostartPulseAudio is giving me a hard time: all workds, except that, meaning no sound. Apparently it doesn't like to run as user-mode and it should run as system-wide as it's the exceptionnal case where it make sense (RTFM).#in rc.local, start as SYSTEM (don't forget to launch on background) pulseaudio --system & #start the app su radio -c /usr/local/src/git/alanarduinotools/Python/WebRadioPlayer/start.sh & ... #users that must access the SYSTEM pulse must be in "pulse-access" group (even root) sudo usermod -a -G pulse-access radio sudo usermod -a -G pulse-access pi sudo usermod -a -G pulse-access rootIt does use more CPU, peaks at 100% at opening of a radio and gets within seconds to its cruising speed ok 30-40% (I talk of the TOTAL CPU consumption of the RPi, all included) Pictures![]() ![]() LinksRadios!Go to the radio site or TuneIn, F12, Network tab and look for a .mp3 or .m3u file. No magical solution apparently.Inspiration |
All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated) electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025]) |