Let's Make Robots!

Proximity Sensor Problem

I have an Picaxe-18x and 4 servos conencted to 4 AA batteries. The picaxe (on 4.5v) and servos (on 6v) work fine when i turn on the power however when i connect my proximity sensor to the circuit, the servos stop spinning and the microcontroller also stops working. When i take out the proximity sensor and turn of and on hte ciruit, everything works fine.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ALRIGHT!!!! It worked. I added a 10uF capacitor and the everything works even when the sensor is in the circuit. I checked the output of the sensor on my voltmeter and it outputs! THANKS EVERYBODY!!!
alright i will try adding the capacaitor ill get back to you guys in a few days, lol
Out of curiousity, what effect does the capacitor have on the sensor?
If the sensor is dropping the voltage too much the capacitor should be able to absorb it. The problem could be something completely different, but adding the cap won`t hurt it and some sites recommend adding one.
Its a Sharp IR Distance Sensor GP2D120. Thank you for yoru replies! My theory is that the proximity sensor uses too much power? When i debug with just the Sensor plugged in (All 3 Wires) the information comes slowly. For example theres usually a count on the debug window for which iteration the microcontoller is running the code and theres a 5~10 second pause between iteration 1 to 2. sometimes it just stops also. The circuit only has the Sensor and PicAxe on it.

The voltage may be too low for the sensor to function properly. I assume you are using alkaline batteries. You would be better off using NiMh rechargeables and run everything on 4.8V.  Use the disablebod command to disable brownout detection and make sure you have the sensor wired correctly.


Add an electrolytic capacitor across the red and black wires of the sharp IR, as close as possible to the sensor. Watch the polarity. Try anything from 22uF up.
Tell me more (link please) about these metal-finding prox sensors you speak of... This might be better than my "turn into a line follow when you get close" system of going to "home base".... More input!!!

Hey CtC,

  Here is a link to the Keyence type


  We use a lot of these at work. Sensing range is usually from 2mm to 8mm depending on the prox. sw. diameter. Bigger senses farther away. They have varieties to sense ferrous and non-ferrous material. Let me look in my spare stuff box at work Monday and see what I can find. Probably be able to send you some samples to play with. I know I have some 6mm sizes that sense from 0.5mm to 2mm. These sensors are lots of fun to work with.

A Proximity Switch comes in 2-wire and 3-wire versions. Never used the 2-wire type. The 3-wire type operates like a Sharp IR sensor. You have a red [usually +5-24 vdc], black [0vdc] and white input to Picaxe ADC input pin. When a metal (specifically steel) comes within sensing range of the prox. switch end an output signal goes to the PicAxe input pin. This signal is a constant output until the metal moves out of sensor range and then drops to nothing. These operate much like most IR detectors so I am not sure why you would have a problem like this one.

  Post a link to the datasheet of the prox. switch you are using. Most seem to be Balluff, Turck or Keyence.