electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Developers' Corner
Converting a line level audio signal to 0-5VDC
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
nsfx



Joined: Aug 10, 2006
Posts: 7

PostPosted: Wed Oct 02, 2013 7:22 pm    Post subject: Converting a line level audio signal to 0-5VDC Reply with quote  Mark this post and the followings unread

This is a follow up on this thread, which was about designing a audio-to-MIDI envelope follower. I have a crude version of this working now, but I'd like to iron out some kinks.

Most importantly, I'm not using anywhere near the full 10 bits of resolution on the ATmega's ADC. I understand I'd have to amplify and bias the incoming line level signal to 0-5V to achieve this.

Before I build this opamp circuit, which will require another power supply (+/- 9-15V on top of my current +5V rail), is there a chip I can use that would take a line level audio signal and spit out a 0-AREF VDC, ideally with a way to control gain?

If such a chip doesn't exist, or if it's expensive, my second question is: Can I use a chip like this to get +/-9V rails from a +5V supply? I'm confused by the data sheet a bit. I see + and - Vin pins but I can't tell if they're required. Is there another approach I should take? I'd like to avoid using batteries.

Thanks!
Back to top
View user's profile Send private message
elmegil



Joined: Mar 20, 2012
Posts: 2177
Location: Chicago
Audio files: 16

PostPosted: Thu Oct 03, 2013 10:51 am    Post subject: Reply with quote  Mark this post and the followings unread

I haven't looked at that circuit in great detail, but could you use a single-supply op amp to help mitigate your power issues?
Back to top
View user's profile Send private message
gdavis



Joined: Feb 27, 2013
Posts: 359
Location: San Diego
Audio files: 1

PostPosted: Thu Oct 03, 2013 12:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nothing can drive to the absolute rails. So if you really want to use every last bit you'll need another power supply above and below 5V and GND. However, setting something up single-ended on 0-5V like Elmegil suggested, biased and with the gain set to produce a signal about 1-4V (depending on the actual opamp) might be good enough.

I think you could make the DC/DC converter work. It doesn't look like it's intended for audio and might be a little noisy requiring some additional filtering, but for your application that might not be an issue.

_________________
My synth build blog: http://gndsynth.blogspot.com/
Back to top
View user's profile Send private message
nsfx



Joined: Aug 10, 2006
Posts: 7

PostPosted: Wed Oct 30, 2013 9:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

I've drawn up a schematic I plan to use. Again, the goal of the circuit is to convert a line level audio signal into a 0-5VDC signal that I can sample on an AVR chip.

http://i.imgur.com/95fh7FA.jpg

This may be entirely incorrect as I'm still a beginner at electronics, but here's my reasoning:

I expect the audio input signal to be roughly 1V peak-to-peak max (-0.5 to +0.5VAC). The 2.2uF cap is intended to block DC component of the signal. The signal is then biased +2.5VDC (via a voltage divider circuit) so that the resulting signal swings +2 to +3VDC. The signal is then fed into an into an inverting op-amp, where gain is controlled by the 10Kohm pot. The + pin of the opamp gets +2.5VDC (intended as a virtual ground), and the - pin gets the +2 to +3VDC signal.

I think the 2Kohm pot should be a 1Kohm pot, yielding a max gain of 10, since the max difference between + and - on the opamp will be 0.5V and I want to get 5.0VDC output.

This assumes a perfect opamp. I know in reality I won't get a full 0-5VDC output, but close enough (~4Vpp) is OK for my application.

Anyone see any problems? Thank you.
Back to top
View user's profile Send private message
gdavis



Joined: Feb 27, 2013
Posts: 359
Location: San Diego
Audio files: 1

PostPosted: Wed Oct 30, 2013 10:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Lets try this again, I think I got it now Embarassed

The 2k should be much higher, like 100k.

The 10k feedback will need to be adjusted to provide the proper gain with the 100k, ideally 300ohms (you want a gain of 3 for output from 1 to 4 volts).

You only need to connect your 2.5V reference to the + input, not to the cap/input resistor node.

I think that should take care of it.

_________________
My synth build blog: http://gndsynth.blogspot.com/
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Oct 31, 2013 6:25 am    Post subject: Reply with quote  Mark this post and the followings unread

My 2 cents here...

I see that the OP's original complaint about his current circuit is that it doesn't use all of the ADC bits.

I also agree with gdavis's statement that no OpAmp goes truly rail to rail - even when it says "rail to rail" in the datasheet. If you look at the actual numbers, those parts can come close, but they never really make it.

I wondered, however, why the OP would be satisfied with a range of 1 to 4 volts? That is a span of only 3 volts which still doesn't use the full ADC 10 bit range. In fact, it uses only 60% of the range.

Why is using a real dual supply difficult in this application? +/- 9 volts has enough headroom to easily allow standard OpAmps (like TL07x) a full 0 to 5 volt output and would do so without resorting to a virtual ground. This would allow using 100% of the ADC range which would give better resolution.

My suggestion (that is, the way I would do it) is to use an AC wallwart with two half wave rectifiers to create raw voltages that can then be regulated. Make a dual supply of +9 and -9. With that, your choice of circuit approaches is much greater than single supply. You could make a very nice precision full rectifier for your input signal, filter that and then acquire the data (at full range) using the 10 bit ADC.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
gdavis



Joined: Feb 27, 2013
Posts: 359
Location: San Diego
Audio files: 1

PostPosted: Thu Oct 31, 2013 11:47 am    Post subject: Reply with quote  Mark this post and the followings unread

Well I was just picking 1-4 out of the air as an example instead of actually looking up the specs for a rail-to-rail opamp. Apparently you can get within a couple hundred milivolts.

You have a point, adding a supply might not be that much more difficult, but weighing the cost/benefit, I was just thinking that for his envelope follower application getting a few more bits with minimum effort would be enough. If not, he can always go with the +/- 9V option, but why not try the simpler solution first? If nothing else, it's a learning experience Wink

_________________
My synth build blog: http://gndsynth.blogspot.com/
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Oct 31, 2013 1:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

IMO, because the use of a +/- 8 (or 9) volts dual supply will give the full range of 0.0 to 5.0 volts and eliminates the virtual ground. Full range means that the application will perform at it's best and no more circuit adjustments should be required. Two halfwave rectifiers and an AC wallwart with 2 regs would be added and not much else needs to be changed.

However, I do agree that "good enough" is good enough, but that remains placed with the OP's opinion.

Something else I had thought of might be to use single supply, but increase it to 15 volts DC. Then the virtual ground is at 7.5 volts which gives the needed headroom to get to full range. Still requires an additional supply, but requires fewer changes to the original circuit.

The real main problem here is using a 5 volt supply. There's just no headroom when you want an output swing of 0.0 to 5.0. This goes back directly to your statement that there is no such thing as a true rail to rail opamp.

_________________
FPGA, dsPIC and Fatman Synth Stuff

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
corruptio optimi pessima
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use