Back in the day where the microprocessor was our standard building block, we tended to concentrate on computation and processing of data and not so much on I/O. Simply put there were a lot of things we had to get working just so we could then read the state of an I/O port or a counter.
Nowadays the microcontroller has taken care of most of the system level needs with the luxury of built in RAM memory and the ability to upload our code. That leaves us able to concentrate on the major role of a microcontroller: to interpret something about the environment, make decisions, and often output the result to energize a motor, LED, or some other twiddly bits.
Often the usefulness of a small microcontroller project depends on being able to interpret external signals in the form of voltage or less often, current. For example the output of a photocell, or a temperature sensor may use an analog voltage to indicate brightness or the temperature. Enter the Analog to Digital Converter (ADC) with the ability to convert an external signal to a processor readable value.
Making sound with digital logic usually calls for a Digital to Analog converter. Building one can be very simple, and the sound quality out of an R-2R Ladder is actually pretty good.
In the last edition of Logic Noise, we built up a (relatively) simple VCO — voltage-controlled oscillator — that had roughly one-volt-per-octave response. I even demonstrated it working mostly in tune with another synth’s keyboard. But what if you don’t have a control-voltage keyboard sitting around or you want to combine all of the logic-based circuits that we’ve been building with other circuits under voltage control? That’s where the digital to analog (DAC) voltage converter comes in.
Continue reading “Logic Noise: Digital to Analog with an R-2R DAC”
In this installment of Scope Noob I’m working with Direct Digital Synthesis using a microcontroller. I was pleasantly surprised by some of the quirks which I discovered during this process. Most notably, I had a chance to look at errant triggers solved by using holdoff and a few timing peculiarities introduced by my use of the microcontroller. Here’s a video synopsis but I’ll cover everything in-depth after the break.
Continue reading “Scope Noob: Microcontroller Quirks with DDS”
One of the acronyms you may hear thrown around is DDS which stands for Direct Digital Synthesis. DDS can be as simple as taking a digital value — a collection of ones and zeroes — and processing it through a Digital to Analog Converter (DAC) circuit. For example, if the digital source is the output of a counter that counts up to a maximum value and resets then the output of the DAC would be a ramp (analog signal) that increases in voltage until it resets back to its starting voltage.
This concept can be very useful for creating signals for use in a project or as a poor-man’s version of a signal or function generator. With this in mind I set out here to demonstrate some basic waveforms using programmable logic for flexibility, and a small collection of resistors to act as a cheap DAC. In the end I will also demonstrate an off-the-shelf and inexpensive DDS chip that can be used with any of the popular micro-controller boards available that support SPI serial communication.
All of the topics covered in the video are also discussed further after the break.
Continue reading “Direct Digital Synthesis (DDS) Explained by [Bil Herd]”
A couple of things strike us about this 8-voice 32 kHz synthesizer. First is the cleanliness of the prototype. As you can see, each part has plenty of room on its own board and all are interconnected by 10-pin IDC ribbon connectors. But you’ll have to see the video after the break to enjoy the impressive sound that this puts out. You’ll hear it play the Super Mario Bros. theme; it does it with passion!
To get audio from the digital microcontroller [Mike] built his own R2R digital to analog converter. The resistor ladder is built from sixteen resistors, which feed a rail-to-rail amplifier. The sound is mono but the playback is polyphonic thanks to the work done by the ATmega1284. It is reading MIDI commands coming in from an external controller (we assume it’s the computer on which the hardware is sitting). The chip’s 128 KB of Flash memory leave plenty of room to store samples, which are selected from a lookup table based on the MIDI data. If more than one sample is to be played the chip averages the data and sets the 8-bit output port accordingly.
Continue reading “ATmega1284 as an 8-voice 32 kHz synthesizer”
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”