Playing Audio On The Pi Pico With No DAC To Speak Of

Normally, if you want to play music or other audio on a microcontroller, you need to get yourself a DAC. Or at least, that’s the easiest way to go about it and the one most likely to get you good, intelligible audio. You don’t have to go that way, though, as [antirez] demonstrates.

[antirez] decided to do this with a Pi Pico, but it’s applicable to other microcontrollers too. It’s all done with a single pin and a PWM output. The PWM output is set to a very high frequency beyond human hearing. In this case, it was 100 KHz. Then, the duty cycle of the PWM is changed to essentially output various average voltage levels at the pin. Vary the output voltage as per your desired sound file by using each sample to vary the duty cycle of the PWM. Voila! You can output whatever sound you want on that pin! [antirez] steps through the basics of doing this, including processing simple WAV files into a raw format that can be dumped into MicroPython code.

There’s no sound sample on the project page, and we’d have to assume it sounds pretty crunchy when hooked up to a speaker. And yet, it could prove a useful technique if you’re designing your own audio greeting cards or something, so keep that in mind!

Sketchy Logg Dogg Logging Robot Remote Control Hacking

When we last left [Wes] amidst the torn-open guts of his Logg Dogg logging robot, he had managed to revitalize the engine and dug into the hydraulics, but one big obstacle remained: the lack of the remote control unit. In today’s installment of the Logg Dogg series, [Wes] summarizes weeks of agony over creating a custom circuit based around a microcontroller, a joystick and a lot of relays and other bits and pieces to drive the solenoids inside the logging machine that control the hydraulics.

Giving the remote controller a bench test before connecting to the logging robot (Credit: Watch Wes Work)

Most of the struggle was actually with the firmware, as it had to not only control the usual on/off solenoids, but also a number of proportional solenoid valves which control things like the track speed by varying the hydraulic flow to the final drives.

This requires a PWM signal, which [Wes] generated using two MOSFETs in a closed-feedback system, probably because open loop controls with multi-ton hydraulic machinery are not the kind of excitement most people look forward to.

Ultimately he did get it sorted, and was able to take the Logg Dogg for its first walk since being rescued from a barn, which both parties seemed to rather enjoy. The background details of this machine and the project can be found in our first coverage.

We’re looking anxiously forward to the next episode, where the controller goes wireless and the sketchiness gets dialed down some more.

Continue reading “Sketchy Logg Dogg Logging Robot Remote Control Hacking”

Pico-Sized Ham Radio

There are plenty of hobbies around with huge price tags, and ham radio can certainly be one of them. Experienced hams might have radios that cost thousands of dollars, with huge, steerable antennas on masts that can be similarly priced. But there’s also a side to the hobby that throws all of this out of the window in favor of the simplest, lowest-cost radios and antennas that still can get the job done. Software-defined radio (SDR) turned this practice up to 11 as well, and this radio module uses almost nothing more than a microcontroller to get on the air.

The design uses the capabilities of the Raspberry Pi Pico to handle almost all of the radio’s capabilities. The RF oscillator is driven by one of the Pico’s programmable I/O (PIO) pins, which takes some load off of the processor. For AM and SSB, where amplitude needs to be controlled as well, a PWM signal is generated on another PIO which is then mixed with the RF oscillator using an analog multiplexer. The design also includes a microphone with a preamplifier which can be fed into a third PIO; alternatively it can receive audio from a computer via the USB interface. More processor resources are needed when generating phase-modulated signals like RF, but the Pico is still quite capable of doing all of these tasks without jitter larger than a clock cycle.

Of course this only outputs a signal with a few milliwatts of power, so for making any useful radio contacts with this circuit an amplifier is almost certainly needed. With the heavy lifting done by the Pico, though, the amplifier doesn’t need to be complicated or expensive. While the design is simple and low-cost, it’s not the simplest radio possible. This transmitter sends out radio waves using only a single transistor but you will be limited to Morse code only.

Continue reading “Pico-Sized Ham Radio”

Spying On The ESP32’s GPIO

The ESP32 has been a go-to microcontroller platform for a while now, thanks to its versatile capabilities, integrated Wi-Fi and Bluetooth connectivity, and low power consumption. It’s ideal for a wide range of projects especially those revolving around IoT, partially because of all of the libraries and tools available for it now. The latest tool from [The Last Outpost Workshop] adds a feature we didn’t know we wanted until now: a webserver showing real-time updates of what all of the GPIO pins are doing.

The live GPIO pin monitoring library sets up the ESP32 to stream information about what all of the pins are doing in real time to a webserver, which displays the information as a helpful graphic. The demonstration in the video below shows and example troubleshooting a situation where the code is correct but there’s a mistake in the wiring, helping to quickly identify the problem and hopefully eliminating a wild goose chase for a bug in the software. The library can be quickly installed using the Arduino IDE and only requires the use of one other library and a few lines of code to get everything up and running.

As far as a debugging tool goes, something like this could save a lot of us a significant amount of time, especially with how easy it is to set up. A real-time look into the pins and their behavior, including those set up for PWM, is invaluable for plenty of situations. Of course if you’re building something like a real-time operating system that needs responses within a very specific interval you may want to look at more in-depth strategies for probing the GPIO.

Thanks to [Bob] for the tip!

Continue reading “Spying On The ESP32’s GPIO”

Bigfoot Turns Classic Sewing Machine Into A Leather-Eating Monster

If you try to sew leather on a standard consumer-grade machine, more often than not you’ll quickly learn its limits. Most machines are built for speed, and trying to get them to punch through heavy material at the low motor speeds often needed for leather work is a lesson in frustration.

How frustrating? Enough so that [Joseph Eoff] expended considerable effort to create this sewing machine speed controller for his nearly century-old Adler sewing machine. The machine was once powered by a foot treadle, which is probably why the project is dubbed “Bigfoot,” but now uses a 230 V universal motor. Such motors don’t deliver much torque when run at low speeds with the standard foot-pedal rheostat control, so [Joseph] worked up an Arduino-based controller with a tachometer for feedback and a high-power PWM driver for the motor.

There are a ton of details in [Joseph]’s post and even more in the original blog article, which is well worth a read, but a couple really stand out. The first is with the tachometer, which uses an off-the-shelf photointerrupter and slotted disc. [Joseph] was displeased with the sensor’s asymmetrical and unreliable output, so he made some modifications to the onboard comparator to square up the signal. Also interesting is the PID loop auto-tuning function he programmed into Bigfoot; press a button and the controller automatically ramps the motor speed up and down and stores the coefficients in memory. Nice!

The short video below shows Bigfoot in action with varying thicknesses of faux leather; there are also some clips in the original article that show the machine dealing with a triple thickness of leather at slow speed and not even breaking a sweat. Hats off to [Joseph] on a solid build that keeps a classic machine in the game. And if you want to get into the textile arts but don’t know where to start, we’ve got you covered.

Continue reading “Bigfoot Turns Classic Sewing Machine Into A Leather-Eating Monster”

Simple Circuit Keeps Process Control Loops In Tune

Spare a moment’s pity for the process engineer, whose job it is to keep industrial automation running no matter what. These poor souls seem to be forever on call, fielding panicked requests to come to the factory floor whenever the line goes down. Day or night, weekends, vacations, whatever — when it breaks, the process engineer jumps.

The pressures of such a gig can be enormous, and seem to have weighed on [Tom Goff] enough that he spent a weekend building a junk bin analog signal generator to replace a loop calibrator that he misplaced. Two process control signaling schemes were to be supported — the 0 to 10 VDC analog signal, and the venerable 4-20 mA current loop. All that’s needed for both outputs is an Arduino and an LM358 dual op-amp, plus a few support components. The 0-10 V signal starts as a PWM output from the Arduino, with its 0-5 V average amplified by one of the op-amps set up as a non-inverting amp with a gain of 2. With a little filtering, the voltage output is pretty stable, and swings nicely through the desired range — see the video below for that.

The current loop output is only slightly more complicated. An identical circuit on a separate Arduino output generates the same 10 V max output, but a code change limits the low end of the range to 1 V. This output of the op-amp is fed through a 500-Ω trimmer pot, and the magic of Ohm’s Law results in a 4-20 mA current. The circuit lives on a piece of perf board in a small enclosure and does the job it was built for — nothing fancy needed.

And spoiler alert: [Tom] found the missing loop calibrator — after he built this, of course. Isn’t that always the way?

Continue reading “Simple Circuit Keeps Process Control Loops In Tune”

Hackaday Prize 2023: 10 KW Electronic Load

[tinfever] needed a high-power benchtop electronic load for an upcoming project, and by their own admission decided foolishly to build their own. And we’re glad they did. The thing is, whilst this isn’t exactly a super-cheap project to build, buying a commercial offering with a capability of 10 kW and up to 30 kW pulsed, is going to cost an absolute fortune.

A selection of small resistors

Built inside a cubic frame using what appears to be standard 2020 aluminum rails and fixturing, the modular construction is nice and clean, with plenty of space around the load boards to allow the cooling air to circulate.

The operating principle is very simple; custom PCBs act in parallel to provide any load needed, by switching in the on-board load resistor. Each load board handles all the details of switching and dumping the power due to the inductance in the system wiring and the wire-wound resistors themselves.

Whilst we know that wire-wound resistors are reverse-wound to minimize inductance, there will still be some, and each load board will contribute a little more when the whole system is scaled up. Also, each load PCB handles its own temperature sensing, and current measurement passing these data off to the control PCB. A front-end connector PCB provides a variety of connection options to interface to the DUT (Device Under Test.) The system controller is based around an STM32 processor which deals with quite a lot more than you might think is needed on a first look.

The sense currents from each load need to be sensed, scaled, and summed to keep the overall load accuracy within the 1% spec. Also, it is on duty for PWM control of the cooling fans, handling the user interface, and any other remote connectivity. There are a lot of details on the project page, as we’re only skimming the surface here. If you’re interested in building an active load, this is a project you really should be digging into.

We shall watch with interest for when [tinfever] scales up this eight-slot prototype to the full specification of 52 stages! When working with power applications, there comes a point when you really need an electronic load, and to that end, here’s one with a very specific use case to get you started.

There is also the option of buying something cheap from the usual sources and hacking on some custom firmware to adapt it a little to your needs.