8-Channel ADC For The Raspberry Pi

The Raspberry Pi is a powerful embedded computing platform. However, for all its Linux-based muscle, it lacks one thing that even the simplest 8-bit microcontrollers usually have – analog-to-digital conversion. There are a great many ways to rectify this shortcoming, and [Chris Burgess] has brought us another – with an 8-channel ADC for the Raspberry Pi.

For the ADC, [Chris] chose the MCP3008, for its low cost and availability. In this configuration it offers 10-bit resolution and a maximum sampling rate of 200 kilosamples per second. Adafruit has a great guide on working with the MCP3008, too. With such a useful resource to hand, [Chris] was able to spin up a PCB to interface the chip to the Raspberry Pi using SPI. [Chris] took care to try to make the board to the official HAT specifications. As far as the physical aspects go, the board is to spec, however [Chris] omitted the EEPROM required for auto-configuration purposes. That said, the pads are on the board if someone wants to take the initiative to install one.

It’s a tidy build that provides something sorely missing from the Raspberry Pi, for a reasonable cost. [Chris]’s goal was to build something that would enable the measurement of analog sensors for a robot project; we’d love to hear your ideas for potential uses in the comments!

STM32 Analog Converter Phase Noise

[Avian] has been using STM32 ARM processors to sample RF for a variety of applications. At first, he was receiving relatively wide TV signals. Recently, though, he’s started dealing with very narrow signals and he found that his samples had a lot of spread in the frequency domain that he didn’t expect.

What followed was some detective work that resulted in a determination that phase noise was the culprit. But why? [Avian] took some measurements and noticed that the phase noise almost exactly matched the phase noise specification for the STM32’s phase locked loop (PLL).

Unfortunately, there didn’t seem to be a good way to avoid using the PLL without major changes to the rest of the circuit. However, it was quite the learning experience and something to be aware of when counting on built-in converters for high-accuracy measurements.

One of the best things about this post is the references to more information. There’s a great explanation of phase noise, as well as a specific application note about clock jitter and analog converters.

We’ve talked about phase noise in direct digital synthesis a few times. But usually, it is pretty obvious like when you are asking a CPU to double as an RF transmitter. [Avian’s] post was a bit more of a detective story.

Hackaday Prize Entry: High Speed Sampling For The Raspberry Pi

The Raspberry Pi has become a firm favorite in our community for its array of GPIOs and other interfaces, as well as its affordable computing power. Unfortunately though despite those many pins, there is a glaring omission in its interfacing capabilities. It lacks an analogue-to-digital converter, so analog inputs have to rely on an expansion card either on those GPIOs or through the USB port.

Most people remain content with simple ADCs such as Microchip’s MCP3008, or perhaps a USB sound card for low frequency moving targets. But not [Kelu124], he’s set his sights on something much faster. The original Pi is reputed to be capable of handling a 10Msamples/s ADC, so he thinks its faster successors should be able to work much faster. To that end, he’s created an ADC pHAT which he thinks should be good for twice that figure.

The choice of silicon is a CA3306E, a 6-bit device that’s rated at 15Msamples/S. It’s something of a dated device as is shown by its DIP package, and a quick look through major suppliers shows it to be no longer available. Happily though, when you look at his GitHub repo it emerges that he’s also producing a board based on the ADC08200, so his software is targetable at other chips.

Whether or not you need your Pi to serve as video digitizer or high-speed instrument, it’s useful and interesting to take a look at a board like this one in action. We often don’t use the raw power of our single board computers, and this project proves that should we ever need to, we can.

If ADCs interest you, take a look at [Bil Herd]’s series on delta-sigma ADCs.

Thanks [Fustini] for the tip.

Tearing Into Delta Sigma ADCs Part 2

In part one, I compared the different Analog to Digital Converters (ADC) and the roles and properties of Delta Sigma ADC’s. I covered a lot of the theory behind these devices, so in this installment, I set out to find a design or two that would help me demonstrate the important points like oversampling, noise shaping and the relationship between the signal-to-noise ratio and resolution.

Modulator Implementation

modulatorCheck out part one to see the block diagrams of what what got us to here. The schematics shown below are of a couple of implementations that I played with depicting a single-order and a dual-order Delta Sigma modulators.

schematicBasically I used a clock enabled, high speed comparator, with two polarities in case I got it the logic backwards in my current state of burn out to grey matter ratio. The video includes the actual schematic used.

Since I wasn’t designing for production I accepted the need for three voltages since my bench supply was capable of providing them and this widget is destined for the drawer with the other widgets made for just a few minutes of video time anyway. Continue reading “Tearing Into Delta Sigma ADCs Part 2”

Blindingly Fast ADC For Your BeagleBone

[Jason Holt] wrote in to tell about of the release of his PRUDAQ project. It’s a dual-channel 10-bit ADC cape that ties into the BeagleBone’s Programmable Realtime Units (PRUs) to shuttle through up to as much as 20 megasamples per second for each channel. That’s a lot of bandwidth!

The trick is reading the ADC out with the PRUs, which are essentially a little bit of programmable logic that’s built on to the board. With a bit of PRU code, the data can be shuttled out of the ADC and into the BeagleBone’s memory about as fast as you could wish. Indeed, it’s too fast for the demo code that [Jason] wrote, which can’t even access the RAM that fast. Instead, you’ll want to use custom kernel drivers from the BeagleLogic project (that we’ve covered here before).

But even then, if you don’t want to process the data onboard, you’ve got to get it out somehow. 100 mbit Ethernet gets you 11.2 megabytes per second, and a cherry-picked flash drive can save something like 14-18 megabytes per second. But the two 10-bit ADCs, running full-bore at 20 megasamples per second each, produces something like 50-80 megabytes per second. Point is, PRUDAQ is producing a ton of data.

So what is this cape useful for? It’s limited to the two-volt input range of the ADCs — you’ll need to precondition signals for use as a general-purpose oscilloscope. You can also multiplex the ADCs, allowing for eight inputs, but of course not at exactly the same time. But two channels at high bandwidth would make a great backend for a custom SDR setup, for instance. Getting this much ADC bandwidth into a single-board computer is an awesome trick that used to cost thousands of dollars.

We asked [Jason] why he built it, and he said he can’t tell us. It’s a Google Research project, so let the wild conjecture-fest begin!

Hacklet 116 – Audio Projects

If the first circuit a hacker builds is an LED blinker, the second one has to be a noisemaker of some sort. From simple buzzers to the fabled Atari punk console, and guitar effects to digitizing circuits, hackers, makers and engineers have been building incredible audio projects for decades. This week the Hacklet covers some of the best audio projects on Hackaday.io!

vumeterWe start with [K.C. Lee] and Automatic audio source switching. Two audio sources, one amplifier and speaker system; this is the problem [K.C. Lee] is facing. He listens to audio from his computer and TV, but doesn’t need to have both connected at the same time. Currently he’s using a DPDT switch to change inputs. Rather than manually flip the switch, [K.C. Lee] created this project to automatically swap sources for him. He’s using an STM32F030F4 ARM processor as the brains of the operation. The ADCs on the microcontroller monitor both sources and pick the currently active one. With all that processing power, and a Nokia LCD as an output, it would be a crime to not add some cool features. The source switcher also displays a spectrum analyzer, a VU meter, date, and time. It even will attenuate loud sources like webpages that start blasting audio.

 

muzzNext up is [Adam Vadala-Roth] with Audio Blox: Experiments in Analog Audio Design. [Adam] has 32 projects and counting up on Hackaday.io. His interests cover everything from LEDs to 3D printing to solar to hydroponics. Audio Blox is a project he uses as his engineer’s notebook for analog audio projects. It is a great way to view a hacker figuring out what works and what doesn’t. His current project is a 4 board modular version of the Big Muff Pi guitar pedal. He’s broken this classic guitar effect down to an input board, a clipping board, a tone control, and an output stage. His PCB layouts, schematics, and explanations are always a treat to view and read!

pauldioNext we have [Paul Stoffregen] with Teensy Audio Library. For those not in the know, [Paul] is the creator of the Teensy family of boards, which started as an Arduino on steroids, and has morphed into something even more powerful. This project documents the audio library [Paul] created for the Freescale/NXP ARM processor which powers the Teensy 3.1. Multiple audio files playing at once, delays, and effects, are just a few things this library can do. If you’re new to the audio library, definitely check out [Paul’s] companion project
Microcontroller Audio Workshop & HaD Supercon 2015. This project is an online version of the workshop [Paul] ran at the 2015 Hackaday Supercon in San Francisco.

drdacFinally we have [drewrisinger] with DrDAC USB Audio DAC. DrDac is a high quality DAC board which provides a USB powered audio output for any PC. Computers these days are built down to a price. This means that lower quality audio components are often used. Couple this with the fact that computers are an electrically noisy place, and you get less than stellar audio. Good enough for the masses, but not quite up to par if you want to listen to studio quality audio. DrDAC houses a PCM2706 audio DAC and quality support components in a 3D printed case. DrDAC was inspired by [cobaltmute’s] pupDAC.

If you want to see more audio projects and hacks, check out our new audio projects list. See a project I might have missed? Don’t be shy, just drop me a message on Hackaday.io. That’s it for this week’s Hacklet, As always, see you next week. Same hack time, same hack channel, bringing you the best of Hackaday.io!

Isolated Voltage Measurements Through Frequency

This one’s not a flashy hack, it’s a great piece of work and a good trick to have up your sleeve. Sometimes you’ve got a voltage difference that you’d like to measure, but either the ground potential is at a different level, or the voltages are too high for your lowly microcontroller.

There are tons of tricks with resistive voltage dividers that you can play. But if you want serious electrical isolation from the target, there’s only one way to go — an optocoupler. But optocouplers only really transmit digital signals, and [Giovanni Carrera] needed to measure an analog voltage.

VFC+calibration

Enter the voltage-to-frequency IC that does just what it says: produces a square wave with a frequency that’s proportional to the voltage applied. Pass this square wave through an optocoupler, and you can hit one side with voltages approaching lightning strikes without damaging the microcontroller on the other side. And you’re still able to measure the voltage accurately by measuring the frequency on the digital I/O pins of the microcontroller.

[Giovanni] built up and documented a nice circuit. He even tested it for linearity. If you’re ever in the position of needing to measure a voltage in a non-traditional way, you’ll thank him later.