Microcontroller input question - diyAudio
Go Back   Home > Forums > Source & Line > Digital Source

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 16th February 2004, 04:47 PM   #1
diyAudio Member
 
Join Date: Feb 2004
Location: Austin
Default Microcontroller input question

I'm building a PWM amplifier using a microcontroller and I want to use the microcontroller's internal ADC. However it only accepts input voltages 0-5V. How can I recenter an audio signal to ~2.5V?
  Reply With Quote
Old 19th February 2004, 06:16 AM   #2
tool49 is offline tool49  Canada
diyAudio Member
 
tool49's Avatar
 
Join Date: Apr 2003
Location: Montreal
I'm not sure what would be the usefullness of recentering to 2.5V. Wouldn't it be easier to simply put a smal opamp in between the microcontroller and the input with a gain of 2? That would allow you to use the ADC full potential in terms of precision (usually around 10 to 13 bits)

I'm not entirely sure my answer will be of any use, but at least I tried

Sébastien
  Reply With Quote
Old 19th February 2004, 07:00 AM   #3
diyAudio Member
 
Join Date: Mar 2003
Location: Thailand
Hello
I'm not have experience like this but I will try.

Please thinking to pushpull amplifier that seperate signal sine wave to 2 signal by diode, first channel signal for positive and second one for negative signal. After that we change negative signal on second one to positive by opamp(changing phase).

Right now we have two signal both is positive and we will use 2
channel of ADC to check level of signal and if signal come from first channel that mean positive signal and if signal come from
second channel that mean negative signal. After that up to your programming to go ahead.
If possible don't forget to let me know.
  Reply With Quote
Old 19th February 2004, 07:13 AM   #4
Electrons are yellow and more is better!
diyAudio Member
 
peranders's Avatar
 
Join Date: Apr 2002
Location: Göteborg, Sweden
Blog Entries: 4
Default Re: Microcontroller input question

Quote:
Originally posted by martinfuture
I'm building a PWM amplifier using a microcontroller and I want to use the microcontroller's internal ADC. However it only accepts input voltages 0-5V. How can I recenter an audio signal to ~2.5V?
Don't forget that your MC (probably) can't produce any _high_ fidelity of the audio signal.
__________________
/Per-Anders (my first name) or P-A as my friends call me
Tube Buffered Gainclone in work |Thread || Diamond buffer |Thread for the group buy | Wiki
  Reply With Quote
Old 19th February 2004, 07:14 AM   #5
diyAudio Member
 
Ouroboros's Avatar
 
Join Date: Dec 2003
Location: Nottingham UK
You may find that simply biasing the ADC input to half-supply using a couple of resistors, and then ac coupling the signal in will be adequate. (That is, if you don't need a response down to 0Hz of course.)

If you need a response down to 0Hz, then you'll have to use op-amp circuitry to offset the signal midpoint to VCC/2.
  Reply With Quote
Old 19th February 2004, 07:16 AM   #6
diyAudio Member
 
Pjotr's Avatar
 
Join Date: Nov 2002
Location: Netherlands
What about a 47K - 47K resistor divider between gnd and Vcc and using an input capacitor ???

  Reply With Quote
Old 19th February 2004, 12:58 PM   #7
diyAudio Member
 
jackinnj's Avatar
 
Join Date: Apr 2002
Location: Llanddewi Brefi, NJ
i hate to say that it's almost always a good idea to buffer the input of an ADC anyway --- if it's a PIC or AVR the datasheet will tell you the approximate impedance. Some of the switched capacitor ADC's have pretty low impedance. some of theses microcontrollers can be very unforgiving of higher than specified voltages.

You could spend a couple hours trying to figure out a biasing scheme with discretes, but an op amp is so easy to implement.

in order not to "fry" the ADC input of the microcontroller consider connecting a clamping diode (1n4148) to the input of the ADC, a small resistor in series with the ADC input will also isolate some of the noise picked up on the trace -- i picked up this idea in the datasheet from the Linear Tech LT1093 6-input/10 bit ADC and it definitely works.

The picture below will give you some idea of what I am driving toward. It shows the 2.5 VAC signal to the ADC biased and "clipped" by the diode.
Attached Images
File Type: jpg adc_limit.jpg (83.8 KB, 114 views)
  Reply With Quote
Old 19th February 2004, 01:23 PM   #8
diyAudio Member
 
Ouroboros's Avatar
 
Join Date: Dec 2003
Location: Nottingham UK
With CMOS micros it's wise to clamp both over and under-voltages to the ADC input. On the HC908 range for example, the ADC inputs are high-impedance but have a max capacitance of 30pf.
A 1k series resistor in line with the signal to the ADC, together with a couple of low-power Schottky signal diodes (one with the cathode connected to Vdd and the anode to the ADC input pin, the other diode with the anode connected to 0v and the cathode to the ADC input pin) will protect the chip against most things.

What is the micro? Most only have 12-bit ADCs at best, and they are only fairly slow successive approximation types. Are you sure the speed and resolution will be adequate?
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microcontroller Help imix500 Parts 8 3rd September 2008 02:49 AM
help with microcontroller sss Everything Else 2 31st July 2008 04:30 PM
microcontroller programming traf Digital Source 7 12th September 2007 12:49 PM
newbie with input tran. question and wiring question imo Solid State 0 18th January 2006 10:10 PM


New To Site? Need Help?

All times are GMT. The time now is 03:50 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2