When Adding Noise Helps

It’s a counterintuitive result that you might need to add noise to an input signal to get the full benefits from oversampling in analog to digital conversion. [Paul Allen] steps us through a simple demonstration of why this works on his blog. If you’re curious about oversampling, it’s a good read.

Oversampling helps to reduce quantization noise, which is the sampling equivalent of rounding error. In [Paul’s] one-bit ADC example, the two available output values are zero volts and one volt. Any analog signal between these two values is rounded off to either zero or one, and the resulting difference is the quantization error.

In oversampling, instead of taking the bare minimum number of samples you need you take extra samples and average them together. But as [Paul] demonstrates, this only works if you’ve got enough noise in the system already. If you don’t, you can actually make your output more accurate by adding noise on the input. That’s the counterintuitive bit.

We like the way he’s reduced the example to the absolute minimum. Instead of demonstrating how 16x oversampling can add two bits of resolution to your 10-bit ADC, it’s a lot clearer with the one-bit example.

[Paul’s] demo is great because it makes a strange idea obvious. But it got us just far enough to ask ourselves how much noise is required in the system for oversampling to help in reducing quantization noise. And just how much oversampling is necessary to improve the result by a given number of bits? (The answers are: at least one bit’s worth of noise and 22B, respectively, but we’d love to see this covered intuitively.) We’re waiting for the next installment, or maybe you can try your luck in the comment section.

Digital to Analog to Digital to Analog to Digital Conversion

[Andy] had the idea of turning a mixing desk into a MIDI controller. At first glance, this idea seems extremely practical – mixers are a great way to get a lot of dials and faders in a cheap, compact, and robust enclosure. Exactly how you turn a mixer into a MIDI device is what’s important. This build might not be the most efficient, but it does have the best name ever: digital to analog to digital to analog to digital conversion.

The process starts by generating a sine wave on an Arduino with some direct digital synthesis. A 480 Hz square wave is generated on an ATTiny85. Both of these signals are then fed into a 74LS08 AND gate. According to the schematic [Andy] posted, these signals are going into two different gates, with the other input of the gate pulled high. The output of the gate is then sent through a pair of resistors and combined to the ‘audio out’ signal. [Andy] says this is ‘spine-crawling’ for people who do this professionally. If anyone knows what this part of the circuit actually does, please leave a note in the comments.

The signal from the AND gates is then fed into the mixer and sent out to the analog input of another Arduino. This Arduino converts the audio coming out of the mixer to frequencies using a Fast Hartley Transform. With a binary representation of what’s happening inside the mixer, [Andy] has something that can be converted into MIDI.

[Andy] put up a demo of this circuit working. He’s connected the MIDI out to Abelton and can modify MIDI parameters using an audio mixer. Video of that below if you’re still trying to wrap your head around this one.

Continue reading “Digital to Analog to Digital to Analog to Digital Conversion”

Adding a Battery Gauge to a Project With Zero Parts

The typical way of doing a low battery detector is throwing a comparator in the circuit, setting it to measure a certain threshold voltage, and sending that signal off to a microcontroller or other circuit to notify someone the battery is going dead. [Josh] has a simpler way using an 8-bit AVR and zero other parts.

The chip [Josh] is using is the ATtiny84. The ADC in this chip is usually used to measure an unknown voltage against a reference voltage. The trick [Josh] is using is to do this in reverse: The internal 1.1 Volt reference voltage is measured against an unknown scale, namely the input voltage.

The value provided by the ADC on the chip will always be Vin times 1024 over the reference voltage. Since Vin will be 1.1 V in this case, the ADC value is known, it’s only a matter of doing some 6th grade algebra to determine the value of the input voltage.

[Josh] put together a small demonstration where the chip blinks out the number of volts its receiving from a bench power supply. By blinking a LED, it can blink out the current value of VCC as integers, but by using this technique you should be able to get a fairly fine-grained reading of what VCC actually is. Video below.

Continue reading “Adding a Battery Gauge to a Project With Zero Parts”

Very Large Touchpads for Very Old Computers

Way back when most of our demographic was in diapers, engineering workstations had huge touchscreens for plotting drawings in CAD programs, drawing, and just about everything a Wacom tablet does today. Finding one of these touch pads now is a fool’s errand, more so than finding the computer it was attached to, but [Daniel] figured out a way to relive those days of large touchpads and old computers with a resistive touchscreen and an MSX computer (portuguese, google translatrix).

[Daniel] is using a touchscreen normally used for a monitor, and with the right bit of code on a PIC16F micro, pressure on the touchscreen can be translated into X and Y coordinates. Using the PIC was a great choice in this instance: it’s possible to multiplex ports on an ADC pin with a PIC, making the entire system extremely efficient and easy to calibrate.

After that, it’s just a matter of plugging the output of the microcontroller into the touchpad connector of the MSX and writing a few lines of BASIC to draw a point on the screen. Video below.

Continue reading “Very Large Touchpads for Very Old Computers”

A Hackable Hi-Fi Audio DSP

DSP 01 Hi-fi Signal Processor


Audiophiles tend to put analog systems on a pedestal. Analog systems can provide great audio performance, but they tend to be quite costly. They’re also hard to tinker with, since modifying parameters involves replacing components. To address this, [tshen2] designed the DSP 01.

The DSP 01 is based around the Analog Devices ADAU1701. This DSP chip includes two ADCs for audio input, and four DACs for audio output. These can be controlled by the built in DSP processor core, which has I/O for switches, buttons, and knobs.

[tshen2]’s main goal with the DSP 01 was to implement an audio crossover. This device takes an input audio signal and splits it up based on frequency so that subwoofers get the low frequency components and tweeters get the higher frequency components. This is critical for good audio performance since drivers can only perform well in a certain part of the audio spectrum.

Analog Devices provides SigmaStudio, a free tool that lets you program the DSP using a drag-and-drop interface. By dropping a few components in and programming to EEPROM, the DSP can be easily reconfigured for a variety of applications.

Using Surface Mount Devices On A Breadboard


[Czar] was working on a project with the Raspberry Pi using the MCP3008 analog to digital converter. The surface mount SOIC version of this chip was slightly cheaper, and there’s always a way to make that work (Portuguese, Google Translation). How [Czar] did it is fairly impressive, as it’s a bit more flexible for breadboard designs than a through-hole version, and done correctly, is an extremely sturdy hack.

A few new leads needed to be soldered onto the SOIC package, and for this [Czar] chose jumper wires. This makes each pin easy to plug into a solderless breadboard, and since [Czar] was extremely clever, all the wires for power, ground, analog, and SPI are color coded.

Simply soldering a few jumper wires onto a chip won’t last for very long. To solve this problem, [Czar] potted the entire chip and its connections with hot glue. Probably not the best solution, and a heavy-duty epoxy would have been better, but the current build is more than enough to stand up to the relatively minor abuse it will receive on the workbench.

ADC For Raspi Without Using An ADC

Schematic of ACD for a raspi

With all the amazing and wonderful things a Raspberry Pi can do, it is sorely lacking a dedicated ADC chip. Sure, you can wire up an ADC via SPI or even I2C with a little work, but still. It would be nice to have access to an Analog to Digital converter without having to go through the trouble. Fortunately, [Hussam] has figured out a way to do just this.

Using a comparator, two resistors, a single capacitor and a few lines of code, [Hussam] managed to get an active ADC working on his Raspberry Pi. He’s using the PWM1 and a passive RC filter to make a DAC. He then uses the comparator along with a ‘ successive approximation algorithm’ to complete the ADC.

[Hussam] mentions that the hack is not new, and this technique has been used before for microcrotrollers that lack a built-in ADC. But we are still impressed with his attention to detail in describing how to do this on a Raspi. Be sure to check out the link for full details, code, and an awesome description on how his algorithm works.