Ultrasonic range finder Help!

Hi is there anyone who can help me please?

I have built this ..

http://www.micro-examples.com/public/microex-navig/doc/090-ultrasonic-ranger.html

I have tried to use the ping sensor code from examples with some modifications .. but can not get it to work. can someone please help me modify the code for the Arduino?

thanks

Barberrouge: Hi is there anyone who can help me please?

I have built this ..

http://www.micro-examples.com/public/microex-navig/doc/090-ultrasonic-ranger.html

I have tried to use the ping sensor code from examples with some modifications .. but can not get it to work. can someone please help me modify the code for the Arduino?

thanks

A couple of questions:

1) Did you use -exactly- the same parts as were used in the original? 2) Have you verified that it is working without the Arduino (using a dual-trace scope to show ping sent and reflection)?

You need to first know that the circuit is working to send an ultrasonic pulse, and receive it; once you know that (and how well it is working), then you can concentrate on getting the code working (which really shouldn't be too complex).

:)

I thought the Ping code, whatever it is, as you didn't post a link, is used for a Ping ultrasonic ranger, not your homebrew. The ping sensor has electronics on board, not just a pair of speakers.

hi thanks for the reply.

this is the code I've tried to use ..

int outputPin = 3; // set you output pin int inputPin = 4; // set your input pin long distance; long cm; void setup(){ Serial.begin(9600); // set your baud rate pinMode(outputPin, OUTPUT); pinMode(inputPin,INPUT); } void loop()

{ digitalWrite(outputPin, LOW); delayMicroseconds(2); digitalWrite(outputPin, HIGH); delayMicroseconds(10); digitalWrite(outputPin, LOW); distance = pulseIn(inputPin, HIGH); //it now initalizes before setup to speed up the process cm= distance/58; //I don't like reusing the same variable name, it probably works fine though, //but i don't really trust it, besides you have plenty of memory for it. Serial.println(cm); delay(500); // this will slow down your readings to 2 per second it should help when watching the Serial terminal // if this helps then start to shrink it down to 100 then 10 then 1, maybe even go to microsecond delays or remove completely if it stops freezing }

sensors is from an old robot vacuum cleaner

and I've tried to upload some pictures of my project .. I'm pretty new to this and need a push in the right direction.

excuse my ignorance

The link you posted mentioned no "ping" at all. It's a homebrew, not parallax ping (http://www.parallax.com/tabid/768/ProductID/92/Default.aspx)

You code is not small modification from the home brew sensor, but copied from a program for ping sensor. It won't work however hard you try.

My suggestion, read this (http://www.parallax.com/Portals/0/Downloads/docs/prod/acc/28015-PING-v1.6.pdf) see if you understand a bit and work out your program. You need to generate sound pulses not pulse. Get help if necessary.

Alternatively, you can just buy a ping and save yourself some trouble.

You need to generate sound pulses not pulse

You also need to amplify the returned echo.