A Truly Professional Raspi Analog Input

Much to the chagrin of hardware tinkerers, the Raspberry Pi doesn’t have analog inputs on its GPIO pins. Sure, you can blink a LED with just a few console commands, but reading sensors with a bone-stock Raspi requires a little additional hardware. [Brian Dorey] just released a board that allows for 8 analog inputs on the Raspberry Pi with a 16-bit resolution that is much higher than any Arduino-based build.

[Brian]’s build is based on an earlier, similar iteration of a Raspi analog board we saw last July. Like the previous version, the new professionally made PCBs use a pair of Microchip MCP3428 analog to digital converter. These ADCs are able to sample four channels at a resolution of 16 bits; a vast improvement over the 8-bit ADCs included on every Arduino.

The boards communicate with the Raspberry Pi over an I2C serial bus using a neat stackable header. In theory, it should be possible to use several of these boards and measure dozens of analog channels, but we’ll leave a demonstration of that up to [Brian].

Arduino Voltage Measurement Tricks

We think it’s a great learning experience to tear back the veil of abstraction and learn a bit more about the hardware found on an Arduino board. This project is a great example. [Scott Daniels] takes a look at the other voltage measurement options available to AVR chips used by Arduino.

If you’ve used the analogRead() function then you’ve already measured a voltage using the Arduino. But do you know what is going on behind the scenes to make this happen? The Analog to Digital converter on the AVR chip is being used to measure an incoming voltage by comparing it to a known voltage reference. That reference is by default the supply voltage line for the chip. This should be 5V but will only be as accurate as the regulator supplying it. [Scott] looks at the other voltage references that may be used. An external reference can be used by adding hardware, but that’s not the focus of his article. Instead he looks at using the 1.1V internal reference. He’s written some short example code that let’s you measure the incoming line voltage based on that internal reference. This is a very handy trick that can let you detect when the chips is running from a battery and how much juice is left in the cell.

CPLD Motor Control

[Chris] continues cranking out the tutorials, this time around he’s showing how to use a CPLD for simple motor control. The demo hardware is pretty basic, he built his own FPGA/CPLD demo board a few years back which used a PLCC socket for easy interfacing. You should be able to use just about any gear you have on hand.

Of course the thing about these chips is that you’re working with hardware that can be run in parallel. [Chris] mentions that this is what makes it perfect for timing-critical applications. Here he’s using a motor driver that monitors a PWM signal, using the duty cycle to actuate the direction and speed at which the motor turns. After the break you can see a demonstration of the CPLD reading from an ADC chip and converting the value to a PWM signal. [Chris] has also used the same hardware for VGA signals; something that is usually a timing nightmare if done with a microcontroller.

If this leaves you thirsting for more CPLD goodness check out our own guide on the subject.

Continue reading “CPLD Motor Control”

R2R Ladder Connects Multiple Buttons To One ADC Pin

If you’ve run out of I/O pins on a project and need a way to add user input you can find a slew of port expanders that work with various communications protocols like I2C and 1-Wire. But if you just want to add in some buttons without reaching for an extra IC you’ll love this hack. [John Boxall] shows how to add four buttons using one ADC pin.

The concept is nothing new. The buttons make up an R2R resistive ladder. When one of them is pressed, it completes the circuit for a voltage divider. The results are measured by the analog-to-digital converter of an IC to tell which button was pressed. The difficult part is calculating the resistor values. [John] is using eight resistors made up of just two different values. Every button and every combination of buttons has a unique voltage result which can be discerned by the chip. He even made a truth table so you don’t have to.

The example circuit seen in the video after the break uses an Arduino. But this concept is directly applicable to any microcontroller. And it should be quite easy to use an ADC interrupt to drive all of the button-read events. Continue reading “R2R Ladder Connects Multiple Buttons To One ADC Pin”

Reading Diodes To Create A Thermal Imaging System

[Udo Klein] was working with some 1N4148 transistors and was interested in the specs relating to their performance at different temperatures. The forward voltage actually changes quite a bit depending on temperature and wondered if this could be reliably measured. He hacked his own LED shield for the Arduino to use as a 1×20 thermal imaging system.

The screenshot above is mapping the voltage measurements from a row of diodes (see the video after the break to get the full picture). He’s holding an ice pack over the row of diodes and observing the change. The on-screen display is facilitated by a Python script which is pulling data from the Arduino. Since there aren’t enough analog inputs to read all twenty diodes separately they have been multiplexed. Four I/O pins each enable five of the diodes, readings are taken with five analog inputs before moving on to the next set.

What can this be used for? That is precisely the wrong question… sometimes you’ve just got to go where your curiosity takes you. Continue reading “Reading Diodes To Create A Thermal Imaging System”

DIY Clapper Is The Ideal Gift For The Laziest Person In Your Life

diy-clapper

If you haven’t yet wrapped up your Christmas shopping, you may want to consider building [AlanFromJapan’s] implementation of the ever-classic “Clapper”. With its theme song burned into the brain of anyone old enough to remember the 80s, the clapper was a wonderful device that certainly put the “L” in laziness.

Looking for an excuse to play around with an opamp and microphone [Alan] decided to build his own version of the Clapper based off this similar circuit, which he calls the ClapClap. He built the device using an electret mic that feeds a signal through a small amplifier on the way to the ADC of an ATmega328 microcontroller. The mcu constantly polls the ADC looking for the sound of clapping hands, a solution that works, but isn’t as clean as [Alan] wanted.

He went back to the drawing board, this time building a circuit around an ATtiny2313 microcontroller. Most of the other components remained the same, though the new, smaller design sports some nice PCBs he had made at Seeedstudio. Rather than constantly polling the ADC, this version of the ClapClap looks for peaks in the signal coming from the mic to identify the clapping of hands.

He says that the newer version works great, though he still has a software bug or two that need fixing before he parks himself on the couch for all eternity.

Web-enabled Coffee Maker Over-complicates Your Break Time

Some think that grinding the beans and filling the coffee maker is part of the coffee-drinking ritual, but [Jamie] isn’t one of them. Instead, he’s been working to make this coffeemaker a web-enabled device. He built it as part of a class project, and has implemented most of what you need to make a cup of Joe automatically.

You can see a small pump attached to the back of the coffee maker. It sucks water from a pitcher (slightly visible to the left of the coffee maker) to fill the reservoir. He experimented with a couple of different water level sensing solutions. His most recent is a PCB with several traces of different length. As those traces are covered by water, a voltage can be read via ADC to establish water level.

He’s using an Arduino and Ethernet shield to add connectivity for the device. The problem is that there aren’t enough ADC pins left on the Arduino to read the water level sensor. Because of this, he added a self-build shield that uses a PIC to do the ADC measurements and push digital data across to the Arduino. A bit complicated, and it doesn’t load the grounds automatically (yet?). But that’s not to say we don’t appreciate complicated coffee hacks.