Sci.Electronics.Basics

on Electronics-Related.com

  Home  |  Books  |  Sci.Electronics.Design  |  Sci.Electronics.Basics  |  Resources  |  Contact  | 
Sign in
username:

password:

Remember Me

Not a member?
Search Sci.Electronics.Basics

Search Tips

Sci.Electronics.Basics -> Looking to filter the noise on a Sharp IR sensor

There are 7 messages in this thread.
You are currently looking at messages 1 to 7.






Author: Kasterborus
Date: 18:45 26-05-08

I just hooked up a Sharp GP2D12 IR range sensor to a scope and saw
that the output is very noisy. The sensor updates at 25Hz so I was
thinking that if I were to add some kind of 25Hz low pass filter to
the output that would clean things up.

Datasheet:
http://www.philohome.com/sensors/gp2d12/gp2d12-datasheets/gp2d12.pdf

The sensor also operates at 0-2.45v so a gain of 2 from the filter
would be useful to bring it in line with the 5v range of my ADC.

I thought about this circuit

http://www.radio-electronics.com/info/circuits/opamp_low_pass_filter/op_amp_lowpassfilte
r.php

But it is unity gain - could it be modified to give a higher gain?

Dave

Author: Bob Monsen
Date: 19:30 26-05-08


"Kasterborus" <kasterborus@yahoo.com> wrote in message
news:745aed1a-fbee-4b02-ad46-0f25d4e409e8@k37g2000hsf.googlegroups.com...
>I just hooked up a Sharp GP2D12 IR range sensor to a scope and saw
> that the output is very noisy. The sensor updates at 25Hz so I was
> thinking that if I were to add some kind of 25Hz low pass filter to
> the output that would clean things up.
>
> Datasheet:
> http://www.philohome.com/sensors/gp2d12/gp2d12-datasheets/gp2d12.pdf
>
> The sensor also operates at 0-2.45v so a gain of 2 from the filter
> would be useful to bring it in line with the 5v range of my ADC.
>
> I thought about this circuit
>
>
http://www.radio-electronics.com/info/circuits/opamp_low_pass_filter/op_amp_lowpassfilter.
php
>
> But it is unity gain - could it be modified to give a higher gain?
>
> Dave


You can use this page to design the analog filter:

http://www.analog.com/Analog_Root/static/techSupport/designTools/interactiveTools/filter
/filter.html

It allows you to set the gain to be whatever makes sense, and computes the
right component values.

However, if you are interfacing with a microcontroller, then you might want
to use a digital filter instead. You can easily average the output over
time, and save on the external components. You still need an RC filter to
eliminate high frequency noise, since a digital filter will alias
frequencies higher than 1/2 the sampling frequency into the baseband if you
don't filter them out. You can control the gain with a digital filter as
well. There are websites that will design any kind of digital filter for you
(i.e., a java app). They usually use floating point, though. For this
application, I've used a simple RC filter, along with an averaging loop like
this:

forever {

while (!sample_available()) {
do_something_else();
}

average = (average << 3) - average + get_sample();
average >>= 3;
// do something with the average here
}

This gives each sample an exponential decay.

If that simple filter doesn't work, there are lots of others to choose from.
The choice of filter will depend on the application.

Regards,
Bob Monsen


Author: Tim Wescott
Date: 00:50 27-05-08

Bob Monsen wrote:
> "Kasterborus" <kasterborus@yahoo.com> wrote in message
> news:745aed1a-fbee-4b02-ad46-0f25d4e409e8@k37g2000hsf.googlegroups.com...
>> I just hooked up a Sharp GP2D12 IR range sensor to a scope and saw
>> that the output is very noisy. The sensor updates at 25Hz so I was
>> thinking that if I were to add some kind of 25Hz low pass filter to
>> the output that would clean things up.
>>
>> Datasheet:
>> http://www.philohome.com/sensors/gp2d12/gp2d12-datasheets/gp2d12.pdf
>>
>> The sensor also operates at 0-2.45v so a gain of 2 from the filter
>> would be useful to bring it in line with the 5v range of my ADC.
>>
>> I thought about this circuit
>>
>>
http://www.radio-electronics.com/info/circuits/opamp_low_pass_filter/op_amp_lowpassfilter.
php
>>
>>
>> But it is unity gain - could it be modified to give a higher gain?
>>
>> Dave
>
>
> You can use this page to design the analog filter:
>
>
http://www.analog.com/Analog_Root/static/techSupport/designTools/interactiveTools/filter/f
ilter.html
>
>
> It allows you to set the gain to be whatever makes sense, and computes
> the right component values.
>
> However, if you are interfacing with a microcontroller, then you might
> want to use a digital filter instead. You can easily average the output
> over time, and save on the external components. You still need an RC
> filter to eliminate high frequency noise, since a digital filter will
> alias frequencies higher than 1/2 the sampling frequency into the
> baseband if you don't filter them out. You can control the gain with a
> digital filter as well. There are websites that will design any kind of
> digital filter for you (i.e., a java app). They usually use floating
> point, though. For this application, I've used a simple RC filter, along
> with an averaging loop like this:
>
> forever {
>
> while (!sample_available()) {
> do_something_else();
> }
>
> average = (average << 3) - average + get_sample();
> average >>= 3;
> // do something with the average here
> }
>
> This gives each sample an exponential decay.
>
> If that simple filter doesn't work, there are lots of others to choose
> from. The choice of filter will depend on the application.
>
> Regards,
> Bob Monsen
>
Ditto all of this, except that if most of the noise is coming from the
detector, and if the detector is really updating at 25Hz, and if you can
sample synchronously with that 25Hz update, then an anti-alias filter
probably won't do much good.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html

Author: Kasterborus
Date: 07:40 27-05-08

Thanks for the suggestions - I'll give them a try.

Author: Chris
Date: 07:51 27-05-08

On May 26, 5:45=A0pm, Kasterborus <kasterbo...@yahoo.com> wrote:
> I just hooked up a Sharp GP2D12 IR range sensor to a scope and saw
> that the output is very noisy. The sensor updates at 25Hz so I was
> thinking that if I were to add some kind of 25Hz low pass filter to
> the output that would clean things up.
>
> Datasheet:http://www.philohome.com/sensors/gp2d12/gp2d12-datasheets/gp2d12=
.pdf
>
> The sensor also operates at 0-2.45v so a gain of 2 from the filter
> would be useful to bring it in line with the 5v range of my ADC.
>
> I thought about this circuit
>
> http://www.radio-electronics.com/info/circuits/opamp_low_pass_filter/...
>
> But it is unity gain - could it be modified to give a higher gain?
>
> Dave

Hi, Dave. Your noise problem will certainly be reduced (and probably
eliminated) with good layout practices and bypassing. You could do
worse than starting out with a .01uF to .1uF ceramic cap in parallel
with a 22uF electrolytic right across the power pins of the sensor.

The 0-2.5V analog output means you only lose one bit of resolution
with your ADC. Might not be worth setting up a filter with a gain of
two to bump it up. If you still have residual noise after bypassing,
try a simple R-C filter to cut some of the higher frequency stuff:

|
| VCC
| + VCC
| | +
| .---o---. | |
| | | | |
| | | D - |
| | GP2D12| ^ |
| | | ___ | ___ |
| | o-|___|-o---|___|---o uC
| | | R | R |
| | | --- |
| | | C --- |
| | | | |
| | | =3D=3D=3D |
| | | GND |
| '---o---' |
| | R =3D 2.2K
| =3D=3D=3D C =3D 0.1uF
| GND D =3D 1N4148
|
(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

Chris

Author: Frnak McKenney
Date: 08:22 27-05-08

On Mon, 26 May 2008 15:45:54 -0700 (PDT), Kasterborus <kasterborus@yahoo.com> wrote:
> I just hooked up a Sharp GP2D12 IR range sensor to a scope and saw
> that the output is very noisy. The sensor updates at 25Hz so I was
> thinking that if I were to add some kind of 25Hz low pass filter to
> the output that would clean things up.

You might check the archives of comp.robotics.misc. I recall several
discussions about the amount of current that some (all?) of the
Sharp IR rangers consumed.

I do know from personal experience that an IR remote control unit
such as the Siemens SFH506 (admittedly a slightly different device)
can go from "flaky" to "fantastic" when a 100Ohm/100uF filter is
added to keep the device's voltage up.

Hope this helps...


Frank McKenney
--
Government is the great fiction, through which everybody
endeavors to live at the expense of everybody else.
-- Frederic Bastiat, French Economist
--
Frank McKenney, McKenney Associates
Richmond, Virginia / (804) 320-4887
Munged E-mail: frank uscore mckenney ayut mined spring dawt cahm (y'all)

Author: Bob Monsen
Date: 19:21 27-05-08

"Kasterborus" <kasterborus@yahoo.com> wrote in message
news:efdcce7c-07f7-4ccd-883d-a040937fe9ef@r66g2000hsg.googlegroups.com...
> Thanks for the suggestions - I'll give them a try.


Ah, one other thing, those sharp sensors take a big current spike when they
power the LED. Depending on your setup, you may actually be seeing the
spikes on your A/D input.

The solution for this is a big cap (like 100uF) near the power inputs for
the sensor, which will smooth the power supply.

Note that this only matters if you are using a small supply that can't keep
up. Scope the power input to see if it makes a difference.

Regards,
Bob Monsen


1


      Contact  |  Electronic Portal


Sci.Electronics.Basics by Keywords
ADC
Antenna
CAD
Coil
Generator
IDE
LCD
Modulator
MOSFET
NiMH
Opamp
Oscilloscope
PID
RS232
Telephone
Transformers
TTL
USB

Sci.Electronics.Basics By Author