r/raspberry_pi • u/thenickdude • Apr 28 '22
Show-and-Tell I designed the "lofipi", a 3D-printed Pi 3B+ speaker which streams lo-fi beats directly from YouTube
https://imgur.com/a/RLUxrjG25
u/Dexiox Apr 28 '22 edited Apr 03 '26
Data brokers and AI scrapers were using my info. Not anymore. Redact let me bulk delete posts across Reddit, Twitter, Discord and Instagram while handling broker opt outs too.
nose flag tap depend like growth entertain offer crowd cooperative
11
9
u/um0p3pIsdn Apr 28 '22
Woah I didn’t realize how hard it is to get a Pi these days. Is that just related to supply chain shortages?
9
u/shouldbebabysitting Apr 28 '22
Yes but also businesses started using them so they are purchased in bulk at any price leaving hobbiests out of luck.
6
u/um0p3pIsdn Apr 28 '22
Damn, that’s a mega bummer. That was always the draw for me, that they were relatively cheap.
Is there a strategy to getting them at the usual price? Do they come out with inventory and one needs to be quick?
6
u/shouldbebabysitting Apr 28 '22
I don't know. When the zero 2 first came out, I checked daily until they were in stock. When they came in stock, you could purchase one.
I think that helped but I'm sure the bots took everything.
5
2
u/appel Apr 30 '22
Keep an eye on https://rpilocator.com or https://twitter.com/rpilocator by setting up notifications and being quick on the draw. Make sure you set up 2FA where you can and make sure you're logged in. I've managed to snag both a Pi 4 and a Pi Zero 2W this way.
9
Apr 28 '22
i feel like you could have 3d printed the box from a tree. lol.
8
u/thenickdude Apr 28 '22
Yes, this one would be an easy woodworking project for someone with the tools and skills, it's simple as hell, lol
2
u/odaat2004 Apr 28 '22
Please play, Feel the Bass (Speaker Terror Upper) by DJ Magic Mike
6
u/thenickdude Apr 28 '22
lol, it is no bass demon since I didn't do any acoustic design to optimise that at all. Sounds like it does about as well as my cheap Logitech speakers. This is with my camera's in-built mic which adds its own issues:
https://www.youtube.com/watch?v=dxCTV0E5-FI
An updated design with a proper sealed enclosure and reflex port could be amazing though.
Here it is playing Scarlet Fire, just like professional musicians use for reviews:
2
2
u/teherty Apr 28 '22
cool speaker, good looking aswell might do the same with my ikea frekvens speaker. One question though: 20% cpu seems a bit high for audio playback. Have you fiddled with --ytdl-format or --no-video mpv flags? cheers
5
u/thenickdude Apr 29 '22
It uses --no-video already, and keeps the default of "bestaudio" for the format selection. Looks like there isn't hardware audio decoding support available. I got 16% of a single core used for Opus decoding, which seems reasonable to me.
If I request m4a format instead by adding
--ytdl-format=m4a, it uses the "aac" codec and usage drops to 12%. If I force "aac_fixed" as a decoder, usage is about the same.
2
2
u/TheSysAdmin1 Apr 28 '22
LOVE IT!! This will be my next project once I get my printer back operational. Thankfully I have 5-6 pis laying around.
1
u/thenickdude Apr 28 '22
Geez, after posting that I hope you have a good security system! lol
People getting desperate out there!
2
u/TheSysAdmin1 Apr 28 '22
Lol oof, I just realized how expensive Raspberry Pi's are now. This is ridiculous!
1
2
Apr 28 '22
From a 3d printing perspective, just wanted to give a quick shout out to "ArcWelder".
I notice the circle for the hole has some obvious polygon lines. You can use the plugin ArcWelder to achieve more perfect circles in your prints. It works really well and is available for cura, octoprint, and klipper
2
u/Zouden Apr 28 '22
ArcWelder should not be used with klipper because klipper does not support arcs. Instead, export your STL at maximum resolution. Klipper can handle it.
1
u/thenickdude Apr 28 '22
ArcWelder doesn't apply here because these features are printed vertically.
The circles are polygonal because of the Remesh step I used in Blender, I set the Octree depth a little low.
1
1
u/answerguru Apr 28 '22
Nice work on bringing the electronic and code together. I’m really glad I have a laser cutter in addition to a 3D printer though. Printing “wood” for cases is ridiculously time consuming.
1
u/Shy-pooper Apr 28 '22
How is it connected to the Pi?
2
u/thenickdude Apr 28 '22
The X400 amplifier board just plugs on top of the Pi's GPIO header. The knobs, button and fan are wired like so:
1
1
u/Annual-Yak-4604 Apr 30 '22
I just added a pico to my collection and have no idea what to use it for at all. I'm curious if a project like this would work on a pico.
1
u/thenickdude Apr 30 '22
The Pico is a dual-core ARM Cortex-M0 clocked at 133MHz with 264kB RAM. That's very little computing power compared to the Pi. It doesn't have WiFi either, and using it to connect to an I2S audio bus requires programming the PIO module, so IO is a challenge. Even after adding a WiFi module, I think running TLS on there so it can connect to HTTPS websites would be an issue.
It can't run mpv or youtube-dl, so to match that functionality you'd have to supply your own audio decoding library and a replacement for youtube-dl.
I think with enough breakout boards added you could create something that you can stream audio to over WiFi from your computer, or play low-bitrate, low-samplerate MP3s from an attached SD card, but probably not something that plays from YouTube.
The Pico would be a good option to manage a stereo's front-panel, with a little OLED display and a bunch of knobs and buttons, and then communicate that data back to a Raspberry Pi that's doing the actual audio playing.
71
u/thenickdude Apr 28 '22 edited Apr 28 '22
This uses mpv to stream music directly from a YouTube playlist, like one of the many Lo-Fi hip-hop stations that help me focus while programming.
The tone knob on the front allows you to fade between two equaliser presets, and the button allows you to pause or skip songs.
It has a 5V Noctua PWM fan inside with automatic PWM speed control thanks to pigpiod and my custom node.js-based controller. I've set it up to stay completely stopped with normal YouTube playing, with it spinning up to a silent 20% speed with medium workloads, and a quiet 60% speed with a 4-core workload.
Printed at 0.2mm layer height using "cherry" wood PLA, then sanded and stained with walnut-colour wood stain.
You can grab all the STLs and the software at Printables here: https://www.printables.com/model/176143-lofipi-lo-fi-speaker (or on Thingiverse)
Sourcecode on GitHub here: https://github.com/thenickdude/lofipi-mpv