DJ Xiaomi Spins Beats And Brushes At The Same Time

Direct from the “Just Because I Can” department, this blog post by [Eddie Zhang] shows us how easy it is to get the Xiaomi robotic vacuum cleaner working as what might be the world’s most unnecessary Spotify Connect speaker. Will your home be the next to play host to an impromptu performance by DJ Xiaomi? Judging by the audio quality demonstrated in the video after the break, we doubt it. But this trick does give us a fascinating look at the current state of vacuum hacking.

For the first phase of this hack, [Eddie] makes use of Dustcloud, an ongoing project to document and reverse engineer various Xiaomi smart home gadgets. Using the information provided there you can get root-level SSH access to your vacuum cleaner and install your own software. There’s a sentence you never thought you’d read, right?

With the vacuum rooted, [Eddie] then installs a Spotify Connect client intended for the Raspberry Pi. As they’re both ARM devices, the software will run on the Xiaomi bot well enough, but the Linux environment needs a little tweaking. Namely, you need to manually create an Upstart .conf file for the service, as the vacuum doesn’t have systemd installed. There goes another one of those unexpected sentences.

We’re certainly no stranger to robotic vacuum hacking, though historically the iRobot Roomba has been the target platform for such mischief. Other players entering the field can only mean good things for those of us who get a kick out of seeing home appliances pushed outside of their comfort zones.

Continue reading “DJ Xiaomi Spins Beats And Brushes At The Same Time”

Stalking Last.fm Streams On Spotify

Back in the early days of social media and Web 2.0, Last.fm was one of the premier music sites on the internet. With a huge library containing what felt like every song ever, along with an excellent algorithm for recommending new tracks, it quickly gained a large following. Unfortunately, its business model and following changed over the years, but there’s still a diehard userbase. [Hexalyse] was unhappy with Spotify’s algorithms, so built a tool to allow her to shadow what Last.fm users were listening to in real time.

Last.fm’s major feature is that it allows you to tell others what you’re listening to, by “scrobbling” your tracks as you play them. It’s possible to scrape this live data from any user via the Last.fm API, making the project possible. [Hexalyse] whipped up a Python script to query a selected user’s current playing track via Last.fm, before then handing the song data to the Spotify API to play the music locally.

It’s a fun way to find new music, relying on human taste rather than a pile of data center algebra. [Hexalyse] has uploaded the code to Github if you’re eager to try it for yourself. Of course, you get bonus points if you integrate it with Spotify on the Macintosh SE/30.

Giving An Old Mac Spotify

The Macintosh SE/30 is the greatest computer ever made, and I’m not saying that just because I’m sitting on a cache of them, slowly selling them to computer collectors around the world. No, the SE/30 is so great because of how powerful it is, and how much it can be expanded. A case in point: here’s an SE/30 that’s a Spotify player. Oh, it does it over WiFi, too.

You might be asking yourself how a computer from 1989 (it’s late enough in the year that we can safely say this computer is thirty years old) can possibly play music over the Internet. While the SE/30 supported an astonishing 128 Megabytes of RAM, it’s still just a bit too slow to play MP3s or any modern audio codec. The 68030 CPU just wasn’t fast enough to play audio, to say nothing of streaming it over a network connection. The trick is that this SE/30 is simply a remote for Spotify Connect. You could theoretically get the Mac to speak, “Alexa, play Despacito” and get the same functionality, but that’s not fun, is it? You need to do it wirelessly.

This is a continuation of one of [ants] earlier hacks that basically put a WiFi to Ethernet bridge inside an SE/30. Tie that together with a Finder extension and you have System 7, with WiFi. That’s a connection to the Internet, but [ants] actual wrote an app to connect to a Spotify playlist, browse tracks, and display album art in beautiful 1-bit color. Writing the app involved dealing with OAuth, which means the MacPlayer isn’t entirely standalone; some of it must be done on a ‘modern’ device. This, along with porting a conversion utility that translates UTF-8 text encoding into something the Mac can understand ties everything together.

With all those pieces, the SE/30 becomes a handsome, functional piece of art. Apple is never going to release a computer like this again, and you’re not going to find a touchbar MacBook being used like this in thirty years time.

Shoehorning A Slick Spotify Remote Into An ESP8266

In 2017 Spotify finally deprecated their public vanilla C SDK library,  libspotify, and officially replaced it with dedicated SDKs for iOS and Android and this new-fangled web thing we’ve all heard so much about. This is probably great for their maintainability but makes writing a native application for a Linux or a hardware device significantly harder, at least without an application process and NDA. Or is it? Instead of using that boring slab of glass and metal in their pocket [Dani] wanted to build a handy “now playing” display and remote control interface but was constrained by the aforementioned SDK limitations. So they came up with a series of clever optimizations resulting in the clearly-named ESP8266 Spotify Remote Control.

The Spotify Remote Control has a color LCD with a touchscreen. Once attached to a Spotify account it will show the album art of the currently playing track (with a loading indicator!) and let you play/pause/skip tracks from its touch screen, all with impressively low latency. To get here [Dani] faced two major challenges: authorizing the ESP to interact with a user’s Spotify account, and low latency LCD drawing.

2 Bit Cover Art

If you’re not on iOS or Android, the Spotify web API is the remaining non-NDA’d interface available. But it’s really designed to be used on relatively rich platforms such as fully featured web browsers, not an embedded device. To that end, gone are the days of asking a user to enter their username and password in a static login box, the newer (better) way is to negotiate for a per-user token (which is individually authorized per application), then to use that to authenticate your interaction. With this regime 3rd party applications (in this case an ESP8266) never see a user’s password. One codified and very common version of this process is called OAuth and the token dance is called a “workflow”. [Dani] has a pretty good writeup of the process in their post if you want more detail about the theory. After banging out the web requests and exception handling (user declines to authorize the device, etc) the final magic ended up being using mDNS to get the user’s browser to redirect itself to the ESP’s local web server without looking up an IP first. So the setup process is this: the ESP boots and displays a URL to go to, the user navigates there on a WiFi connected device and operates the authorization workflow, then tokens are exchanged and the Remote Control is authorized.

The second problem was smooth drawing. By the ESP’s standards the album art for a given track at full color depth is pretty storage-large, meaning slow transfers to the display and large memory requirements. [Dani] used a few tricks here. The first was to try 2 bit color depth which turned out atrociously (see image above). Eventually the solution became to decompress and draw the album art directly to the screen (instead of a frame buffer) only when the track changed, then redraw the transport controls quickly with 2 bit color. The final problem was that network transfers were also slow, requiring manual timesharing between the download code and the display drawing routing to ensure everything was redrawn frequently.

Check out [Dani]’s video after the break, and take a peek at the sources to try building a Spotify Remote Control yourself.

Continue reading “Shoehorning A Slick Spotify Remote Into An ESP8266”

Framed Raspberry Pi Keeps Tabs On Spotify

Perhaps you’ve noticed, but we here at Hackaday have a slight obsession with the over-engineered. One could fairly say there’s a linear relationship between how likely we are to feature a project and how needlessly complex it is. That said, it isn’t as if we are unable to appreciate a minimalist approach. Taking the scenic route can be a lot of fun, but sometimes it’s nice to just get where you’re going before you run out of gas.

This very slick Spotify “Now Playing” display created by [Jon Ashcroft] is a perfect example of that principle. The hardware is so straightforward that it’s barely worth mentioning: a Raspberry Pi with a small HDMI display, tucked neatly into a photo frame. Nothing to get too excited about there. The real hook with this particular project is the software.

[Jon] is a web developer by trade, so it’s natural he would approach his personal projects with that same mentality. Rather than one of the “usual suspects” for a Pi project like Python, he wrote his software in ES6; which the Pi is running through Chromium in kiosk mode (full screen web content, no top bar). For those of you who aren’t keeping up on web languages, ES6 is short for EcmaScript 6: a new version of the standard on which JavaScript is based. It’s a bit heavier on resources than is strictly necessary, but it works well enough in the end.

Using Spotify’s excellent API, his software pulls down the current track information and stores it locally. It does this every ~4 seconds, checking to see if the track has changed. [Jon] isn’t thrilled with this brute force method, but it works for now. It displays the current playing song and artist, and uses a library called node-vibrant to extract a dominant color from the album art and use that to create a complementary background color. Very slick.

[Jon] provides all of his source code and made it easy to connect to your own Spotify account, so don’t be surprised if you see this running on a “Magic Mirror” near you soon.

Retro-Styled Raspberry Pi Radio

Ok, so you want a radio — but not just any radio. It has to be wireless, access a variety of music services, and must have a vintage aesthetic that belies its modern innards. Oh, and a tiny screen that displays album art, because that’s always awesome. This 1938 Emerson AX212-inspired radio delivers.

Building on the backbone of a Raspberry Pi Zero W and an Adafruit MAX 98357 mono amp chip, the crux of this single-speaker radio is the program Mopidy. Mopidy is a music player that enables streaming from multiple services, with the stipulation that you have a premium Spotify account. Once signed up, [Tinkernut] helpfully outlines how to set up Mopidy to run automatically once the Pi boots up. The addition of a screen to display album art adds flair to the design,  and Adafruit’s 1.8″ TFT LCD screen is small enough to fit the bill.

But wait — there’s more!

Continue reading “Retro-Styled Raspberry Pi Radio”

Boombox Doorjam Plays Your Theme Song When You Step In The Ring

Although many of us may have had childhood aspirations to be a famous wrestler in the WWE, not very many of us will ever realize those dreams. You can get close, though, if you have your own epic intro music theme that plays anytime you walk into a room. Although it’s not quite the same as entering a wrestling ring, [Matt]’s latest project will have you feeling just as good whenever you enter a room to your own theme song.

The core of the build consists of a boom box with an auxiliary input. The boom box is fed sound via a Raspberry Pi which also serves as the control center for the rest of the project. It runs Node.js and receives commands via websockets from a publicly accessible control server. The Pi is also running Spotify which allows a user to select a theme song, and whenever that user’s iBeacon is within range, the Pi will play that theme song over the stereo.

The project looks like it would be easy to adapt to any other stereo if you’re looking to build your own. Most of the instructions and code you’ll need are available on the project’s website, too. And, if you’re a fan of music playing whenever you open a door of some sort, this unique project is clearly the gold standard. It might even make Stone Cold Steve Austin jealous.