# Filtering a PWM signal from an IR Sensor

#### sgallant

Joined Apr 29, 2013
1
Hi. I am 13 years old and competing in Robocup jr. which is a robotic soccer competition using an IR ball that sends out a pulse modulated signal. Robocup staff suggested the competitors use a low pass filter to find the IR ball. They recommended we use 100k ohm resistor and a 1 µF capacitor.

http://rcj.robocup.org/rcj2009/newball/cheapRCJ05sensors-RobotDemos09.pdf

It works great but the response time is slow. I wanted to speed it up by making the resistor smaller but that increased the ripple voltage. I used the following website to calculate ripple voltage and settling time:

http://sim.okawa-denshi.jp/en/PWMtool.php

So my question is, what is the maximum ripple voltage that I can accept in my circuit? Thank you!

#### GopherT

Joined Nov 23, 2012
8,012
Check out page 9, "digital interface" of the link you attached. You can just measure time between small pulses (instead of using low pass filter that essentially removes the small pulses and filters them into be broad pulse).

#### crutschow

Joined Mar 14, 2008
23,776
Check out page 9, "digital interface" of the link you attached. You can just measure time between small pulses (instead of using low pass filter that essentially removes the small pulses and filters them into be broad pulse).
But isn't it the broad pulse he wants?

#### crutschow

Joined Mar 14, 2008
23,776
You can significantly improve the rise-time to ripple ratio by going to a higher-order active filter. For example a 2-pole Butterworth active filter (uses one op amp) will filter the ripple much better than a simple RC filter with the same rise-time (my simulations indicate about a 4:1 improvement). If you post your digital frequency and the rise-time you'd like I can give you more specific suggestions.

I don't know what ripple your circuit can tolerate. You would need to post the circuit.

Last edited:

#### Bernard

Joined Aug 7, 2008
5,335
Remember that design & construction is strictly up to the taam.

#### GopherT

Joined Nov 23, 2012
8,012
But isn't it the broad pulse he wants?
If he can take the risk that 3 pulses are sufficient to believe it comes from the ball, then no, he doesn't need the broad peak. If he wants all 10 pulses before he believes it comes from the ball, them yes, he wants the broad peak.

In the end it is a competition and he is asking how he can identify the signal faster than the low pass filter allows (when i did line following robots with my kids, it took about 5 pulses). Digital just becomes more effective. ir interference just doesn't exist on such a regular pulse width 3 square waves are good enough from my experience.