Vin/USB power

Hello all,

I am working on a project where i use a LM741 to amplify line level audio and add a 2.5v dc offset. I feed the output of this circuit to my adruino analog pin 1. On the arduino i read a value from the ADC between 0 and 256. With the 2.5v dc offset i center the input signal at ADC value 127. My problem is, when i have the USB connector connected to the arduino, i get the 2.5v offset and everything looks good, but when i disconnect the usb and hook up the 9v battery (run through a 7805 to produce 5v) the voltage rises and falsly triggers my code based on the ADC value. I noticed if i just unplug the USB and leave the usb adapter plugged into it, it is ok, but as soon as i take off the usb adapter, my voltage rises.

Am i missing something? I think maybe my arduino may be fudged. I had to use my own 5v rail (7805) because the 5v pin was only putting out about 2v.

This is a arduino duemilanove board via a arduino protoshield.
I have not figured out how to attach my schematic so sorry for no extra info atm.

Thanks!
Muzz

Click Reply, then Additional Options, and browse to you file to upload.

2.5V offset should read 1/2 of 1023, around 512.

(run through a 7805 to produce 5v)

Did you put caps on input, one or two (about 1mf, and .1mf maybe).
You can use the internal vref for more accuracy, since the 5V is not really that accurate.
What is the actual voltage range you are reading?

Thanks for that tip!

I am using raw registers to read the ADC and that gives me a 0-255 output so i center around 127. Its like the draw of the usb adapter (usb chip on a board that plugs into the arduino, removable) is doing something to the circuit.

I am old to electronics and tinkering but only recently have I started doing the math, etc (taking it seriously).

I dont think i am explaining the usb adapter part well so i attached pictures of my arduino and the usb adapter. This arduino does not have usb support built-on, instead it has a 6 pin header that a usb chip breakout board attaches to for programming. When the adapter is plugged in, everything works fine - even if its not has no USB cable plugged into it. Take it off and my voltages go up by half a volt or so.....

Here is my arduino code too, its based off some other guys work on another site (i just looked and couldn't find him again) and modified for my needs.

All this device does is take a audio input and flash an LED when it detects a signal. The idea is for my musician friend so we can have a big blinker for his metronome.

Muzz

I didn't see the sketch (code), can you send it again. What input are you using, a microphone or audio board, or ??
You may want to check the ground wires. If there is no common ground wired, it will not work right.

You might want to take a peek at this thread —

http://forum.arduino.cc/index.php?topic=175143.0

Are you reading both ADC registers? 0-255 would suggest just the lower 8 bits.

Thanks for all the replies. I'm not too concerned about the code at this point, I was trying to figure out why connecting/disconnecting the usb adapter would cause my voltages (measered with a scope and meter) are high. Has anyone run into this scenario before?

Muzz

connecting/disconnecting the usb adapter would cause my voltages (measered with a scope and meter) are high.

I Don't understand that. How high? What did you expect it to be?

The voltage divider applied to pin three should be causing the opamp to apply a dcoffset to the inverting input. When the circuit is operating correctly i get a constant 2.5v coming off the opamp's output. When i disconnect the usb breakout board it jumps up to around 3 volts. My 5v rail still reads 5.01v and my scopemeter doesnt show alot of noise in the power or the input. I am generating a 1Khz sinewave ton at .1v and feeding that into the input so i can trace it through and measure voltages and see any noise.

Just for reference, I am dropping my code on here for anyone that really wants to see it.

Thanks again for everyones interest and help.

Muzz

sound_detect.ino (1.64 KB)