Filtering Sharp IR sensor's noise on power rail

I have some problems with Sharp GP2D120 IR distance sensor on my next robot, Hammer. Sharp seems to cause noise on the power rail and the noise gets to LM386N-1 audio amplifier making really annoying "ringing" from speaker. Or at least this is what I suspect. Check the embedded video for a sample of that noise (or go here: http://www.youtube.com/watch?v=WIQ0qY6gFpQ). The video starts with Sharp disconnected and then I connect and disconnect it couple of times.

Here's (more or less complete) schematic for my current setup (click to get bigger picture):

hammer-schema-01_small.jpg


Hammer’s schematic

Some explanation on the schematic:

  • MEGA8-P (IC1) = Atmel ATMega8-16PU (16MHz crystal)
  • Speakjet (IC2) = Speakjet speech synthesizer chip
  • Speakjet config jumpers control Speakjet M0, M1 and RST pins. Normally M1 and RST are high and M0 is low.
  • LM386N-1 (U1) = Audio amplifier chip
  • Motor controller = 2 x PWM and 2 x tri-state control lines (forward, backward, stop, pretty much the same as in here: https://www.robotshop.com/letsmakerobots/node/17370)
  • Bumpers = Bumper switched, not connected yet
  • "Evil Eye" = IR tracking 8 x phototransistor pack, not connected yet
  • Sharp = Sharp GP2D120

For testing I disconnected all servos and motors were stopped. When I started testing the Sharp the only capacitor on the power rail was 100uF electrolytic cap (C4). Here’s a picture on my test setup:

sharp-noise-setup-01.jpg


1 = Test point 1. Power from 4 x AA NiMH cells to breadboard power rail.
2 = Test point 2. Power from breadboard to Sharp. (Caps were placed here when I tried filtering)

At first I tested the sharp without any filtering. That means power from 4 x AA NiMH cells to breadboard and from there directly to Sharp. No caps. I measured voltage from power rail (+) at test point 1 (CH1 on scope pics) and also on ground (-) at test point 2 (CH2 on scope pics). Here’s what I got (click for larger image):

sharp-noise-no-caps-01_small.png


Same shot twice, only with different mV/div setting. There’s “square kind of” noise with sharp (pun intended) spikes.

The square noise from Sharp sensor consists of groups of 32 squares that are about 150us long and have frequency of about 1000Hz (1ms period). Groups have about 9ms silent period in between them. Here’s a picture to clear that up (click for full scale):

sharp-noise-no-caps-02_small.png


Square noise characteristics.

 

What have I tried so far:

After confirming that it was the Sharp causing the noise (connecting, disconnecting, see the video) I remembered RobotFreak’s post about noisy Sharps and how to fix it (see here: https://www.robotshop.com/letsmakerobots/node/22781). I tried that but I couldn’t get rid of the noise completely. I tried 100nF, 100nF with 10uF and 100nF with 100uF capacitors. I got best result when I used 100nF cap with 100uF cap. Noise coming from the speaker was decreased notably but it was still too loud and annoying. Adding another 100uF capacitor reduced the noise even further but adding third one didn’t seem to have any effect. Oscilloscope confirmed decreased noise levels too. Here’s how it looked like (click it):

sharp-noise-wo-and-with-filtering-01_small.png


Left: No filtering, middle: 100nF + 100uF, Right: 100nF + 2 x 100uF

I have also tried placing 100uF caps close to Speakjet’s and LM386’s power pins but that didn’t make any audible difference.

 

What I’ll try next and the question:

Next thing I’ll try, if there’s no other suggestions coming, is that I’ll get some bigger caps (over 100uF) and try adding those to Sharp.

Now the only this missing is the question (I hope you’re still reading this :-). So, are bigger caps going to help and is there something else I can try to make that annoying ringing disappear?

Thanks for reading. I hope I managed to explain this clearly enough for you to make sense (it’s getting really late and I’m tired).

 


 

Update Nov 3, 2010:

Last night, I tried IGs suggestion of using a voltage regulator to filter out the noise coming from Sharp. I got some interesting results using this kind of test setup:


1 = Test point 1 (CH1). Regulated side of the regulator. Sharp was connected here.
2 = Test point 2 (CH2). Unregulated side of the regulator. Power from 5 x AA NiMH cells was connected here.

The regulator I used was LM2937 5V/500mA Low Dropout Regulator. LM2937 had 100nF and 100uF caps on both regulated and unregulated sides. I tested Sharp first without any additional filtering and then with 100nF and 100uF caps added to Sharp. I had female pin headers soldered to Sharp to make it easier to try different caps.

sharp-noise-setup-02_small.jpg


Caps on Sharp. 100uF cap placed on pin headers and 100nF cap “holds on” to the other caps with its legs. Good enough for testing. Don’t use on robots :wink:

Here’s how it worked:

sharp-noise-regulator-01_small.png


1st row: No caps on Sharp. 2nd row: 100nF and 100uF caps added to Sharp.
CH1 = Regulated side (yellow), CH2 = Unregulated side (cyan)

The regulator seemed to act like a “noise splitter”. Sharp spikes were left to the regulated side and square kind of noise was on the unregulated side. When I tried the regulator trick on my robot using 4 x NiMH cells the noise coming from the speaker was considerably lower than before. At first I had 100uF capacitor on Sharp. Adding 3 (yes, three) more 100uF caps on Sharp reduced noise even more and noise level started to be bearable. When I tested this my batteries had voltage of 4.9V and the regulated side of my test setup had voltage of 4.8V. Not too bad voltage drop so it could be possible to use a voltage regulator “only as noise filter” with 4 x NiMHs.

Today I received a hefty package of electronics and it just happened to have some bigger caps among other things so I tried to add an extra 10000uF capacitor to the unregulated side of my test setup.


Sharp got a new friend.

Having that monster cap in the play made the noise disappear almost completely. I had to keep my ear really close to the speaker to hear the noise. I also tried putting that 10000uF cap to power line when there was no regulator in the play (Sharp had 100uF cap too). It seemed to reduce the noise to bearable level even without the regulator. Oscilloscope confirmed that when I measured the noise in the setup I had earlier (power directly from 4 x AAs, this pic: https://www.robotshop.com/letsmakerobots/files/userpics/u8860/sharp-noise-setup-01.jpg):

sharp-noise-with-10000uF-cap-01.png


Voltage drop on power rail is about 18mV (not counting those spikes). Without 10000uF cap voltage drop was 64-96mV depending on capacitors placed on Sharp (see this: https://www.robotshop.com/letsmakerobots/files/userpics/u8860/sharp-noise-wo-and-with-filtering-01_large.png).

So, Today’s conclusion: Voltage regulator helps. Bigger cap helps too. Next thing I’ll try is capacitors of different values. Too bad I don’t have any caps between 100uF and 10000uF values right now. I’ll have to order some to check how they would work.

Thank you, ignoblegnome, for your suggestion. It gave some interesting results.

 

https://www.youtube.com/watch?v=WIQ0qY6gFpQ

welcome to the club…

https://www.robotshop.com/letsmakerobots/node/5549

Have you tried using a

Have you tried using a voltage regulator instead of just powering directly from the batteries? A voltage regulator with appropriate caps on input and output may solve your problem.

Here’s a link to OddBot’s guide on power regulation. I refer to it often.

https://www.robotshop.com/letsmakerobots/node/3880

Thank you

It’s such a nice club. A little noisy, but nice :slight_smile:

I have to admit that I really didn’t think that these little buggers would cause that much noise on power rails. I was thinking that they just have somewhat noisy outputs.

 

+1That would be the first

+1

That would be the first thing I’d try.

Interesting idea

That’s an interesting idea. Too bad Sharp’s datasheet says “Operating Supply Voltage 4.5 to 5.5 V”. A 3.3V regulator would be easy to add to my current setup (4 x NiMH cells).

Anyway, I’ll do a little test with 5V regulator and 5 or 6 NiMH cells to see if it helps. If it does I’ll label this as plan C (plan B being ‘use a different sensor’).