INTERFACING ULTRA SONIC SENSOR WITH BHARAT -PI

by madhankarthick in Circuits > Sensors

263 Views, 0 Favorites, 0 Comments

INTERFACING ULTRA SONIC SENSOR WITH BHARAT -PI

q.jpg

Ultrasonic sensors are in available for the past many decades and these devices continue to hold huge space in the sensing market because of their specifications, affordability, and flexibility. As the automation industry has been progressing, the employment of ultrasonic sensors in multiple domains such as drones, EV vehicles is emerging. In the year 1914, Fessenden developed the first modern transducer employed in sonar where it can be able to find the items in water but not the direction of items. And then in the year, 1915 Langevin introduced the contemporary model of ultrasonic which resolved the problem of Fessenden.  ultrasonic sensor definition, how it works, it’s specifications, its integration with Bharat pi , and its advantages are explained clearly in this article.

ULTA SONIC PINOUT

pin.jpg
Block-Diagram-2.png

Vcc – This pin has to be connected to a power supply +5V.

TRIG – This pin is used to receive controlling signals from the Arduino board. This is the triggering input pin of the sensor

ECHO – This pin is used for sending signals to the Arduino board where the Arduino calculates the pulse duration to know the distance. This pin is the ECHO output of the sensor.

GND – This pin has to be connected to the ground.

The below block diagram shows the ultrasonic sensor block diagram for distance measurement.



The target’s distance is calculated using an ultrasonic distance sensor and the output from the sensor is provided to the signal conditioning section and then is processed using an Arduino microcontroller. The results from the microcontroller are fed to the LCD display and then moved to a personal computer.

The ultrasonic sensor can be connected to the servo motor to know the polar distance of the sensor up to 1800 rotations approximately.



REQUIREMENTS

wires.jpg
Artboard-1-e1686767346235.jpg
sonic sensor.jpg

·      Bharat-pi (board)

·      Jumper wires

·      Aurdinno-ide

·      Ultra Sonic Sensor

 

Interfacing ULTRA SONIC SENSOR WITH BHARAT -PI

Screenshot 2023-09-15 114415.png
WhatsApp Image 2023-09-08 at 11.22.24.jpg
WhatsApp Image 2023-09-08 at 11.22.27.jpg

Setup:

1.   Connect the Echo pin of the sensor to the 27 pin of the Bharat pi.

2.   Connect the Trig pin of the sensor to the 32 pin of the Bharat pi.

3.   Navigate to Tools and select board and port.

4.   Verify and compile the code, then upload the code to the Bharat pi board.

5.   Monitor the output in the Serial monitor (Set the baud rate as 9600). To open Serial monitor Tools>Serial Monitor or (Ctrl+Shift+M).


STEP5-SOURCE CODE AND PROGRAMMING

1649279368-Ent-2022Python.jpeg

#define echoPin          \

27// attach pin D2 Arduino to pin Echo of HC-SR04

#define trigPin          \

32// attach pin D3 Arduino to pin Trig of HC-SR04          \

 

long duration; // Variable to store time taken to the pulse

   // to reach receiver

 

int distance; // Variable to store distance calculated using

   // formula

 

void setup()

{

 pinMode(trigPin,

   OUTPUT); // Sets the trigPin as an OUTPUT

 pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT

 

 // Serial Communication is starting with 9600 of

 // baudrate speed

 Serial.begin(9600);

 

 // The text to be printed in serial monitor

 Serial.println(

  "Distance measurement using Arduino Uno.");

 delay(500);

}

 

void loop()

{

 digitalWrite(trigPin, LOW);

 delayMicroseconds(2); // wait for 2 ms to avoid

      // collision in serial monitor

 

 digitalWrite(

  trigPin,

  HIGH); // turn on the Trigger to generate pulse

 delayMicroseconds(

  10); // keep the trigger "ON" for 10 ms to generate

   // pulse for 10 ms.

 

 digitalWrite(trigPin,

    LOW); // Turn off the pulse trigger to stop

     // pulse generation

 

 // If pulse reached the receiver echoPin

 // become high Then pulseIn() returns the

 // time taken by the pulse to reach the

 // receiver

 

 duration = pulseIn(echoPin, HIGH);

 distance

  = duration * 0.0344 / 2; // Expression to calculate

        // distance using time

 

 Serial.print("Distance: ");

 Serial.print(

  distance); // Print the output in serial monitor

 Serial.println(" cm");

 delay(100);

}

 

code in git hub : https://github.com/Madhankarthick/proximity-sensor-code-bharat-pi/blob/2433badf19f3e3b20ecfb48da17a15b3a2a194b0/proximity%20sensor.txt

Advantages and Disadvantages of Ultrasonic Sensor

Principle_of_ultrasonic_sensor_480x480.jpg
28o54euyjh.jpg

Advantages

  • These devices are not impacted by the target’s color.
  • The device shows flexibility in its distance measurement range where it holds the capability of measuring in the range of a few centimeters to five meters.
  • It provides consistent outcomes and shows high reliability.
  • High precision device.
  • The measurements can be made every second thus showing rapid refresh rates.

Disadvantages

Even though ultrasonic sensors employ versatile technology, there are a few limitations to be considered and those are:

  • As sound speed is based on humidity and temperature, environmental circumstances might show an impact on the accuracy while measuring the distance.
  • For minimal and embedded projects, ultrasonic sensors seem to be a not good option because these devices are large to integrate with small projects.
  • These sensors will not function in a vacuum.
  • The sensors will get dirt, wet and frozen which results in errors while measuring or the functionality gets impacted.


Applications

1-9-500x418.jpg
dd.jpg
1-17-696x389.jpg

The applications of ultrasonic sensors are:

  1. Used in robotic sensing for positioning of robotic arms.
  2. Employed in washdown design for constantly noticing the filling level of objects on a conveyor belt.
  3. Used to detect objects.
  4. The diameter of the coil/roll can be known by ultrasonic sensors.
  5. Used to avoid a collision.
  6. Proximity detection.

Where are ultrasonic sensors used?

The primary usage of ultrasonic sensors is proximity sensors where we can find these sensors in the anti-collision safeguarding domain and vehicle self-parking technologies.

What can an Ultrasonic sensor detect?

Ultrasonic sensors are used for the detection of distance for an extended range of targets irrespective of the target’s surface, color, and shape.

This is all the concept of ultrasonic sensors. Here the article has explained the ultrasonic sensor working principle, its specifications, integration with Arduino, and its applications. Know how the ultrasonic sensor gained prominence in IoT?


VIDEO

interfacing ultra spnic sensor using bharat pi