Bit-Banging The USB-PD Protocol

For one-off projects, adding a few integrated circuits to a PCB is not too big of a deal. The price of transistors is extremely low thanks to Moore and his laws, so we’re fairly free to throw chips around like peanuts. But for extremely space-constrained projects, huge production runs, or for engineering challenges, every bit of PCB real estate counts. [g3gg0] falls into the latter group, and this project aims to remove the dedicated USB-PD module from a lighting project and instead bit-bang the protocol with the ESP32 already on the board.

The modern USB power delivery (PD) protocol isn’t quite as simple as older USB ports that simply present a 5V source to whatever plugs itself into the port. But with the added complexity we get a lot more capability including different voltages and greater power handling capabilities. The first step with the PD protocol is to communicate with a power source, which requires a 1.2V 600kHz signal. Just generating the signal is challenging enough, but the data encoding for USB requires level changes to encode bits rather than voltage levels directly. With that handled, the program can then move on to encoding packets and sending them out over the bus.

After everything is said and done, [g3gg0] has a piece of software that lets the ESP32 request voltages from a power supply, sniff and log PD communication, and inject commands with vendor defined messages (VDM), all without needing to use something like a CH224K chip which would normally offload the USB-PD tasks. For anyone looking to save PCB space for whatever reason, this could be a valuable starting point. To see some more capabilities of the protocol, check out this USB-PD power supply that can deliver 2 kW.

Cassette Tape Plays MP3s

Cassette tapes were a major way of listening to (and recording) music througout the 1980s and 1990s and were in every hi-fi stereo, boom box, and passenger vehicle of the era. Their decline was largely as a result of improvements in CD technology and the rise of the MP3 player, and as a result we live in a world largely absent of this once-ubiquitous technology. There are still a few places where these devices crop up, and thanks to some modern technology their capabilities as a music playback device can be greatly enhanced.

The build starts, as one might expect, by disassembling the cassette and removing the magnetic tape from the plastic casing. With the interior of the cassette empty it’s capable of holding a small battery, USB-C battery charger, and a Bluetooth module. The head of an old tape deck can be wired to the audio output of the Bluetooth module and then put back in place in the housing in place of the old tape. With the cassette casing reassembled, there’s nothing left to do but pair it to a smartphone or other music-playing device and push play on the nearest tape deck.

As smartphones continue to lose their 3.5 mm headphone jacks, builds like this can keep lots of older stereos relevant and usable again, including for those of us still driving older vehicles that have functioning tape decks. Of course, if you’re driving a classic antique auto with a tape technology even older than the compact cassette, there are still a few Bluetooth-enabled options for you as well.

Continue reading “Cassette Tape Plays MP3s”

Atari 65XE In Laptop Form

For better or worse, Atari is no longer a household name in computing, but for a time in the 1980s, it was a huge mover in the industry. They not only produced PCs but also a huge number of video game consoles. Although they were a major contributor to the video game crash of the 1980s, they managed to limp along a few more years afterward and produce some interesting machines in the following years, even though they weren’t ultimately able to compete with Nintendo or Sega. One of those computers from that era was a PC-console hybrid of sorts called the Atari XE, and [Sideburn] was able to turn one into a laptop.

The retro laptop began life as an Arabic PAL version of the 65XE, the PC version of the ubiquitous 65-series computer. A large portion of the computer was reworked, including the removal of the power supply in favor of a rechargeable battery with a 6-hour life. Also among the list of scrapped components was the video and sound connectors as well as the RF modulator, which would have been common for displays at the time, but this laptop is getting a 1920×1080 LCD panel to replace all of that old hardware. A 1MB memory upgrade, new speakers and amp, a WiFi card, and an SD floppy card emulator round out the build.

The final part of the build is assembling it all into a custom 3D printed case, and the resulting laptop that [Sideburn] calls the XE Book is a faithful adaptation of this niche computer into what could have been a laptop we would have seen in the late 80s or early 90s similar to the Toshiba T3200SXC. It matches the original’s footprint and still uses all of the core components, so it’s not too difficult to imagine something like this having existed in the past.

Continue reading “Atari 65XE In Laptop Form”

E-Bike Motor Gets New Life As Hydro Plant

For economic reasons, not every lake with a dam can support a hydroelectric power plant. Some rivers or creeks are dammed for flood control or simply for recreation, and don’t have the flow rate or aren’t deep enough to make the investment of a grid-scale generation facility worthwhile. But for those of us with a few spare parts around and access to a small lake, sometimes it’s possible to generate a usable amount of energy with just a bit of effort.

[Beyond the Tint] is building this mostly as a proof-of-concept, starting with a 1,000W hub motor from an e-bike that’s been removed from its wheel. A 3D-printed waterwheel attachment is installed in its place, and the fixed shaft is attached to a homemade ladder-looking mechanism that allows the entire generator to be lowered into the flow of a moving body of water, in this case, a small stream. A bridge rectifier converts the AC from the hub motor (now a generator) into DC, and after a few measurements and trials, [Beyond the Tint] produced over 30W with the first prototype.

A second prototype was made with feedback from the first video he produced, this time with an enclosed paddlewheel. This didn’t appear to make much difference at first, but a more refined impeller may make a difference in future prototypes. Small-scale hydropower is a fairly popular challenge to tackle, especially in the off-grid community. With access to even a small flowing stream and enough elevation change, it’s possible to build something like this generator out of parts from an old washing machine.

Continue reading “E-Bike Motor Gets New Life As Hydro Plant”

Button Debouncing With Smart Interrupts

Debouncing button or switch inputs on microcontrollers can be a challenging problem for those first starting to program these devices. Part of the reason for this difficulty is that real-world buttons don’t behave like the idealized textbook components we first learn about, and therefore need special consideration to operate like one would expect. There are simple ways to debounce inputs like adding a delay after a button is pressed, but for more efficient use of computer resources as well as adding some other capabilities to inputs you might want to look at this interrupt service routine (ISR) method from [Lee] aka [stockvu].

The strategy with this debounce method is not simply to use a single ISR for the button input, but to activate a second timer-based ISR at that time that runs at a certain interval which timestamps any button press and checks the amount of time the button has been active. If it’s under a certain threshold the ISR assumes it’s caused by bounce and blocks the bounce. If the timestamp ages past another longer threshold it knows the button has been released. This method allows on-the-fly adaptation between long button presses and rapid button presses and is capable of debouncing both types.

For those wanting to try this out, [stockyu] has included some example Arduino code for others to use. It’s an interesting take on a solution for a common problem, and puts very little load on the microcontroller. There are about as many ways to debounce inputs as there are microcontroller platforms, though, and you can even use a 555 timer to get this job done which frees up 100% of the microcontroller’s CPU.

Math On A Checkerboard

The word “algorithm” can sometimes seem like a word designed to scare people away from math classes, much like the words “calculus”, “Fourier transform”, or “engineering exam”. But in reality it’s just a method for solving a specific problem, and we use them all the time whether or not we realize it. Taking a deep dive into some of the ways we solve problems, especially math problems, often leads to some surprising consequences as well like this set of algorithms for performing various calculations using nothing but a checkerboard.

This is actually a demonstration of a method called location arithmetic first described by [John Napier] in 1617. It breaks numbers into their binary equivalent and then uses those representations to perform multiplication, division, or to take the square root. Each operation is performed by sliding markers around the board to form certain shapes as required by the algorithms; with the shapes created the result can be viewed directly. This method solves a number of problems with other methods of performing math by hand, eliminating other methods like trial-and-error. The video’s creator [Wrath of Math] demonstrates all of these capabilities and the proper method of performing the algorithms in the video linked below as well.

While not a “hack” in the traditional sense, it’s important to be aware of algorithms like this as they can inform a lot of the way the world works on a fundamental level. Taking that knowledge into another arena like computer programming can often yield some interesting results. One famous example is the magic number found in the code for the video game Quake, but we’ve also seen algorithms like this used to create art as well.

Continue reading “Math On A Checkerboard”

Custom Firmware Adds Capabilities To Handie Talkie

Although ham radio can be an engaging, rewarding hobby, it does have a certain reputation for being popular among those who would fit in well at gated Florida communities where the preferred mode of transportation is the golf cart. For radio manufacturers this can be a boon, as this group tends to have a lot of money and not demand many new features in their technology. But for those of us who skew a bit younger, there are a few radios with custom firmware available that can add a lot of extra capabilities.

The new firmware is developed by [NicSure] for the Tidradio TD-H3 and TD-H8 models and also includes a browser-based utility for flashing it to the radio without having to install any other utilities. Once installed, users of these handheld radios will get extras like an improved S-meter and detection and display of CTCSS tones for repeater usage. There’s also a programmer available that allows the radio’s memory channels to be programmed easily from a computer and a remote terminal of sorts that allows the radio to be operated from the computer.

One of the latest firmware upgrades also includes a feature called Ultra Graph which is a live display of the activity on a selected frequency viewable on a computer screen. With a radio like this and its upgraded firmware, a lot of the capabilities of radios that sell for hundreds of dollars more can be used on a much more inexpensive handheld. All of this is possible thanks to an on-board USB-C interface which is another feature surprisingly resisted by other manufacturers even just for charging the batteries.

Continue reading “Custom Firmware Adds Capabilities To Handie Talkie”