hey there. i have been tackling a problem of input noise caused by a SHARP infrared GPD sensor. my circuit consists of 5 pots and 1 IR sensor. some of you have read as i began decoupling my IR and experimenting with low pass filters on my pots.
i have successfully removed the noise from my circuit by doing the following:
1- 10uf cap across v and g of my IR sensor.
2- approximately between 20-40 ohms R between the IR and the power rail.
this was good. my pots stopped flickering instantly. the new problem, however, was that my range of distance detection for the IR has been screwed up by the resistor. read below:
note: i've mapped my data down to 0-127 from 0-1023 for reference to MIDI control changes. this is only relevant to explain why the following explanation uses such small numbers.
no hand in front of ir: depending on resistor used, value read is approximately 25-30.
hand high above sensor: value is between 9-20
hand just above sensor: value tops off at 75 or so.
the problem is that i am not getting the full value out of my sensor, because when i remove my hand, the value is HIGHER than if i actually have my hand high above the sensor.
does anyone have any suggestion here?
i will gladly provide any further info.
David: thank you for the suggestion of internal ref. i did not know about this capability, and i'm pleased to read the AnalogReference page on the arduino site. this will certainly come in handy in other projects, so again, thank you.
unfortunately, it appears that changing the reference to internal works on all pins simultaneously, rather than just one (or several) pins selectively. in my current project, i'm using five 50k ohm pots + 1 sharp IR sensor (the one with the low output). i'd like to keep the pots referenced to 5v.
so - op amps, here i come. i've been reading up on them already and plan to buy one from radioshanty tomorrow. hopefully it won't introduce more noise to my system - i'll have first decoupled, then resisted, then amped all for nothing.
Just remember op-amp need a dual power source. But you can easily make a sort of GND at VCC/2.
Here's the ever-popular (it gotta be, it always pops up when googling op-amps :P) "Application Note 31" for op-amps (aka "Op-Amp Circuit Collection"), in case you need it. http://www.national.com/an/AN/AN-31.pdf
If you look at page 4, "circuit for generating the second positive voltage", you see an example of a making a dual power suppy. (except here it is the "second positive voltage", at +10 V. Another way of looking at it is -10V, GND, + 10V). Connect this GND (or "second positive voltage" at +10V) to the non-inverting input of the op-amp circuit you posted, and use this as a signal GND. That is, if the signal is varying around VCC/2. I don't know how your sensor works, so it might not apply.
Anyway, it seems like you have about 1/2 the range already( (75-9)/128)-ish), so it doesn't seem you need to amplify much (<2x), but it would help a bit with resolution if you did.
And whats this about hand in front of the sensor or not, are you blocking an IR signal to test it?
i'll have first decoupled, then resisted, then amped all for nothing.
You never decouple for nothing, you always get a benefit.
Decoupling is good and never wasted, it makes the system more robust.
approximately between 20-40 ohms R between the IR and the power rail.
If that is screwing up your sensor range it looks like it is too much voltage drop to achieve the isolation you want. try replacing the resistor with an inductor. That will remove the noise without giving you the voltage drop.
unfortunately, it appears that changing the reference to internal works on all pins simultaneously, rather than just one (or several) pins selectively. in my current project, i'm using five 50k ohm pots + 1 sharp IR sensor (the one with the low output). i'd like to keep the pots referenced to 5v.
I think it's possible to change the reference to internal, read the one analog channel, then change reference back to default before reading the other analog channels. You may have to do a couple of analogReads in a row right after changing reference and throw away the first reading. I haven't tried this yet, but can't think why it wouldn't work and is cheaper then building an external op-amp stage just for the one channel.
raron: thank you for the "Op Amp Circuit Collection." i've printed it out and it's going into my electronics reference notebook. regarding the hand in front of the sensor: reflecting the IR signal with my hand at different places above the IR sensor is how this sensor is used in my application (midi cc controller). on a scale of 0-1023, the IR shoots back approximately 20-470 or so, so an amplification of 2x would be ideal for resolution.
regarding page 4 and the dual power supply, i was a little lost by what you said. from the looks of it, a non-inverting amplifier would do the job of boosting my sensor's output signal, as Vout = [(R1+R2)/R1] * Vin. i do not yet see where the extra power comes from. i have not yet used an op amp, ever, so this is all very new.
daveg, that IR sensor is a good alternative. fortunately, however, i know that a solution given my current sensor selection is possible - it's just a matter of learning the basics here. i'm determined to do this.
grumpy, though i do want to tackle op amps, i will try the inductor. any suggested value? your decoupling page says "The inductance value is not too critical, but generally as big as you can manage, a few tens of mill Henrys is normal."
retrolefty: while the software solution of changing references quickly is a clever one, i'd like to learn a bit of circuitry!
hey there - tried the inductor (100 microhenries, the only one they HAD at radioshack, man, i hate that place) instead of the resistor and the noise came back, just as it was before the resistor.
so, it's back to the resistor and op amp. i bought a 741 op amp and will be trying a non-inverting amplifier ala this diagram:
i guess a larger order from an electronics distributor is on the to do list. i know this must be said a lot by people in the states but i despise radioshack. you'd think there'd be a electronics supply store in San Francisco, but all we have is radioshack and jameco 20 miles south. i get around by bike, so jameco is out of my range. i must order everything i can't salvage/buy at exorbitant prices at radioshack.
what a bummer. any recommendations of an op amp of appropriate specifications would be appreciated.