sharpIR-decoupling kills spikes, but noise remains

hey there. checking in with a decoupling/bypass capacitor question.

my circuit consists of 5 rotary potentiometers and 1 sharp gpd120. upon using the IR sensor with arduino, i noticed 2 things - 1, that the reading of its values suffered from sudden spikes every couple of seconds, and 2, that it introduced a LOT of noise into my circuit. this noise is picked up on my rotary potentiometer pins and causes the data to jitter.

i’m new to decoupling. after doing a lot of reading about this, and i’ve dropped a 100uf capacitor across the 5v and ground of the sharp gpd120. this eliminated the spikes handily - great success! however, the general noise remains.

how can other decoupling and/or bypass caps be used to eliminate this noise? i tried putting a cap across the ground/5v of a potentiometer with no change - which makes sense, cuz these are passive components and aren’t generating the variety of consumption that the IR sensor is.

i’ll continue to experiment tomorrow, but any help would be greatly appreciated.

You need to target the device that is generating the high switching demand and put a large (or bulk) capacitor across that.
However, you can also consider filtering the signal lines that are picking up the noise if this noise is out of band (very difference in frequency) from your signal. Small series resistors (about 20 to 100R) coupled with small capacitors (10nF or so) to ground on the chip inputs.

As will as just bulk C you can add series resistors or inductors.

thanks, grumpy -

i'd already put a 10uf across the v and ground terminals of the IR sensor. this eliminated the spikes, but not the noise read by the other pins. i upped the capacitor value to 100uf, but this didn't make any difference in what the potentiometer pins either.

as far as this goes:

Small series resistors (about 20 to 100R) coupled with small capacitors (10nF or so) to ground on the chip inputs.

could you describe this connection in even more basic terms? i am unsure of which way to make this connection. i am going crazy trying to get rid of this noise...nothing has been this frustrating yet.

See for more info.

As well as the above describing what I was suggesting:-

already put a 10uf across the v and ground terminals of the IR sensor.

Try putting a 10R resistor in line of the +ve line just before the IR sensor and capacitor.

thanks, fellas. each small step i make feels like a gigantic leap. i sure wish i'd learned this stuff in high school.

i sure wish i'd learned this stuff in high school.

Oddly enough they don't teach decoupling at high school or even University in my experience. :wink:

i am not having much success.

using this schematic as reference:

my IR currently has 100nf connecting v and g right at the sensor,
*10uf between v and g a little ways down,
*a 100R resistor in series on the power (which only seemed to serve to reduce the range of the IR's read)
*and finally, a 100uf resistor connecting v and g right before the breadboard (because i don't have a 47uf cap)

using the link provided by dave, i built a low pass filter for the input that was suffering from noise from the IR sensor using a 10nf capacitor and a 100R resistor. i did not notice a difference - even after switching out the capacitor for a larger one. when the IR power is plugged in, Arduino still reads constant noise from my other analog inputs.

wit's end. i've spent hours on this with no meaningful success. i feel like the noise is not filterable on the potentiometer input pins, like it's somehow generated AFTER the input.

the answer must lie in smoothing out the IR's draw on the arduino's power. for all the capacitors i've put in, however, all i've noticed is that those ugly spikes that come every now and then are gone. what else can i do??

A what sort of frequency are you read from these sensors? in a Low Pass filter the smaller the resistor the higher the cutoff. Your current filter will pass up to 160khz. Based on the bits you seem to have try a 100R with a 47uF cap as your LP filter. This should give a cutoff of 33hz.

hi, dave -

are you referring to the lpf i applied to the potentiometer, or the infrared sensor?

i may not have the tools necessary to analyze the noise on my circuit (what might those tools be? oscilloscope? something else?) but i did try that low pass filter with a higher capacitor value. while using the serial monitor, i saw that the larger cap was in fact working - i'd move the pot and watch the values settle to the position i moved the pot to a split second later. of course, the noise was still there.

it's important for my project (midi controller) that these potentiometers not have a delay between moving the knob/reaching the proper output signal.

thanks for your time.

You can try putting a cap across the analogue inputs. Also make sure you have an impedance lower than 10K across the analogue inputs. Than normally means a pot of 10K, what is the value you are using?

Instead of looking at trying to remove the interference, look at it as trying to keep the part of the signal that you want. How often do you expect to read the value from your pots? 10 times a second? if so filter everything but those changes that are constant for more than a 10th of a second. So a low pass filter with a 10hz cutoff or in practice perhaps a bit higher.

grumpy - while testing this on the breadboard, i'm only using one 10k pot and the infrared sensor. however, i have another 10k pot and three 50k pots that i will eventually use along with the IR and the first 10k pot, totaling 5 pots and the IR. when you say put a cap across the inputs, do you mean a capacitor between the input for the IR and for the pot?

just to illustrate something, i put a lowpass filter on the potentiometer input cutting off all the way down at 15hz. i used a combo of 100R and 100uf using this formula and schematic:

however, upon connecting the IR's power lead to the breadboard, i still get unwanted frequencies. so - either this noise is even lower than 15hz, or the noise is still introduced AFTER my filtering.

furthermore, using capacitors of such high values is prohibitive because of how long it takes the capacitor to even out. i need my pots to be read fairly immediately.

It does sound like you have a larger issue.

finally made progress. finally finally finally.

you guys have been nice enough to bear with me.
until just now, i have been using little blue multilayer ceramic caps (which i identify as such by this page: Capacitors). i was using them across the sharp IR sensor with not much success.

i replaced the one across the sensor's v and g with a polarized electrolytic (100uf). then, when testing my potentiometer, i noticed that there was less noise (in the high and low ranges of the pot's movement). i then attached a 32 ohm resistor to the IR's power lead and voila - no noise on my pot input.

now, my new problem is that this added resistor screws up my IR's read of distance. on a 0-1023 scale, the IR reads vaues in the low 100s until i move my hand in front of it -- when i do that, it starts in the low 90s and works its way up to the 250s (highest it can go). when i drop my hand, the value goes back up to 100. this is undesirable because i want a more full range of motion, and i want the IR value to drop to as low as possible when my hand is removed.

i tried lowering the resistor value - the lowest i could go was 22, lower than that and the IR can't get power. i tried raising the resistor value: after 39, it also seemed i couldn't get power.

so - i will now try with a lower capacitor value to see if this helps lower the "no object seen" value of the IR.

any comments are welcome.