Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: ArtBot on December 23, 2011, 10:56:12 AM

Title: Noisy servo interfering with IR sensor
Post by: ArtBot on December 23, 2011, 10:56:12 AM
This is my first attempt at an Arduino-controlled robot and I'm still on the lower foothills of the learning curve when it comes to electronics, so please be gentle ;)

My robot currently has a servo (Modelcraft RS-2) used to turn a 'head' holding a couple of sensors (those sensors aren't important - they're working fine).

I also have an IR sensor switch from DFRobot (http://www.dfrobot.com/index.php?route=product/product&path=36&product_id=114 (http://www.dfrobot.com/index.php?route=product/product&path=36&product_id=114)) which works fine by itself (using it via an interrupt on the Arduino). The problem is that whenever the servo operates, it triggers the IR sensor. I suspect the servo is causing enough of a power drain to cause the sensor connection to go low.

The problem arises when I use a 9V battery or USB to power the Arduino (motors are powered separately) but disappears when I use a more powerful LiPo cell, which is why I'm thinking it's a power drain problem.

I'm using a pull-up resistor (10K) on the sensor and a decoupling capacitor (2.2uF) across the servo. Doesn't seem to help. I'm thinking 'diode' but am too rapidly running out of talent.

Any pointers? I'm happy to experiment but benefit from being nudged in the right direction.
Title: Re: Noisy servo interfering with IR sensor
Post by: Webbot on December 23, 2011, 12:27:43 PM
Where are you powering the servo from - they can take quite a bit of current. ie your 9V battery (which if its the old rectangular ones cant produce much power) to power the Arduino and then use another power source (whose voltage is ok for the servo) to power the servo - just make sure you connect the two grounds together.
Title: Re: Noisy servo interfering with IR sensor
Post by: ArtBot on December 23, 2011, 02:07:04 PM
The servo is currently being powered from the +5V supply from the Arduino, so I guess that's the problem.
Title: Re: Noisy servo interfering with IR sensor
Post by: Webbot on December 23, 2011, 02:35:06 PM
Yep - the regulator on the Arduino is probably rated at around 1A. So if you put any stress on the servo (ie it cant rotate coz there is a table leg in the way) then the servo current requirements will go up (one servo can easily take 1 amp) and this may fry the Arduino voltage regulator. So always keep motors/servos on their own power bus.

Title: Re: Noisy servo interfering with IR sensor
Post by: ArtBot on December 23, 2011, 03:37:35 PM
Thanks for the tip - I'll try that...