Two Pins for the Price of One

One of the most common problems in the world of microcontrollers is running out of resources. Sometimes it’s memory, where the code must be pared down to fit into the flash on the microcontroller. Other times, as [Fabien] found out when he ran out of pins, the limitations are entirely physical. Not one to give up, he managed to solve the problem by using one pin for two tasks. (Google Translate from French)
During a recent project, [Fabien] realized he had forgotten to add a piezo buzzer to his project. All of the other pins were in use, though, so his goal was to use one of the input pins to handle button presses but to occasionally switch to output mode when the piezo buzzer was needed. After all, the button is only used at certain times, and the microcontroller pin sits unused otherwise. After a few trials, he has a working solution that manages to neither burn out itself nor the components in the circuit, and none of the components interfere with the other’s normal operation.
While it isn’t the most technically advanced thing we’ve ever seen here, it is a great example of using the tools at your disposal to elegantly solve a problem. More than that, though, it’s a thorough look into the details of pull-up and pull-down resistors, how microcontrollers see voltage as logic levels, and how other pieces of hardware interact with microcontrollers of all different types. This is definitely worth a read, especially if you are a beginner in this world.

AVR External Memory Interface (XMEM) reads input matrix

Reading from a large number of inputs, like this piano keyboard, can be tedious. Even when multiplexing there’s a lot to keep track of. But if you choose the right microcontroller, you may have hardware assistance. Here’s an ATmega640 is using it’s external memory interface to read the key matrix.

You may remember the Open Music Labs article about reading from a shift register using just one pin of a microcontroller. This time around a shift register is still used, but instead of pulling in a long line of parallel inputs, the switches are multiplexed to reduce the number of I/O pins used to read them.

A 74HC573 is used to facilitate the multiplexing. We won’t go into how that part is accomplished; there’s a separate post that explains the process. What’s unique here is that the XMEM peripheral of the AVR microcontroller is used to grab the data. This is intended for external memory chips, but if you get the timing just right, it greatly simplifies reading in a matrix of up to 128 inputs.

Reading inputs from shift registers using just one single pin

Here’s an interesting article about reading data from shift registers using less than three pins. 74HC165 shift registers are a popular choice for adding inputs to a microcontroller. They have a parallel input register which can be read using the latch, then shifted into a microcontroller via the data and clock pins. For those counting, that’s the three pins normally associated with driving these devices.

This hack first does away with the latch pin. The addition of a carefully trimmed RC circuit (capacitor is charged by the clock pin, then the resistor lets that cap slowly discharge) means that the device will not latch until after the clock stops toggling. This technique drops the control down to just two pins (data and clock). You can still use hardware SPI to read the data using this method. It’s the same as using SPI to drive 595 shift registers except the microcontroller reads data instead of writing it.

But wait, there’s more! The diagram above actually shows a way of reading this shift register with just one pin. Notice that the clock and data pins are now connected to just one of the microcontroller pins. The data pin has an added resistor, which keeps the current low enough that it will not compete with the clock signal coming from the microcontroller. In between clock pulses, the microcontroller switches from output to input to read the data pin on each cycle. Give it a try, it’s a fun experiment!

Adding an external audio input to the Sansa Clip+


Workshop 88 member [Jim] got his hands on a couple of SanDisk Sansa Clip+ MP3 recorder/players from Woot, and was anxious to see what he could do with them.

The first order of business was to install RockBox, an open source hardware package built for a wide range of MP3 players. He was impressed with how robust the firmware was, though he thought the Sansa’s built-in microphone could use a bit of upgrading. Acting on a tip from a fellow square dance enthusiast, he disassembled one to see how he might add an external audio input.

He pried the existing mic apart, and desoldered it from the motherboard, installing a small capacitor and resistor in its place. He extended some wires through the case, then powered up the unit to make sure it was still alive and well. Since things still looked good, [Jim] put some audio on the Sansa’s new inputs and sure enough it recorded the audio without a hitch.

He says that his initial guesses for the capacitor and resistor values were pretty decent, though with a bit of tweaking he should be able to get exactly the recording levels he was looking for. Not bad for a $20 audio recorder!

Add external MIC input for Samsung HMX-T10 videocamera

[Kalin] loved the picture from his new Samsung HMX-T10 camcorder, but the sound quality didn’t match up. Since it records video that can be directly imported to his editing suite of choice he didn’t want to just buy a different model, so he cracked it open and added an external mic input.

As with most consumer electronics these days, the hardest part of the hack is getting the thing apart and assembling it without any damage. [Kalin] had to get down to the bare circuit board to get to the audio input connections. He soldered up some shielded extension wire to an audio jack, then made some space in the case by cutting a bit of the plastic structure before finally gluing it in place. Details are a bit scarce, but it looks like he wired up the jack along with a couple of switches. We’d wager this still lets him use the stock microphone if he doesn’t feel like hauling around extra gear.

Experimental music iPad dock

You can buy nice audio breakout equipment for your iPod if you don’t mind breaking the bank. This is partly because the demand is not incredibly high so commercial breakout hardware doesn’t benefit from volume discounts. But it’s also because Apple charges licensing fees for third-party accessories (often referred to as the “Apple Tax”). [Reed Ghazala] decided to side-step the whole situation by building his own accessory which he calls the iPad Audio Desk.

It all starts with a breakout board. The PodBreakout Mini provides an easy to solder interface for the iPad, and ensures that the repetitive act of plugging and unplugging the connection doesn’t break a solder connection. From there [Reed’s] enclosure finishing skills take over. The shape and curve of the aluminum sheet give the look befitting an expensive tablet device. Along the back you can see the jacks for line-in, line-out, video, mic/guitar, and headphones that make the dock useful. It wouldn’t be hard to make one… but it might be hard to make one look this great. See for yourself after the break.

Continue reading “Experimental music iPad dock”

Mixed I/O testing module

Needing to test the display interface for a multitude of different sensors [Fileark] built himself this analog and digital input/output simulator. Along the bottom is a double row of trimpots that adjust analog voltages. Each voltage is measured by the Arduino inside and its value is displayed on the graphic LCD screen to confirm that the hardware you’re testing is making correct measurements. There’s also digital I/O in two different forms. To the upper left are momentary push buttons but the DIP switch bank below that allows the same connections to be toggled on and off. It’s not an automated test bed, but if you’ve got a lot of I/O, or a lot of hardware to test this will save you some real time.

Don’t miss the demonstration video after the break.

Continue reading “Mixed I/O testing module”