A vintage pocket calculator with extra exposed circuitry added

I2C Breathes New Life Into Casio Pocket Calculator

When is a pocket calculator more than just a calculator? [Andrew Menadue] has been pushing the limits of his 1970s Casio FX-502P by adding all sorts of modern functionality via the calculator’s expansion port.

Several older Casio calculators included an expansion port for connecting cassette tape storage and printing functionality. Data on the FX-502P could be saved on cassette tape using the well-known Kansas City standard, however this signal was produced by Casio’s FA-1 calculator cradle, not the FX-502P itself. To interact with the calculator itself would require an understanding of whatever protocol Casio designed for this particular model.

It turns out that the protocol is a little quirky compared to its contemporaries, with variable length data packets and inverted data logic, (zero volts is ‘1’ and three volts is ‘0’). Once the protocol was untangled, it was ‘simply’ a matter of connecting the calculator to the GPIO interface on the STM32, and using some software wizardry to start shooting data packets back and forth.

This hack can be used to send and receive data from an SD card (via a RAM buffer), however it’s the other expansion capabilities that really make us wonder. [Andrew] has demonstrated how easy it is to add a real-time clock or thermal printer. Using the I2C capabilities of the STM32, it’s likely that all sorts of gadgets and sensors could be coupled with this vintage calculator, and many others like it.

You can find even more details about this hack over here, including some follow up videos to the original hack. No stranger to vintage calculators, we last featured [Andrew] after he retrofitted a modern LCD display to an old Casio. It’s charming to see how these calculators are far from obsolete.

Continue reading “I2C Breathes New Life Into Casio Pocket Calculator”

You Can Send MIDI Over I2C If You Really Need To

The Musical Instrument Digital Interface has a great acronym that is both nice to say and cleanly descriptive. The standard for talking to musical instruments relies on a serial signal at 31250 bps, which makes it easy to transmit using any old microcontroller UART with a settable baud rate. However, [Kevin] has dived into explore the utility of sending MIDI signals over I2C instead.

With a bit of hacking at the Arduino MIDI library, [Kevin] was able to get the microcontroller outputting MIDI data over the I2C interface, and developed a useful generic I2C MIDI transport for the platform. His first tests involved using this technique in concert with Gravity dual UART modules. After he successfully got one running, [Kevin] realised that four could be hooked up to a single Arduino, giving it 8 serial UARTS, or, in another way of thinking, 8 MIDI outputs.

At its greatest level of development, [Kevin] shows off his I2C MIDI chops by getting a single Raspberry Pi Pico delivering MIDI signals to 8 Arduinos, all over I2C. All the Arduinos are daisy-chained with their 5V and I2C lines wired together, and the system basically swaps out traditional MIDI channels for I2C addresses instead.

There’s not a whole lot of obvious killer applications for this, but if you want to send MIDI data to a bunch of microcontrollers, you might find it easier daisy-chaining I2C rather than hopping around with a serial line in the classic MIDI-IN/MIDI-THRU fashion.

We’ve seen [Kevin]’s work before too, like the wonderful Lo-Fi Orchestra. Video after the break.

Continue reading “You Can Send MIDI Over I2C If You Really Need To”

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?”

I2C To The Max With ATtiny

The Arduino is a powerful platform for interfacing with the real world, but it isn’t without limits. One of those hard limits, even for the Arduino MEGA, is a finite number of pins that the microcontroller can use to interface with the real world. If you’re looking to extend the platform’s reach in one of your own projects, though, there are a couple of options available. This project from [Bill] shows us one of those options by using the ATtiny85 to offload some of an Arduino’s tasks using I2C.

I2C has been around since the early 80s as a way for microcontrollers to communicate with each other using a minimum of hardware. All that is needed is to connect the I2C pins of the microcontrollers and provide each with power. This project uses an Arduino as the controller and an arbitrary number of smaller ATtiny85 microcontrollers as targets. Communicating with the smaller device allows the Arduino to focus on more processor-intensive tasks while giving the simpler tasks to the ATtiny. It also greatly simplifies wiring for projects that may be distributed across a distance. [Bill] also standardizes the build with a custom development board for the ATtiny that can also double as a shield for the Arduino, allowing him to easily expand and modify his projects without too much extra soldering.

Using I2C might not be the most novel of innovations, but making it easy to use is certainly a valuable tool to add to the toolbox when limited on GPIO or by other physical constraints. To that end, [Bill] also includes code for an example project that simplifies the setup of one of these devices on the software end as well. If you’re looking for some examples for what to do with I2C, take a look at this thermometer that communicates with I2C or this project which uses multiple sensors daisy-chained together.

Continue reading “I2C To The Max With ATtiny”

Low-Cost Computer Gesture Control With An I2C Sensor

Controlling your computer with a wave of the hand seems like something from science fiction, and for good reason. From Minority Report to Iron Man, we’ve seen plenty of famous actors controlling their high-tech computer systems by wildly gesticulating in the air. Meanwhile, we’re all stuck using keyboards and mice like a bunch of chumps.

But it doesn’t have to be that way. As [Norbert Zare] demonstrates in his latest project, you can actually achieve some fairly impressive gesture control on your computer using a $10 USD PAJ7620U2 sensor. Well not just the sensor, of course. You need some way to convert the output from the I2C-enabled sensor into something your computer will understand, which is where the microcontroller comes in.

Looking through the provided source code, you can see just how easy it is to talk to the PAJ7620U2. With nothing more exotic than a switch case statement, [Norbert] is able to pick up on the gesture flags coming from the sensor. From there, it’s just a matter of using the Arduino Keyboard library to fire off the appropriate keycodes. If you’re looking to recreate this we’d go with a microcontroller that supports native USB, but technically this could be done on pretty much any Arduino. In fact, in this case he’s actually using the ATtiny85-based Digispark.

This actually isn’t the first time we’ve seen somebody use a similar sensor to pull off low-cost gesture control, but so far, none of these projects have really taken off. It seems like it works well enough in the video after the break, but looks can be deceiving. Have any Hackaday readers actually tried to use one of these modules for their day-to-day futuristic computing?

Continue reading “Low-Cost Computer Gesture Control With An I2C Sensor”

Robust I2C And SPI In Space Thanks To Bus Isolation

Imagine you’re sending a piece of hardware to space on a satellite. Unless you’re buddy-buddy with NASA, it’s pretty unlikely you’ll ever be able to head up there and fix something if it goes wrong once it’s launched. Robust design is key, so that even in the event of a failure in one component, the rest of the hardware can keep working.

The example I2C isolation circuit from [Max’s] paper. The SPI implementation is even simpler.
[Max Holliday] found himself in this exact situation, running 69 I2C and SPI devices in a single satellite. Thus, he came up with circuits to auto-isolate devices from these buses in the event of an issue. That work is the subject of a research paper now available on the TechRxiv Preprint Server.

The problem is that these simple buses aren’t always the most robust, being vulnerable to single-point failures where one bad part takes down other parts of the bus. [Max] notes that vast numbers of sensors and devices rely on these standards, and it can be difficult or prohibitively expensive to design without them, so a solution was needed.

To fix this, [Max] developed a simple external circuit that could be placed on each node of a I2C or SPI communication bus. In the event of malfunction, that node can be cut off from the bus by this circuit, allowing the rest of the system to go on functioning.

With little more than a few transistors, MOSFETs and passives, you too could protect your buses from malfunctions using these techniques. [Max] did just that on the NASA V-R3x mission which flew successfully in January 2021 if you needed any further confirmation of the value of this technique.

It’s something that won’t bother the home hobbyist building a garage door opener, but it could be of great value to those designing systems that must fail gracefully if they fail at all. Be sure to share your best tips and tricks for robust SPI and I2C buses in the comments below!

I2C Paper Tape Reader Is Not What You Think

We’re not quite sure what drove the development of this project, but [shapoco] has put together an intriguing device that reads I2C signals (Japanese Twitter link) which have been printed as black and white rectangles on paper tape. He wrote a program that prints an I2C byte stream onto strips containing the SCL and SDA signal patterns. Once printed, you cut the strips from the paper and glue them together into one long piece, making a complete message — in this case, commands to a small LCD screen that will display the phrase “Hello, Tape I2C”.

We’re not sure exactly sure what’s inside that rectangular widget epoxied to the bottom of that perf board through which the tape passes. But clearly, it must contain a pair of LEDs to illuminate the tape and a pair of sensors to detect the reflection off the tape (looking at the wiring, it seems unlikely that anything is mounted underneath the tape). According to one machine-translated Twitter message, detection is done using a Schmitt trigger made from an LM393 comparator with hysteresis (see this TI app note for a review of this type of circuit). Here’s a scope capture of the resulting signals. [Shapoco] notes that the circuit can operate much faster — the tape is being pulled slowly in the video to make it easier to see.

This is not [shapoco]’s first experiment in optical I2C communications. Check out the second video down below where he’s reading I2C signals from a computer’s display. One person tweeted about how software source code was sometimes printed optically in old Byte magazines many years ago, a topic we talked about in Hackaday Podcast #049 last year when discussing Cauzin strips.

Besides just being cool, and possibly helpful as an educational device, does this technique have any real-world applications these days? Let us know your thoughts in the comment section below. Thanks to [Manawyrm] for sending us this tip.

Continue reading “I2C Paper Tape Reader Is Not What You Think”