IR Range Finder Issues

merthsoft

New Member
Hello, I am currently doing a research project for my university making robots, and I'm trying to get a range finder so it won't run into walls. I bought this:
http://www.hvwtech.com/products_view.asp?ProductID=89
And the problem is that when the sensor is plugged in to the power, it freezes the chip (even with a capacitor). I don't exactly know what's going on with the chip, I just know that it stops whatever it's doing until the sensor is unpluged, and it will then go back to execution wherever it was.
Does anyone know what the problem could be?
Thanks.
 

eclectic

Moderator
Welcome to the Forum.

Could you please post

1. Your circuit/schematic
2. Your program

3. If possible, a photograph of your setup.

e
 

MPep

Senior Member
If you have a fast MIN-MAX voltmeter, try to find out what the voltage supply rail is doing?
 

Dippy

Moderator
Andrew: Yes, it is. Well spotted.
There must be kiddes around the world wondering why their little device is playing up.

(Another example of things being posted without peir review and then others accepting Internet projects as 'Gospel'. Its called Wiki-itis).

But first, lets see what circuit was used by Merthsoft.

Merthsoft, have you tested the sensor alone to see if it is faulty?

If it isn't faulty then it's something you've done and without a schematic or clear photo then we're into guessing-games. Many people have used this device (and similar) with no issues.
Also describe your power supply details.
 

merthsoft

New Member
Alright, here's a picture of it, it's nothing too fancy:

I've got +5 going to the sensor, and then ground with a capacitor like that website said between it and the output, with the output going into B.4 (ADC11). Here's the code:
Code:
let adcsetup = %100000000000
main:
	readadc 11, b0
	sertxd("The rangefinder reads: ", #b0, 13, 10)
	pause 100
	goto main
But I can't even get the code onto the chip when the rangefinder is plugged in.
As far as testing the sensor (and I have four of them, and tried with all four), I've used a multimeter to read the voltage it gives off and it seems right.
Thanks for the help so far, I hope this helps even more!
[EDIT]
As for the power situation, it's a powered breadboard (E&L Instruments C.A.D.E.T. II) and I'm using +5V.
[EDIT 2]
Restored to original image.
 
Last edited:

hippy

Technical Support
Staff member
Does downloading work when the blue wire and capacitor are disconnected from the PICAXE ?
 

merthsoft

New Member
The only time downloading works is when the sensor doesn't have power through it, so when either the black or red wire is unplugged.
 

boriz

Senior Member
At 5v, the Sharp GP2D12 draws rapid current pulses of up to 250mA. This can easily effect your Picaxe by making the +5v line droop in sympathy unless it is properly filtered and sufficiently powerful. Also, that IS NOT a 4.7uF cap. (Probably wrong by three orders of magnitude!).

I also don’t see the obligatory 100nF cap across the Picaxe power pins.

You need to re-read the Picaxe manual and the Sharp datasheet.
 

merthsoft

New Member
I don't see in the manual where it says I need the 100nF cap across the Picaxe power pins, though I'm aware I could be missing something. This is the image I get on page 37:

That I'm using. Though I did have some capacitors across there when I had the motors on the same power line, now they're on a different one, so I took them out. They're on there now. I've got a real 4.7uF capacitor on there now. I'm a little naive with this stuff, so pardon the mistake. Now, in the manual that was shipped with the sensor, it says nothing about pulsing, is there a better manual I should be using?
Here's the updated image:
 

Dippy

Moderator
Your image: Is there a big capacitor between Blue and Ground?
If so, why?
Any capacitor should be across the Red/Black of that IR thingy.

As I suggested before, have you actually tested the GP2D12 without it connected to PICAXE?
Have you measured the supply current to check it against spec?
Have you measured the ananlogue O/P (Blue wire)?
Have you measured the +5V line with and without the GP2D12 connected? I haven't got a clue as to the specification of a E&L Instruments C.A.D.E.T. II is as I've never heard of one.

Can you programme PICAXE when GP2D12 is powered BUT blue wire removed?

I don't think PICAXE MAnual mentions a decoupling cap across PICAXE power pins.
It is not always necessary but it is recommended (by experienced users/developers) to have one fitted to reduce noise getting into PIC chip.
And also it recommended by Microchip to ensure performance of the PIC - and as they make the things then they should know.
"To ensure these voltage tolerances, VDD and VSS must be capacitively decoupled as close to the device as
possible. 0.1 μF and 0.01 μF values in parallel are recommended."
- from a PIC 16F88x Data Sheet.
 

merthsoft

New Member
Aha, you rock, Dippy. Putting the capacitor in the right place (not where that website said to...) made it stop freezing. I had tested it, and the voltage was correct(ish?). When something gets too close to the sensor, the voltage ends up dropping back down (so it'll read about 2.5 at 10 cm, as per the sheet, but once it gets closer it'll drop down to 1.5 or so). But I have it running now with the PICAXE, and the debug reports sensible things. Thanks for all your help. Also, that sheet you posted is nothing at all like what they sent me, and is 100xs more helpful. I guess I should've googled this a little more, and saved all of us some time, sorry about that.

As far as a schematic, is there any good software for drawing one up? I've got my scribblings in my notebook, but no scanner, and I can barely read those.

Once again, thanks everyone for all of your help :D
 

Dippy

Moderator
Excellent news.

MORAL... ALWAYS READ the MANUFACTURER'S DATA SHEET.
Not the one copied by little Dicky onto the vendor's website.
:)

Now you can email them and tell what prats they are (??) and how many man-hours they have wasted. Just kidding, but do tell people if they have made a mistake.
 

lbenson

Senior Member
>As far as a schematic, is there any good software for drawing one up?

ExpressPCB has free schematic and PCB software (but the PCB program doesn't output standard files, so you can only make PCBs through the vendor). I found the program easy to use (unlike Eagle) in that what a Windows user would expect to happen with click and drag and the like usually did happen.

Others like Diptrace, and Eagle has its own adherents--both have features not available with ExpressPCB.
 

slimplynth

Senior Member
Tall Order

Reading through this thread and having little time for practical efforts at the minute made me realise that I needed to learn in more detail how to diagnose circuit problems. I bought this book from maplins; "Getting The Most From Your Multi Meter" - A fiver well spent I thought.

Can anyone suggest any other good book titles that I can carry around with me, ideally thin?
 
Last edited:

Rickharris

Senior Member
...

Can anyone suggest any other good book titles that I can carry around with me, ideally thin?
Good fault finding principles:

Make sure whenever possible that each individual bit is working before you connect them together.

If you get a serious fault - Heat - Smoke Funny sounds disconnect power at once and ceck with your multimeter for short circuits - Correct polarity - things inserted the right way.

If you have a dead circuit check the batteries and their connections - check the voltage on the PCB NOT at the batteries. I got fooled once by trapping the insulation in the terminal block and not the wire. Battery fine - no volts on the board.

If curcuit is behaving funny try to eliminate as much complex hardware and software as possible - go back to basic program and prove each part.

If tracing signals - try looking in the middle of the circuit first - If you find the signal you expect the fault is closer to the output

If you don't find the signal the fault is closer to the input, halve the circuit again and retest until faulty part is identified.
 

hippy

Technical Support
Staff member
Can anyone suggest any other good book titles that I can carry around with me, ideally thin?
A single laminated bit of paper which says "Go for a walk" and "Sleep on it" on the other side can work wonders :)

Both tried and trusted techniques which do work as many here will attest to.
 

boriz

Senior Member
@merthsoft

Your original picture showed a small ceramic disk capacitor, possibly only a few pF. After I pointed this out, the capacitor was replaced and another picture uploaded. Not mentioning that you did this makes my “that IS NOT a 4.7uF cap” comment look a bit silly doesn’t it. Thanks for that.
 

Dippy

Moderator
Don't sulk Boriz:)
I can't see the difference between the two pictures anyway.
(or is it a 'Spot The Dfference' competition?)

Besides, I've seen 100nF ceramics much, much smaller than that, so it could easily be a thousand times geater than "only a few pF".

Anyway, don't worry about it - no-one looks that far back and reads the posts ;)
 

slimplynth

Senior Member
A single laminated bit of paper which says "Go for a walk" and "Sleep on it" on the other side can work wonders :)

Both tried and trusted techniques which do work as many here will attest to.

Sage advice Hippy, there's deffinitely positive correlation between levels of frustration and the number of fried components on my desk... RIP SRF05.. should replace that - with the smaller SRF models though, Servo mounted is the plan for the UAV Blimp, to determine it's relative position in the (a) room.. with IR beacon check points...

Our Fusion Welding Audit was passed today with flying colours, free time to tinker again - excellent.
 

boriz

Senior Member
“I can't see the difference between the two pictures”
The fact that you said that shows you missed the original picture, and the original mistake merthsoft made. As will everyone else viewing this thread, now and forever.

Like I already said. The picture has been replaced. The new pictures (both) show an electrolytic where the original had “a small ceramic disk” that was obviously not in the uF range. An easy mistake to make for a newbie. But to change it without remark, put’s my response (that I can see he’s obviously using the wrong capacitor) into a different context. Now do you understand Dippy?

Perhaps it would be better if I just retrospectively delete my posts, like merthsoft retrospectively deletes his pictures? But then what do future forum users learn? What’s this forum for anyway?
 

Dippy

Moderator
I see now... I didn't see the absolute original.
Yes, I agree, it doesn't help when original stuff is deleted or modified.
I have seen other more experienced contributors do the same - especially if they've said something silly (or plain wrong) and are embarrassed. One or two contributors with over a thousand posts have done it...

Yes, it loses the flow and often ruins the train of discussion. But you can't stop it.

If you feel embarrassed/cross/humiliated then feel free to delete/modify your earlier stuff.
Or you can just forget it and move on ... everyone else will :)
(After all, your complaint is for all to see in the future)

I say plenty of silly things but I couldn't give a monkey's ;)
 

boriz

Senior Member
I say silly things. DO give a monkeys. But bite the bullet and leave it anyway. I rarely edit my posts, preferring instead to add separate remarks in a subsequent post so that my reasoning, however faulty, can be followed and perhaps even learned from. After all, that’s what mistakes are for.
 

merthsoft

New Member
Oh man, sorry boriz, that was never my intention. I named the file the same thing without thinking about the fact that it'd change the image of the forum (a stupid move, I know). It's back to the orriginal image. Once again, I'm really sorry for that boriz, I was not trying to spite you, expecially since you helped.
 

BeanieBots

Moderator
A good list of fault finding tips from Rick. In particular the one about starting in the middle.
I've witnessed experienced test engineers spend hours working down a line looking for a fault. If your circuit has 65000 nodes, you can find the fault with just 16 tests using a binary search method.

In addition to trying find/rectify the fault, be honest with yourself.
If you know/suspect that you applied 12v to your PICAXE, DON'T waste hours trying to fault find a download problem. You already know it will NEVER download another program.

When prototyping, ALWAYS use IC sockets. Removing/replacing ICs makes the process infinitely easier.
 
Top