Sharp IR problems,,,

Even though i finished my SHR months ago, building this new one with my little bro is causing all sorts of headaches! My problem now is the IR sensor No matter what pin it is reading from it only ever reads out 134 or 127 randomly. I dont own a multimeter so I have no real wat to test the picaxe board. Any thoughts?

update!

Thanks to birdmun, I did find out that the IR has power (I looked at it through a camera and saw the light) So I know its being powered, Its just giving weird results

 

I am also curious

What is the model number on your sensor?

Did you know that there are both analog and digital versions of the sharp sensors? The digital versions actually output a number that must be read rather than an analog voltage that can be converted to a “number”.

Is your microcontroller sampling correctly?

Maybe your a/d converter is not working correctly? You could try by using like a 10k resistor, connect it to your board’s ground and to your sampling pin on the uC. Do the same but connect the resistor to the board power.

You could also go to a gas station and buy a very cheap multimeter??

this is the one!

GP2Y0A21 Sharp distance sensor

Aha analog

So its the analog type. Can you give some background info? Does another specimen work with your hardware or is the problem in the sensor itself maybe?

Is the sensor mounted on a

Is the sensor mounted on a metal frame? The housing of the Sharp sensors is conductive. It needs to be isolated or mounted on plastic/wooden frame

 

well…

Not much in the way of background info… I was going through the SHR with my litle bro and this is the part we got stuck on. We were at this part 



Enter this code into your editor, and press F5 while the robot is connected:


main:

readadc 0, b0

debug

goto main


Now take your hand in front of the robot´s head and notice how the variable b0 changes value. You can use the knowledge gained to decide what should happen and when (how close things should get before…)

You may notice how things start to go “wrong” if stuff is too close to the “eyes”; The Sharp is made to work with objects 10-80 cm away. Things that are closer than 10 cm (4 inches) appear to be further way, which can be quite a challenge to program.

You can get many other distance sensors that do not have this problem. However the Sharp is the cheapest, and easiest to program, so that’s why I made such a “bad” choice for you, sorry :wink: Look around and see what everyone else is using, before you decide on an upgrade."

We just cant get it to say anything ither than thos numbers

also,

Its not mounted on anything. We had it being held

(No subject)

oh!

And I got it from solarbotics

that sounds safe

Then it probably is what it says, an analog sensor.

Still, have you tried if your analog sampling is working or not? You could use anything between 0 volt and the powersupply voltage to hook up to ADC 0. Even a potmeter so you can experiment.

Then you can sort out if it is the sensor or the controller/code

Get a multimeter and measure

Get a multimeter and measure the voltage on the IR sensor. If it’s to low (lower than 4.5V) the sensor will not work properly. If the voltage is ok, your sensor is dead.

please forgive my ignorance…

Im not really sure hat your asking here:

 

"Still, have you tried if your analog sampling is working or not? You could use anything between 0 volt and the powersupply voltage to hook up to ADC 0. Even a potmeter so you can experiment."

I have to wait a bit to pick up a multimeter, the family is in a bit of a crunch. 

no worries

What I meant was since you have no multimeter: use your A/D converter in your microcontroller to sort out your problem.

By connecting a resistor to your powersupply and the other end to the ADC input your a/d value should go to the max value, by connecting the same resistor to ground should give nearly zero. If this does not work the problem is in the microcontroller or code, not the sensor.

But RobotFreak’s suggestion is by far the best, I suggest too that you get a cheap multimeter. Just hook it up to your sensor, set it in DC V mode and observe while you move your hand to and away from the sensor. You should see a broad variaty of voltages displayed. If so then the sensor is working.

update!

I did the resistor test and now Im thinking its the sensor. The picaxe reacted the exact way Robodve said it would with the ressistor applied, so Im not sure whats up witht eh sensor. Im thinking of going to a Ping sensor… any thoughts?

Even Better Update… FIXED IT!!!

So I kept looking at the SHR directions… I felt like I was missing something… I kept looking at the wiring Fritz had and staring at my little bros bot. Something didnt seem right. Then it hit me. The factory got the wires wrong. The wire cable that comes from the sensor had a wire crossed. When it came out the “servo” tip, the positive and signal were mixed. I cut the end off and put on my own female headers. After putting each cable into teh place I saw on the SHR pics, it spang to life! I have to get used to the distance measuring but it seems to work great! Thank you all for your help and if anyone else has issues like mine, remember that factory mistakes happen!

Very good targetdg15! Nasty

Very good targetdg15! Nasty that the manufacturer did the wiring wrong. I’m glad you could use the resistor trick to sort out which is the problem. Hopefully in the near future you can own a multimeter, that makes life a lot easier.

I had the same

Hi,

I just had the same problem.
I connected the Sharp to a analog in using the supplied cable, and something started to smell funny.
After turning off power, and inspecting i noticed the wires were wrong.
I can’t get the thing to work, it seems fried, and just spits out random numbers.

I hope I can get a replacement, and i hope it didn’t fry my input…

Patrick

problem…!!
Did it work for you?? An having the same sharp ir nd am using picaxe 28 project board… I can see dim light from my sharp ir… But it is nt returning any value…