ESP32 Becomes Music Player In Under 40 Lines Of Code

The demo code for [XTronical]’s ESP32-based SD card music player is not even 40 lines long, though it will also require a few economical parts before it all works. Nevertheless, making a microcontroller play MP3s (and other formats) from an SD card is considerably simpler today than it was years ago.

Part of what makes this all work is I2S (Inter-IC Sound), a format for communicating PCM audio data between devices. Besides the ESP32, at the heart of it all is an SD card reader breakout board and the MAX98357A, which can be thought of as a combination I2S decoder and Class D amplifier. The ESP32 reads audio files from the SD card and uses an I2S audio library to send the I2S data stream to the MAX98357A (or two of them for stereo.) From there it is decoded automatically and audio gets pumped though attached speakers.

A few economical components, and only a handful of connections between them.

It’s amazing how much easier audio is to work with when one can take advantage of shuffling audio data around digitally, and the decoder handles multiple formats with an amplifier built in. You can see [XTronical]’s ESP32 player in action in the video embedded below.

Continue reading “ESP32 Becomes Music Player In Under 40 Lines Of Code”

Thermal Actuators: Hydraulic Motors That Feed On Temperature Changes

These Fluid Displacement Thermal Actuators designed by [Andrew Benson] are a delightful and profoundly different approach to the Power Harvesting Challenge portion of The Hackaday Prize. While most projects were focused on electrical power, [Andrew]’s design is essentially a mechanical motor that harnesses the fact that Phase Change Materials (PCMs) change volume when they go from liquid to solid or vice-versa; that property is used to provide a useful hydraulic force. In short, it’s a linear actuator that retracts and expands as the PCM freezes or melts. By choosing a material with melting and freezing temperatures that are convenient for the operating environment, an actuator can be reliably operated virtually for free. A proof of concept is the device shown here; a model of a sun-shade that deploys when a certain temperature is reached and retracts when it has cooled.

Sunshade concept, from deployed (top) to retracted (bottom).

Turning temperature changes into useful physical work is the principle behind things like wax motors and even some self-winding clocks, but what [Andrew] has done is devise a useful method of interfacing directly to the fluids; abstracting away the materials themselves in order to provide mechanical power on the other end. These devices, in general, may not be particularly efficient but they have very few moving parts, are astonishingly reliable, and can operate at virtually any scale. [Andrew] has been thinking big, many of his application ideas are architectural in nature.

[Andrew] was inspired to enter his design for The Hackaday Prize, and we’re glad he did because it was selected as one of the finalists in the Power Harvesting Challenge, and will be in the running for the $50,000 Grand Prize. If you also have an idea waiting for an opportunity to shine, now is the time. The Human-Computer Interface Challenge is up next, followed by the Musical Instrument Challenge. All you really need to enter is a documented concept, so sharpen your pencils and give your idea a shot at reaching the next level.

A Blissful Microwave

[Tim] had a problem with his microwave. The buzzer was exceptionally annoying, and once his hot pockets or pizza rolls were done, the buzzer wouldn’t shut off. A two-kilohertz tone infected his soul. It was the only sound echoing in a Boschian nightmare of reheated frozen food.

Unlike an existential ennui, an annoying buzzer in a microwave is something anyone can fix. [Tim] just took a pair of pliers to the buzzer and ripped it off the PCB. This left him with another problem — how to tell when his food was done. This was solved by putting the Windows XP startup sound in his microwave.

With the buzzer out of the way, [Tim] took an Arduino nano and loaded it up with the Windows XP startup sound. There isn’t much Flash on the Arduino, but it could hold an 18kB sample, enough to play the startup sound at 8kHz. The sound itself is PCM audio and easily stuffed into a sketch.

The Arduino listens for the 2kHz tone generated by the microwave and sends the XP startup sound through a tiny class D amplifier. After mounting a speaker inside the microwave, [Tim] has a very vaporwavemicrowave.

Continue reading “A Blissful Microwave”

4-Bit Audio Output Via Voltage Reference

[Bruce Land] switched his microprocessor programming class over from Atmel parts to Microchip’s PIC32 series, and that means that he’s got a slightly different set of peripherals to play with. One thing that both chips lack, however is a digital-to-analog converter (DAC). Or do they? (Dun-dun-dun-duuuuhnnnn!)

The PIC part has a programmable, sixteen-level voltage reference. And what is a Vref if not a calibrated DAC? With that in mind, [Bruce] took to documenting its performance and starting to push it far beyond the manufacturer’s intentions. Turns out that the Vref has around 200 kHz of bandwidth. (Who would update a voltage reference 200,000 times per second?)

Anyway, [Bruce] being [Bruce], he noticed that the bits weren’t changing very often in anything more than the least significant bit: audio waveforms, sampled fast enough, are fairly continuous. This suggests using a differential PCM encoding, which knocks the bitrate down by 50% and saves a lot on storage. (Links to all the code for this experiment is inline with his writeup.)

The audio hacks that come out of [Bruce]’s Cornell ECE classes are always a treat. From the lock that you have to sing to open, to chiptunes programmed into an FPGA, there’s something for music fans of all inclinations.

A Slew Of Open-Source Synthesizers

Hackaday reader [Jan Ostman] has been making microcontroller-based DIY synthesizers for quite a while now. Recently, he’s opened up the source for a lot of them so that you can play along at home. All of these virtual-analog synths and soundmakers can be realized on an Arduino or AVR ATmega328 if you happen to have one lying around.

Extra parts like a keyboard, some pushbuttons, or some potentiometer knobs to twiddle won’t hurt if you’d like to make something more permanent or more obviously playable, like [Jan] does. On the other hand, if you’d just like to get your feet wet, I’ve tweaked his code to be more immediately plug-and-play. The code is straightforward enough that it’s a good learning platform. So let’s take a quick tour through three drum machines and a string synth, each of which you can build on a breadboard in just a few minutes.

To install on an Arduino UNO, fetch the zip file from this GitHub repository, and move each subfolder to your Arduino sketch directory. You’re ready to play along.

Continue reading “A Slew Of Open-Source Synthesizers”

Worlds Collide: Hot Rodders And Hackers

When we think of the average hot rodder, we think of guys and gals that love anything on four wheels. They’re good with hand tools, fabrication and know the ins and outs of the internal combustion engine. Their tools of the trade are welders, grinders and boxed-end wrenches. But their knowledge of electric circuits doesn’t go beyond wiring up a 12 volt DC tail light. On the surface, the role of a hot rodder would seem quite different from that of a hardware hacker. But if you abstract what they do, you find that they take machines and modify their design to make them do something more than they were originally designed to do. When viewed in this light, hot rodders are hackers.
Continue reading “Worlds Collide: Hot Rodders And Hackers”

Hacked Apartment Intercom Barks At You Or Buzzes You In

Forgot your apartment keys? If you’ve got a ritzy building with a doorman, no problem. If your digs are a little more modest, you might only have an intercom panel that calls up to your apartment so someone can buzz you in. But if nobody is home, you’re out of luck. That’s why [Paweł] spent an hour whipping up an intercom connected automation system pack full of goodies.

entryphoneThe design is pretty simple – an ATMega328P to snoop on the analog phone ringer in the apartment when the intercom call button is pushed, and a relay wired in parallel with the door switch to buzz him in. For added security, the microcontroller detects the pattern of button presses and prevents unwanted guests from accessing the lobby. Things got really fun when [Paweł] added a PCM audio module to play random audio clips through the intercom. As you can see in the video below, an incorrect code might result in a barking dog or a verbal put-down. But [Paweł] earns extra points for including the Super Mario Bros sound clip and for the mashup of the “Imperial March” with “The Girl from Ipanema”.

True, we’ve seen a slightly more polished but less [Mario] version of this project before, but the presentation of this particular hack has us grinning from ear to ear.

Continue reading “Hacked Apartment Intercom Barks At You Or Buzzes You In”