2 Ultrasonic sensor

Hi guys, i tried to use two ultrasonic sensor where one is transmitter and another is receiver. I triggered the 1st ultrasonic sensor , but i didnt receiver any output in 2nd sensor. Is there any way to do that?

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Also details of your sensors.

Tom… :slight_smile:

int trigpin = 11;
int echopin = 12;

void setup(){
  pinMode(trigpin,OUTPUT);
  pinMode(echopin,INPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}
void loop(){
  long duration;
  long distance;
  digitalWrite(trigpin,LOW);
  digitalWrite(9,LOW);
  delayMicroseconds(2);
  digitalWrite(trigpin,HIGH);
  digitalWrite(9,HIGH);
  delayMicroseconds(10);
  digitalWrite(trigpin,LOW);
  digitalWrite(9,LOW);
  
  
  duration = pulseIn(echopin,HIGH);
  
 // distance=duration/58;
  Serial.println(duration);
  delay(250);
}

This is my code. I dont have images, but its ordinary connection of 2 ultrasonic sensors.

kaathi524: This is my code. I dont have images, but its ordinary connection of 2 ultrasonic sensors.

OK, you write absolutely nothing about specification or type/model of "ultrasonic sensors" you are using, but your code looks like you are using the well known HC-SR04 sensors.

The HC-SR04 sensors will only watch out for an echo after they are triggered.

So you need to trick the sensors: Connect the Arduino 'trigpin' to the trig pin of BOTH sensors! That way both sensors are triggered in the same microsecond, and if the air between both sensors is free of obstacles, the echo pin of one sensor will receive the sound from the second sensor. And the other way round.

If there are obstacles on the way and one sensor might receive object echos of its own sender or sound of the other sender, then you'd have to strip the sender from one of the modules, so that both sensors are triggered, but actually only one sends out the ultrasonic ping.