Capacitor for filtering Sharp IR sensor.

Hello.

// I know this was somehow discussed before but I am not sure it is ok to digg up old threads.

I have a sharp IR sensor, with working range from 20mm to around 150mm the problem is that its returned values are not very stable, it has “spikes”, the manual recommends connecting a 10uF capacitor around ground and +.
Manual: sparkfun.com/datasheets/Sensors/Infrared/gp2y0a02yk_e.pdf

I am not sure what is the right capacitor for this, I just found that there are polarized and non-polarized capactors :-?
What I purchased today looks similar to this:

clickpartelectronics.com/images/10%20uf%20electrolytic%20capacitor.jpg

(sorry, forum doesn’t let me post images directly, you have to copy/paste url :frowning: ).

But mine shows zeros on that white strap, not “-”

My questions:

  • is this the one I need for this?
  • if this is polarized, then can I link two of these together to get a non-polarized one?
  • just to be sure: how should this be soldered? One end to the ground and one to the + ?

Thanks.

Most larger value capacitors are electrolytics like the picture you posted and are polarized - they need to be connected the right way round. Usually the shorter lead is the cathode (-) and the longer lead the anode (+). Electrolytics usually have a band or something marking the cathode as illustrated. Lower Voltage types are usually smaller and cheaper (16v is a common voltage) and are good for arduino use. You connect the - to gnd and the + to the data/ 5v pin. There shouldn't be a problem with the one illustrated. You can't connect polarised electrolytics 'back to back' as the one connected the wrong way round would take a dim view of it and possibly explode. Non polarised electrolytics are available but there is little point in using them for Arduino.

http://www.google.com/images?client=ubuntu&channel=fs&q=electrolytic+capacitor&oe=utf-8&um=1&ie=UTF-8&source=univ&ei=XYjlTPrDKMeGhQfCyMXsDA&sa=X&oi=image_result_group&ct=title&resnum=4&ved=0CF8QsAQwAw&biw=1600&bih=710

Thanks for the reply pluggy. Yes, it has a white stripe on shorter pin. Actual values on mine are: 10uF 50V 85º (4W) Is it ok to use? :o

Is it ok to use

More than OK it is virtually bullet proof for what you want to do with it.

Something must be wrong, I am afraid not to fry the Uno board. With just Adruino and capacitor it works ok, but when I connect the sensor, the Arduino software doesn't seem to find the board anymore, it says that COM 3 cannot be found and these errors under it ... Any ideas? :-?

Serial port COM 3 not found
_________________________________

at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4235)
...

EDIT: it worked after a few disconnects, I am not sure if it is because of the capacitor. I still see spikes though, I cannot see an improvement; maybe sensor values are just not as stable as I expected. :-/

I am not sure if it is because of the capacitor.

No it is not. It could be you were shorting the supply or drawing too much current from it.

I cannot see an improvement;

If you have connected it correctly then there should be an improvement. The other thing to try is averaging the results in software.

maybe sensor values are just not as stable as I expected

That is a distinct possibility.

Since you mentioned drawing too much current... I used the IR sensor with a piezo buzzer and I was supposed to use a resistor with the buzzer but I didn't. The resistor is supposed to limit the amount of power draw from the board?

http://arduino.cc/en/uploads/Tutorial/speaker_bb.png

Not using a resistor will damage the pin it is connected to but wouldn't cause the system to disconnect like you are seeing.