Jump to content
Arduino.lk Community Sri Lanka
  • Announcements

    • Team Arduino.lk

      Arduino Stater Kit 2 එකක් දිනාගන්න.   11/13/2017

      arduino.lk community වෙත ඔබව සාදරයෙන් පිළිගනිමු. ඔබගේ ගැටළු අදහස් මෙහි පළකර Rs 3650.00 වටිනා Arduino Stater Kit 2 එකක් දිනාගන්න. ඔබ කල යුත්තේ Arduino, හා සම්බන්ධ අදහස්, ලිපි, කමෙන්ට් මෙහි පල කර මෙහි ඇති LeaderBoard එකේ පළමු තැනට පැමිණීමයි. සැම මාසකම අවසාන දින 11.55 PM හොදම Contributor තෝරනු ලැබේ
    • Team Arduino.lk

      Arduino Uno r3 දැන් Rs 950.00 යි.   11/13/2017

      Arduino Uno r3 දැන් Rs 950.00 යි. ගෙදරටම ගෙන්වා ගන්න දැන්ම පිවිසෙන්න https://shop.arduino.lk

Search the Community

Showing results for tags 'ultrasonic'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Genaral
    • Welcome
    • News
  • Arduino
    • Installation & Troubleshooting
    • Programming in Arduino
    • General electronics
    • Microcontrollers
    • LEDs and Multiplexing
    • Displays
    • Motors, Mechanics and Power
    • Sensors
    • Network Protocols and Devices
    • Storage
    • Construction
    • Documentation
  • Other
    • Tutorials
    • Arduino Projects
    • Off-Topic
    • Jobs / Job offers
  • NSBM Arduino Club's Topics
  • STEM education of srilanka's Stem srilanka
  • CSNE Ardunio (Atmel Studio)'s Atmel Studio

Calendars

  • Community Calendar

Blogs

There are no results to display.

There are no results to display.

Categories

  • Files
  • eBooks
  • Datasheets
  • Library
    • Sensor
    • Modules
    • Shields

Categories

  • Articles

Categories

  • Lessons
  • Tutorials

Found 1 result

  1. sensor HC-SR04 Ultrasonic Sensor

    The HC-SR04 is an ultrasonic distance sensor. It detects the distance of the closest object in front of the sensor (from 2 cm up to 3m). It works by sending out a burst of ultrasound and listening for the echo when it bounces off of an object. The Arduino board sends a short pulse to trigger the detection, then listens for a pulse on the echo pin. The duration of this second pulse is equal to the time taken by the ultrasound to travel to the object and back to the sensor. Using the speed of sound, this time can be converted to distance. Hardware Required Arduino Board (1) HC-SR04 Ultrasonic Distance Sensor Jumper wire Circuit The 5V pin of the HC-SR04 is connected to the 5V pin on the Arduino, the GND pin is connected to the GND pin, and the Trigger pin is connected to pin 8 and the Echo pin is connected to pin 9 on the Arduino. /* HC-SR04 for Arduino Original project from http://www.arduino.lk This project demonstrates the HC-SR The distance presented in the code is in mm, but you can uncomment the line for distance in inches. The schematics for this project can be found on http://www.www.arduino.lk This example code is in the public domain. */ const int TriggerPin = 8; //Trig pin const int EchoPin = 9; //Echo pin long Duration = 0; void setup(){ pinMode(TriggerPin,OUTPUT); // Trigger is an output pin pinMode(EchoPin,INPUT); // Echo is an input pin Serial.begin(9600); // Serial Output } void loop(){ digitalWrite(TriggerPin, LOW); delayMicroseconds(2); digitalWrite(TriggerPin, HIGH); // Trigger pin to HIGH delayMicroseconds(10); // 10us high digitalWrite(TriggerPin, LOW); // Trigger pin to HIGH Duration = pulseIn(EchoPin,HIGH); // Waits for the echo pin to get high // returns the Duration in microseconds long Distance_mm = Distance(Duration); // Use function to calculate the distance Serial.print("Distance = "); // Output to serial Serial.print(Distance_mm); Serial.println(" mm"); delay(1000); // Wait to do next measurement } long Distance(long time) { // Calculates the Distance in mm // ((time)*(Speed of sound))/ toward and backward of object) * 10 long DistanceCalc; // Calculation variable DistanceCalc = ((time /2.9) / 2); // Actual calculation in mm //DistanceCalc = time / 74 / 2; // Actual calculation in inches return DistanceCalc; // return calculated value }
×