Ping ))) Radar

Hi Everyone,

I have seen that you can make an arduino radar by using a ping))) sensor, an arduino, and a processing sketch. I'm hoping that someone can direct me to a tutorial on how this can be achieved. I'm looking to an output similar to this:
(Arduino Radar Using PING Ultrasonic Module - YouTube)
or this
(arduino radar - YouTube)

Thanks,
Mr_E

Break the problem down:

  1. driving the sonar unit.
  2. driving the servo
  3. transmitting the results to Processing
  4. receiving the results in Processing and plotting them.

AWOL:
Break the problem down:

  1. driving the sonar unit.
  2. driving the servo
  3. transmitting the results to Processing
  4. receiving the results in Processing and plotting them.

Exactly. I have obtained a ping))) and successfully gotten it working with my arduino uno and serial. I need help with transmitting the results to processing and plotting the results as a radar screen in processing.

Thank You,
Mr_E :astonished:

I need help with transmitting the results to processing and plotting the results as a radar screen in processing.

If you're transmitting the results to the PC, then you can transmit to Processing, so you don't need help there.
The rest is all Processing then.
Break it down further.

  1. Read a line of results
  2. parse the results into variables.
  3. Polar plot the variables.

And how would I do that? I'm just a beginner :frowning:

I'm pretty sure there are Processing examples showing how to receive strings and then break them down into numbers.
Then you need to concentrate on how to plot those values.

I'm just a beginner

We all have to start somewhere.

mr_electric:
And how would I do that? I'm just a beginner :frowning:

Keep taking small steps.

eg: this uses Processing to provide a very basic display for Ultrasonic sensors http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/ultrasound.html

There's also an instructive page about "Using Processing to Send Values using the Serial Port to Arduino" at http://luckylarry.co.uk/arduino-projects/using-processing-to-send-values-to-arduino/.

The same site goes on to implement a "Radar Screen" using Processing at http://luckylarry.co.uk/arduino-projects/arduino-processing-make-a-radar-screen-to-visualise-sensor-data-from-srf-05-part-1-setting-up-the-circuit-and-outputting-values/

Thanks, I'm going to try and see if I can modify that processing sketch to suit my needs. I am surprised that there are no tutorials on the ping))) radar.

Thanks,
Mr_E XD

I am surprised that there are no tutorials on the ping))) radar.

So am I:

(it's a sonar, not a radar)

Nice find AWOL.

Not really - it is (IMO) one of the poorer code examples, but at least it demonstrates the power of a simple search.
(Compiled but not tested - I don't have a Ping)

const int pingPins [] = {7};
const int nPings = sizeof (pingPins) / sizeof (pingPins [0]);

void setup() 
{
  Serial.begin(9600);
}

void loop()
{
  for (int i = 0; i < nPings; ++i) {
    unsigned long range = pingRange (pingPins [i]);
    Serial.print (i);
    Serial.print(" ping ");
    Serial.print(microsecondsToInches(range));
    Serial.print("in, ");
    Serial.print(microsecondsToCentimetres(range));
    Serial.println("cm");
    delay(20);    // wait a while for the echoes to die away
  }
}

unsigned long pingRange (int pingPin)
{
  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  
  return pulseIn(pingPin, HIGH);
}

unsigned long microsecondsToInches(unsigned long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

unsigned long microsecondsToCentimetres(unsigned long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimetre.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

As in tutorial, I meant one on creating a radar screen with ping. I found one online that uses an arduino and an ultrasonic sensor to make a screen, but that one uses a different sensor. Currently, I'm trying to modify the code to suit my needs.

Thanks again,
Mr_E

P.S. I'll be sure to post a tutorial with ping once I get this sorted out.

I found one online that uses an arduino and an ultrasonic sensor to make a screen, but that one uses a different sensor.

That's why abstraction is important - it should not matter whether the range information comes from a Ping, a real RADAR or Sharp IR range sensor (or a length of string)

Don't get too bogged-down in specifics.

AWOL:

I found one online that uses an arduino and an ultrasonic sensor to make a screen, but that one uses a different sensor.

That's why abstraction is important - it should not matter whether the range information comes from a Ping, a real RADAR or Sharp IR range sensor (or a length of string)

Don't get too bogged-down in specifics.

I agree, what such range sensors have in common is that they are all "flight of time" sensors where the time duration between sending a pulse and receiving a echo is proportional to the sensing range, regardless of the medium used, RF, ultrasonic, IR, laser, etc.

Lefty

I'm still wring on it. All I need to do on the code is modify it to print the distance values as x,y values On serial.

An alternative sensor:

$25 for a module that does the "send a pulse/ wait for echo/ report time taken" stuff for you.

Evangalist warning: The people from whom Sparkfun buys this thinks it appropriate to put "Jesus First" on the PCB. If this bothers you, then you are warned, and can "vote with your wallet", but, please... if you feel that needs further discussion, take it to the thread already thriving at the Sparkfun product page?

Claimed to be able to report 20 distance readings per second.

Evangalist warning: The people from whom Sparkfun buys this thinks it appropriate to put "Jesus First" on the PCB

I just thought they were being fish-ist.

I modified the code for the arduino, but the processing sketch isnt recognizing my serial port. It comes up as RXTX mismatch...
I'm going to try and post it in the processing forums too.

Thanks,
MR_E

RXTX mismatch can be safely ignored most of the time - print out the available serial ports and see if there are any available when you run Processing. Make sure the Arduino IDE is closed too - only one can run at once.

@Lefty:
Pretty sure you're going for "Time of Flight", not "Flight of Time"... xD. Also, Sharp IR sensors are triangulation based, not time of flight.

The real similarity is that they all give you a known distance value, which can be converted into a universal scale (For ex. metric).