Posts

Showing posts from July, 2016

Make ultrasonic sensor more efficient with arduino

If you have seen my last post on ultrasonic sensor then i have some very basic trick to make ultrasonic sensor to give some efficient result by using averaging method i have done it.... the connection is same as my last post after done connection write this code const int t1 = 7; const int p1 = 8; void setup() {   Serial.begin(9600);   pinMode(p1, INPUT);   pinMode(t1, OUTPUT); } void loop() {   long duration1, cm1;   giveSignal(t1);   duration1 = pulseIn(p1, HIGH);   cm1 = microsecondsToCentimeters(duration1);   giveSignal(t1);   long duration2 = pulseIn(p1, HIGH);   cm2 = microsecondsToCentimeters(duration1);   giveSignal(t1);   long duration3 = pulseIn(p1, HIGH);   cm3 = microsecondsToCentimeters(duration1);   giveSignal(t1);   long duration4 = pulseIn(p1, HIGH);   cm4 = microsecondsToCentimeters(duration1);   giveSignal(t1);   long duration5 = pulseIn(p1, HI...

Arduino with Ultrasonic Sensor HC-SR04

Image
The HC-SR04 ultrasonic sensor uses SONAR to determine the distance of an object just like the bats do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package from 2 cm to 400 cm or 1” to 13 feet. The operation is not affected by sunlight or black material, although acoustically, soft materials like cloth can be difficult to detect. It comes complete with ultrasonic transmitter and receiver module. Follow the circuit diagram and make the connections as shown in the image given below. This code returns the distance in Inches... I think it's more accurate than other code I have seen online and returns more usable results. Write below program  const int t1 = 7; const int p1 = 8; void setup() {   Serial.begin(9600);   pinMode(p1, INPUT);   pinMode(t1, OUTPUT); } void loop() {   long duration1, cm1;   giveSignal(t1);   duration1 = pulseIn(p1, HIGH)...
Hello, It’s my first Arduino programming blog…… ☻☺