A pinout diagram of the new Pi 4, showing all the alternate interfaces available.

Did You Know That The Raspberry Pi 4 Has More SPI, I2C, UART Ports?

We’ve gotten used to the GPIO-available functions of Raspberry Pi computers remaining largely the same over the years, which is why it might have flown a little bit under the radar: the Raspberry Pi 4 has six SPI controllers, six I2C controllers, and six UARTs – all on its 40-pin header. You can’t make use of all of these at once, but with up to four different connections wired to a single pin you can carve out a pretty powerful combination of peripherals for your next robotics, automation or cat herding project.

The datasheet for these peripherals is pleasant to go through, with all the register maps nicely laid out – even if you don’t plan to work with the register mappings yourself, the maintainers of your preferred hardware enablement libraries will have an easier time! And, of course, these peripherals are present on the Compute Module 4, too. It might feel like such a deluge of interfaces is excessive, however, it lets you achieve some pretty cool stuff that wouldn’t be possible otherwise.

Having multiple I2C interfaces helps deal with various I2C-specific problems, such as address conflicts, throughput issues, and mixing devices that support different maximum speeds, which means you no longer need fancy mux chips to run five low-resolution Melexis thermal camera sensors at once. (Oh, and the I2C clock stretching bug has been fixed!) SPI interfaces are used for devices with high bandwidth, and with a few separate SPI ports, you could run multiple relatively high-resolution displays at once, No-Nixie Nixie clock style.

As for UARTs, the Raspberry Pi’s one-and-a-half UART interface has long been an issue in robotics and home automation applications. With a slew of devices like radio receivers/transmitters, LIDARs and resilient RS485 multi-drop interfaces available in UART form, it’s nice that you no longer have to sacrifice Bluetooth or a debug console to get some fancy sensors wired up to your robot’s brain. You can enable up to six UARTs. Continue reading “Did You Know That The Raspberry Pi 4 Has More SPI, I2C, UART Ports?”

Turn On Sarcasm With The Flip Of A Switch

Sarcasm is notoriously difficult to distinguish in online communities. So much, in fact, that a famous internet rule called Poe’s Law is named after the phenomenon. To adapt, users have adopted several methods for indicating implied sarcasm such as the /s tag, but more recently a more obvious sarcasm indicator has appeared that involves random capitalization througout the sarcastic phrase. While this looks much more satisfying than other methods, it is a little cumbersome to type unless you have this sarcasm converter for your keyboard.

The device, built by [Ben S], is based around two Raspberry Pi Pico development boards and sits between a computer and any standard USB keyboard. The first Pi accepts the USB connection from the keyboard and reads all of the inputs before sending what it reads to the second Pi over UART. If the “SaRcAsM” button is pressed, the input text stream is converted to sarcasm by toggling the caps lock key after every keystroke.

For communicating in today’s online world with rapidly changing memes, a device like this is almost necessary for making sure you aren’t misunderstood on whichever popular forum you like to frequent. We don’t know how long this trend will continue, either, but until something else replaces it to more concisely communicate sarcasm we expect it to remain relevant. The build is also a reminder of the various interesting ways that microcontrollers can be programmed to act as keyboards.

Thanks to [ted yapo] for the tip!

Reverse Engineering A Topfield VFD Front Panel

Hackers love the warm glow of a vacuum fluorescent display (VFD), and there’s no shortage of dead consumer electronics from which they can be pulled to keep our collective parts bins nicely stocked. Unfortunately, figuring out how to actually drive these salvaged modules can be tricky. But thanks to the efforts of [Lauri Pirttiaho], we now have a wealth of information about a VFD-equipped front panel used in several models of Topfield personal video recorders.

The board in question is powered by a Hynix HMS99C52S microcontroller and includes five buttons, a small four character 14-segment display, a larger eight character field, and an array of media-playback related icons. There’s also a real-time clock module onboard, as well as an IR receiver. [Lauri] tells us this same board is used in at least a half-dozen Topfield models, which should make it relatively easy to track one down.

After determining what goes where in the 6-pin connector that links the module with the recorder, a bit of poking with a logic analyzer revealed that they communicate over UART. With the commands decoded, [Lauri] was able to write a simple Python tool that lets you drive the front panel with nothing more exotic than a USB-to-serial adapter. Though keep in mind, you’ll need to provide 17 VDC on the appropriate pin of the connector to fire up the VFD.

What’s that? You don’t need the whole front panel, and just want to pull the VFD itself off the board? Not a problem. Our man [Lauri] was kind enough to document how data is passed from the Hynix microcontroller to the display itself; critical information should you want to liberate the screen from its PVR trappings.

If you manage to get your hands on one of these modules, it would be an ideal addition to a custom media streamer. Though we suppose simply turning it into a network-controlled clock would be a suitable alternative if you’re looking for something a bit easier.

Continue reading “Reverse Engineering A Topfield VFD Front Panel”

Digital Audio For Microcontrollers Doesn’t Come Much Simpler Than A WART

Adding an audio channel to your microcontroller project can mean a pile of extra components and a ton of processing power, as a compressed stream must be retrieved and sent to a dedicated DAC. Or if you are [rdpoor], it can mean hooking up a low-pass filter to the UART that’s present on even the simplest of devices, and constructing a serial data stream that mimics PWM audio.

Sound on your microcontroller, it’s this simple!

WART is a Python script that converts a WAV file into a C formatted byte array that can be baked into your microcontroller code, and for which playback is as simple as streaming it to the UART. The example uses a Teensy and a transistor to drive a small speaker, we’re guessing that better quality might come with using a dedicated low-pass filter rather than relying on the speaker itself, but at least audio doesn’t come any simpler.

The code can be found in a GitHub repository and there’s a few recordings of the output in the files section Hackaday.io page, one is embedded below. It’s better than we might have expected given that the quality won’t be the best at the PWM data rate of even the fastest UART. But even if you won’t be incorporating it into your music system any time soon we can see it being a useful addition for such things as small warning sounds. Meanwhile if persuading serially driven speakers to talk is of interest, there’s always the venerable PC speaker.

Continue reading “Digital Audio For Microcontrollers Doesn’t Come Much Simpler Than A WART”

Hacking A Solar Inverter RF Interface

One of the main advantages of cheap wireless modules is that they get used in consumer electronics, so if you know what’s being used you can build your own compatible hardware. While investigating the RF interface used in a series of cheap “smart” solar inverters [Aaron Christophel], created an Arduino library to receive inverter telemetry using a $2 RF module. See the demonstration after the break.

[Aaron] bought the inverter and ~40 euro USB “Data Box” that allows the user to wirelessly monitor the status of the inverter. Upon opening the two units, he found that they used LC12S 2.4Ghz modules, which create a wireless UART link. With a bit of reverse engineering, he was able to figure out the settings for the RF modules and the serial commands required to request the status of the inverter. He doesn’t delve into the possible security implications, but there doesn’t appear to be any form of encryption in the link. It should be possible for anyone with a module to sniff the messages, extract the ID of the inverter, and hijack the link. Just knowing the status of the inverter shouldn’t be all that dangerous, but he doesn’t mention what other commands can be sent to the module. Any others could have more severe implications.

Sniffing the wireless signal flashing through the air around us is a regular topic here on Hackaday. From testing the security of WiFi networks with an ESP32 to monitoring SpaceX launches with an SDR, the possibilities are infinite.

Continue reading “Hacking A Solar Inverter RF Interface”

Python Runs Through A Zombified 8-Bit AVR

As amazing as CircuitPython is, it hasn’t yet been ported to any 8-bit microcontrollers. [Chris Heo] was unsatisfied with his inability to use Python on his 8-bit ATmega4808 AVR, so he worked out a way to zombify it and bend it to his will using Python on his PC.

The trick to making this all work is the UPDI interface: a single-wire UART interface for programming and debugging Microchip’s newer 8-bit AVR microcontrollers. UPDI reaches deep into the microcontroller’s core, allowing you to stop and start execution of microcontroller code and access all of the onboard data and I/O. [Chris] realized this could be used to stop execution of any code running on the AVR and directly control the output pins using the pyupdi library. Since UPDI lets him modify the AVR’s I/O registers, he was also able to blink an LED and use the microcontrollers UART to send a message back to his PC without compiling a single line of code.

This may seem like an entirely unnecessary hack, but for devices too small or basic to have a JTAG interface for debugging this could be the best way to test and debug peripherals in an assembled circuit. We hope this catches on and would love to see how much of the chip can be controlled in this way. Maybe this will make it easy to experiment with the programmable logic that’s on some of the newer AVRs.

Minimal UART Computer

[Carsten] spent over a year developing a small CPU system, implementing his own minimalist instruction set entirely in TTL logic. The system uses a serial terminal interface for all I/O, hence the term UART in the title. [Carsten] began building this computer on multiple breadboards, which quickly got out of hand.

He moved the design over to a PCB, but he was still restless. This latest revision replaces EEPROM with cheaper and easier to use CMOS Flash chips, and the OS gains a small file system manager. As he says in the video, his enemy is feature creep.

Tetris on the UART Computer

In addition to designing this CPU project, [Carsten] built an assembler and wrote a substantial operating system and various demo programs and games. He not only learned KiCAD to make this board, but also taught himself to use an auto-router. The KiCAD design, Gerbers, and BOM are all provided in his repository above. ROM images and source code are provided, as well as a Windows cross-assembler. But wait – there’s more. He also wrote a cycle exact emulator of the CPU, which, as he rightfully brags, comes in at under 250 lines of C++ code. This whole project is an amazing undertaking and represents a lot of good work. We hope he will eventually release the assembler project as well, in case others want to take on the challenge of building it to run under Linux or MacOS. Despite this, the documentation of the Minimal UART Computer is excellent.

[Carsten] claims the project has finally passed the finish line of his design requirements, but we wonder, will he really stop here? Do check out his YouTube channel for further informative videos. And thanks to [Bruce] for sending in the tip.

Continue reading “Minimal UART Computer”