Pages: [1]   Go Down
Author Topic: Ultrasonic Parking Sensor Help  (Read 2010 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just got an ultrasonic automotive style parking sensor in the mail that I'm trying to program via my Arduino UNO R3 but I'm having troubles getting steady readings off of it.  Here's the specs on the sensor:

  • Center frequency (KHz): 40±1.0KHz
  • Echo Sensitivity: ≥200mV
  • Decay Time: ≤1.2ms
  • Directivity (deg ) X-axis: 60±15
  • Directivity (deg ) Y-axis: 60±15
  • Capacitance ( pF ): 2000±15%
  • Allowable Maximum Input Voltage ( Vp-p): 140 (40KHz) Pulse width 0.5ms, interval 20ms

I'm a mechanical Engineer who's very new to Arduino and programming in general so can anyone help me with setting this bad boy up and running so I can start getting some good numbers in the Serial Monitor?  My current output only seems marginally affected by obstacles.  The output is always around 600-800.

Here's my code thus far:

Code:
int val = 0;

void setup() {

Serial.begin(9600);

}

void loop() {
 
  val = analogRead(0);
 
  Serial.println(val);
 
 delay(1000);
 
}
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is the link to the datasheet?

From those spec's it sounds like a bare transducer - that won't do anything very useful.

For ultrasonic ranging you need to fire a high power pulse of 40kHz (at perhaps 30 to 50V using a tuned step-up transformer) through the transducer to create a "ping".  You then disconnect the drive electronics and attach a sensitive analog amplifier to listen for the returning echoes.  The delay from send to receive gives the distance.

So unless the device comes with a transmitter and receiver electronics it isn't going to do what you think I'm afraid.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is the link to the datasheet?

From those spec's it sounds like a bare transducer - that won't do anything very useful.

For ultrasonic ranging you need to fire a high power pulse of 40kHz (at perhaps 30 to 50V using a tuned step-up transformer) through the transducer to create a "ping".  You then disconnect the drive electronics and attach a sensitive analog amplifier to listen for the returning echoes.  The delay from send to receive gives the distance.

So unless the device comes with a transmitter and receiver electronics it isn't going to do what you think I'm afraid.

Hmm, well I hope I ordered the right thing!

Here's the link to the eBay page:

http://www.ebay.com/itm/280724584131?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

So am I going to need additional electronics to get this thing working?
« Last Edit: November 01, 2012, 11:14:16 am by atvman29 » Logged

Toledo, OH
Offline Offline
God Member
*****
Karma: 35
Posts: 508
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is the link to the datasheet?

From those spec's it sounds like a bare transducer - that won't do anything very useful.

For ultrasonic ranging you need to fire a high power pulse of 40kHz (at perhaps 30 to 50V using a tuned step-up transformer) through the transducer to create a "ping".  You then disconnect the drive electronics and attach a sensitive analog amplifier to listen for the returning echoes.  The delay from send to receive gives the distance.

So unless the device comes with a transmitter and receiver electronics it isn't going to do what you think I'm afraid.

Hmm, well I hope I ordered the right thing!

Here's the link to the eBay page:

http://www.ebay.com/itm/280724584131?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

So am I going to need additional electronics to get this thing working?

Yes, you'll need additional electronics, a lot of them.  This is just the sensor with leads.  It doesn't include any type of circuit to fire and time the sensor.  Many have asked how to build such a firing/measuring circuit, but realistically it is far too complex to do.  You should look for a parking distance control board that's designed for car parking distance sensors.  I've seen them on eBay also.  Even then, these control boards don't typically include any type of datasheet, so you could still have problems getting the distance data.  In all cases, the sketch will be more complex than just reading an analog pin like in your sketch, I don't know of any ultrasonic sensor that works that way.

Good luck!

Tim
Logged

Arduino - Teensy - Raspberry Pi
My libraries: NewPing - LCDBitmap - toneAC - NewTone - TimerFreeTone

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


HELP!!!!!!!!!!

int sensor = A0;
int Buzzer = 12;
int ledred1 = 11;
int ledred2 = 10;
int ledred3 = 9;
int ledyellow = 8;
int ledgreen = 7;




void setup()
{
 
  pinMode(sensor,INPUT);
  pinMode(ledgreen,OUTPUT);
  pinMode(ledyellow,OUTPUT);
  pinMode(ledred1,OUTPUT);
  pinMode(ledred2,OUTPUT);
  pinMode(ledred3,OUTPUT);
  Serial.begin(9600);
}
 
 
void loop()
{
 
  float distance = 12343.85 * pow(analogRead(sensor),-1.15);

 
  Serial.println(distance);
  delay (50);


void setup()


Serial.begin(9600);


if (Distance <=10)

}
 digitalWrite(ledgreen,HIGH);
 digitalWrite(ledyellow,HIGH);
 digitalWrite(ledledred1,HIGH);
 digitalWrite(ledledred2,HIGH);
 digitalWrite(ledledred3,HIGH);
 digitalWrite(ledledred4,HIGH);
 
}
      if((Distance <=10) && (value > 20))
      {
 digitalWrite(ledgreen,HIGH);
 
      if((Distance <=20) && (value > 30)) 
      }
  digitalWrite(ledyellow,HIGH);
      if((Distance <=30) && (value > 40)) 
    {
 digitalWrite(ledred1,HIGH);
 
      if((Distance <=20) && (value > 30)) 
      {
  digitalWrite(ledred2,HIGH);
      if((Distance <=50) && (value > 60)) 
         {
  digitalWrite(ledred3,HIGH);
      if((Distance <=50) && (value > 60)) 
        {
  digitalWrite(ledred4,HIGH);
      if((Distance <=50) && (value > 60)) 

}

void setup()   {
 


}
tone(Buzzer,3000);
delay(1000)
noTone(Buzzer);

void loop()
{

 
}


 
 
 


  }
 
Logged

Connecticut, USA
Offline Offline
Full Member
***
Karma: 8
Posts: 180
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's some help:
1. Post code properly
2. Be as specific as possible in describing what help you need.
Logged

It's all about the skills

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Many have asked how to build such a firing/measuring circuit, but realistically it is far too complex to do.

FWIW I'm currently bouncing ultrasonic pulses from a cheap 40kHz transducer off the ceiling of my office, and detecting the reflection without difficulty. Range to the ceiling is about 1.7m. I'm driving the transducer directly from an Arduino PWM pin via an inductor and capacitor, so it's only getting a little over 5V p-p. I'm using a high-bandwidth dual op amp to amplify the received signal by about 2000, and feeding that to the ADC to detect the signal (which involves running the ADC at a clock rate above the recommended 1MHz, so that I can sample at 80kHz). Running the transmitter at higher power (e.g. the 30-50V that MarkT suggests) would allow me to use lower gain in the receiver, or obtain increased range.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many have asked how to build such a firing/measuring circuit, but realistically it is far too complex to do.

FWIW I'm currently bouncing ultrasonic pulses from a cheap 40kHz transducer off the ceiling of my office, and detecting the reflection without difficulty. Range to the ceiling is about 1.7m. I'm driving the transducer directly from an Arduino PWM pin via an inductor and capacitor, so it's only getting a little over 5V p-p. I'm using a high-bandwidth dual op amp to amplify the received signal by about 2000, and feeding that to the ADC to detect the signal (which involves running the ADC at a clock rate above the recommended 1MHz, so that I can sample at 80kHz). Running the transmitter at higher power (e.g. the 30-50V that MarkT suggests) would allow me to use lower gain in the receiver, or obtain increased range.



Hi, dc42, are you able to teach me how you send the pulses off a transducer and detect their echo? For short distance application like 1m. I am trying to implement this usage and after some googling I came to this arduino page. Thanks.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For 1m range I think a ping sensor such as HC-SR04 would probably be sufficient and much easier than what I am doing. My application is really an ultrasonic modem. I was only bouncing the signal off the ceiling because that was a convenient way of testing it.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: