NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Making an exact copy of a signal

August 16, 2011
by lcruz007
lcruz007's Avatar

Is it possible to use the ADC and the DAC of the atmega328P in order to output a signal exactly as the input signal? In other words, making an exact copy of a waveform using the ADC to read the input signal and copying it and then using the DAC to output another copy.

Please note that the signal intended to be copied is not just 5V and 0V.

August 17, 2011
by bretm
bretm's Avatar

Not exact, no. The ADC has 10 bits of precision and only about 9 bits of accuracy, so that will introduce some distortion. You would also have to use a low-pass filter and would lose any frequencies under about half the frequency of the ADC sampling rate, probably more like a quarter, practically speaking.

Do you really need exact? Technically even a plain wire won't allow an exact copy.

August 17, 2011
by Rick_S
Rick_S's Avatar

Plus an ATMEGA328P doesnt have a DAC that I know of.

August 17, 2011
by lcruz007
lcruz007's Avatar

Well, that's probably true. But what I'm trying to do is, let's say the input signal is a 15Hz sine wave. The output (from another pin other than the input pin) should have the same frequency and amplitude, after "copying" the signal...

August 17, 2011
by bretm
bretm's Avatar

The chip doesn't have any analog output pins. The best you could do is PWM and a low-pass filter, or an external DAC.

August 18, 2011
by BobaMosfet
BobaMosfet's Avatar

lcruz-

Don't copy the signal through the MCU, simply use the MCU to analyze the signal. Use a transistor to copy the signal based on the MCU's analysis.

BM

Post a Reply

Please log in to post a reply.

Did you know that many systems in nature can be described by a first order response? Learn more...