Bi-Directional Visitor Counter using single ultrasonic sensor with LCD

  Переглядів 42,877

Robotica DIY

Robotica DIY

6 років тому

Bi-Directional Visitor Counter using single ultrasonic sensor with LCD
Scroll down for code.....
Please like & Subscribe for more videos
If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.
LIST OF COMPONENT (affiliate links)
amzn.to/2fvSRJq (Arduino)
amzn.to/2yBk7eT (LCD display)
amzn.to/2zg8aeX (I2C)
amzn.to/2vmUlLw (Ultrasonic sensor)
amzn.to/2wxPmWz (Breadboard)
amzn.to/2vJ3lvo (Jumper wire)
#include (Wire.h) //instead of parenthesis () put angle bracket as UKposts description does not allow angle bracket
#include (LiquidCrystal_I2C.h)
#define trigPin 13
#define echoPin 12
// Find LCD address for I2C in this tutorial it is 0x3f
LiquidCrystal_I2C lcd(0x3f, 16, 2);
int counter = 0;
int currentState1 = 0;
int previousState1 = 0;
int currentState2 = 0;
int previousState2 = 0;
int inside = 0;
int outside = 0;
void setup()
{
// initialize the LCD
lcd.begin();
//Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("IN: ");
lcd.setCursor(8, 0);
lcd.print("OUT: ");
lcd.setCursor(0, 1);
lcd.print("Total Inside: ");
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance (= 9){
currentState1 = 1;
}
else {
currentState1 = 0;
}
delay(100);
if(currentState1 != previousState1){
if(currentState1 == 1){
counter = counter + 1;}
lcd.setCursor(14, 1);
lcd.print(counter);
inside = inside +1;}
lcd.setCursor(4, 0);
lcd.print(inside);
if (distance ) 9 && distance (= 18){
currentState2 = 1;
}
else {
currentState2 = 0;
}
delay(100);
if(currentState2 != previousState2){
if(currentState2 == 1){
counter = counter - 1;}
lcd.setCursor(14, 1);
lcd.print(counter);
outside = outside +1;}
lcd.setCursor(13, 0);
lcd.print(outside);
lcd.setCursor(14, 1);
lcd.print(counter);
if (counter ) 9 || counter ( 0){
lcd.setCursor(14, 1);
lcd.print(counter);
delay(100);
lcd.clear();
}
}

КОМЕНТАРІ: 65
@vrushalikatta9226
@vrushalikatta9226 5 років тому
sir, i want bidirectional relay using 2 ultrasonic sensors and lcd, can you give me the programming related to this.
@erfandaniel6586
@erfandaniel6586 5 років тому
How can i change the statement in lcd, means the words with single sensor
@petersundayudoh9965
@petersundayudoh9965 5 місяців тому
Please what type of power supply was use for this project?
@15-md.shadmanshakib28
@15-md.shadmanshakib28 5 місяців тому
brother...program telling you have used 20*4 lcd..did you??
@electronicsideas1361
@electronicsideas1361 Рік тому
It's good Idea but can we make rpm counter and objet counter in one lcd?
@shamshareshaik4159
@shamshareshaik4159 5 років тому
can the Range of the Sensor is increasable
@ab...1
@ab...1 3 роки тому
How to set counting limit inside the display I.e. edit display...
@gaminginspace7731
@gaminginspace7731 5 років тому
Can u have joystick connected to it and how
@sreeragaraj2580
@sreeragaraj2580 3 роки тому
How about the delay provided???
@technoshrinivas
@technoshrinivas 11 місяців тому
Sir from where I want to give supply for working this project
@Hariomyadav-sb5fl
@Hariomyadav-sb5fl 5 років тому
How can I use the same code using serial monitor plzzz help
@abhisekmohanty5978
@abhisekmohanty5978 6 місяців тому
Sir how can I contact your account this project. Coz I'm trying but i can't complit it.
@Jyotika_Nilgar_0707
@Jyotika_Nilgar_0707 2 роки тому
2nd row of lcd is not displaying anything and in 1st row only the black boxes are displayed not the letters plz tell me the solution
@hamsaranirajarathinam8055
@hamsaranirajarathinam8055 3 роки тому
Can I get report for this project from you?
@purabjindal7296
@purabjindal7296 4 роки тому
how to make it without i2c module
@kpinnovations6613
@kpinnovations6613 3 роки тому
How can I add a relay when people counter is one relay is one when people is 0 relay will be off
@muhammadadeel891
@muhammadadeel891 5 років тому
sir what library do you used for i2c
@AyushSaxena-zw8pb
@AyushSaxena-zw8pb Рік тому
LCD_I2C
@navin7088
@navin7088 Рік тому
It is showing no matching function for call to 'LiquidCrystal_I2C::begin()'
@bonsanchez3231
@bonsanchez3231 2 роки тому
How use buzzer when 10.people inside was the buzzer active
@sandilemthabela9913
@sandilemthabela9913 Рік тому
lcd.begin(); isn't working it says there is an error
@GAMER-wc6lb
@GAMER-wc6lb 4 роки тому
How to on lights when person enters and off when there is no person in room
@3m_art001
@3m_art001 4 роки тому
Can u tell me the code for relay Like if one person enters then the light turns on and when there is no one in the room the light turns off?? Btw big fan
@RoboticaDIY
@RoboticaDIY 4 роки тому
Ultrasonic sensor is not suitable for application you want, It can be easily done with PIR motion detection sensor, its range is 6 to 7 meter and it detects human and animal. I have made video you can watch ukposts.info/have/v-deo/pHycZYptgaiDy4U.html
@shubhamchachan6440
@shubhamchachan6440 4 роки тому
My circuit is not working please help me out of these please give me ur mail so that I can send u all details
@AyushSaxena-zw8pb
@AyushSaxena-zw8pb Рік тому
To reduce the wiring
@vaibhav3458
@vaibhav3458 4 роки тому
My lcd screen is showing a bright light after adding the program What should i do???
@RoboticaDIY
@RoboticaDIY 4 роки тому
adjust potentiometer.. it will work.
@AmazingMj07
@AmazingMj07 3 роки тому
if its single door its don't work :(
@sportsbossph
@sportsbossph 6 років тому
Hi SIr i try to follow but my screen is just blue but no problem with my code, no text displaying do you what happen? thank you much
@RoboticaDIY
@RoboticaDIY 6 років тому
Grumpy Creative If you are using I2C, adjust lcd contrast by adjusting potentiometer on I2C.
@sportsbossph
@sportsbossph 6 років тому
thank you so much by the way i have one last question ... how to put limit in counting entrance for example the maximum inside is 10 so i will limit to 10 then if it will go to 11 there will be an error that says room is full? newbie here.. thank you Btw i'll subscribe you deserved more than it...
@RoboticaDIY
@RoboticaDIY 6 років тому
add this line after "counter = counter+1" line, for room is full counter = counter + 1;} if(counter > 10){ lcd.clear(); lcd.print("Room is Full"); // room is full } add this line for limiting visitor is not a negative number, just after "counter = counter-1" line, counter = counter - 1;} if(counter < 0){ lcd.clear(); lcd.print("Room is Empty"); // room is empty }
@abdullaalmasum4945
@abdullaalmasum4945 5 років тому
Thank you very much, but can we add an alarm like When the room is full,,the alarm will turn on...
@shubhamchachan6440
@shubhamchachan6440 4 роки тому
But in video u have not added potentiometer
@lammabij1864
@lammabij1864 3 роки тому
Can i use IR sensor instead
@AyushSaxena-zw8pb
@AyushSaxena-zw8pb Рік тому
Yes you can use.. But you have to use 2
@user-pg4rd9tv5u
@user-pg4rd9tv5u 3 місяці тому
Which language?
@bossmac5484
@bossmac5484 5 років тому
my lcd screen is just blank i need help. the lcd is on but black blocks no numbers or letters.
@shubhamchachan6440
@shubhamchachan6440 4 роки тому
Yes same
@felixprabowo321
@felixprabowo321 3 роки тому
same do u have any sollution bout that?
@PawanSharma-wg6vf
@PawanSharma-wg6vf 3 роки тому
@@felixprabowo321 adjust pot on i2c
@neetapatel9032
@neetapatel9032 4 роки тому
Bro how to increase length of and sensor it is 9cm I need more then 20 cm tell me fast
@RoboticaDIY
@RoboticaDIY 4 роки тому
You have to change two things first change in Line number 40 if (distance 20 && distance
@angelap5897
@angelap5897 4 роки тому
0:57
@sneraas
@sneraas Рік тому
This is not bi-directional, it's still only sensing movement in the Z-axis, uuuuuuuunhelpfull
@shubhamchachan6440
@shubhamchachan6440 4 роки тому
In this no requirement for potentiometer
@RoboticaDIY
@RoboticaDIY 4 роки тому
we are using I2C, so no need of potentiometer, I2C has its own potentiometer on board, you can it is in blue color.
@reginejoyaguilera6343
@reginejoyaguilera6343 5 років тому
It count countinously even no motion detected
@RoboticaDIY
@RoboticaDIY 5 років тому
make sure you place sensor atleast 20cm apart from all object. means front area should be clear.
@azizaja8255
@azizaja8255 5 років тому
@@RoboticaDIY if it more than 20cm that sensor not working?
@nonfungibletrauma
@nonfungibletrauma 3 роки тому
What if theres someone inside already?
@pritamsamanta47
@pritamsamanta47 3 роки тому
kick them out!!!
@pierricdoublet6248
@pierricdoublet6248 4 роки тому
Marche pas !!!LCD reste blanc !
@chandragirikondababu5079
@chandragirikondababu5079 5 років тому
Sir how to get download code and how it write.
@RoboticaDIY
@RoboticaDIY 5 років тому
visit roboticadiy.com/bi-directional-visitor-counter-using-single-ultrasonic-sensor-with-lcd/ you can copy code and paste in Arduino IDE then upload code to arduino.
@shubhamchachan6440
@shubhamchachan6440 4 роки тому
how to add 12C library
@RoboticaDIY
@RoboticaDIY 4 роки тому
Download library from link mention below in the description. Open Arduino IDE > Sketch > include library > ADD .zip Library > find where you downloaded libary in zip file. > click ok. DONE!!!
@psp759
@psp759 4 роки тому
Give me the code
@RoboticaDIY
@RoboticaDIY 4 роки тому
Please check description
@psp759
@psp759 4 роки тому
Robotica DIY I want to establish when we move the object in and out in a straight line
Arduino Play Despactio
3:41
Robotica DIY
Переглядів 3,9 тис.
Visitor Counter Without Microcontroller
6:23
Mousa - Simple Projects
Переглядів 11 тис.
BRAWLER MUTATIONS WILL BREAK THE GAME! - Brawl Talk
09:34
Brawl Stars
Переглядів 25 млн
Automatic Visitor Counter | Arduino Projects
8:01
Tech Trends Shameer
Переглядів 10 тис.
PEOPLE COUNTER (NEW CONCEPT) part1
4:37
Bestonic lab
Переглядів 46 тис.
Arduino Tutorial 32# How to make Bi-Directional Visitor Counter
2:49
Robotica DIY
Переглядів 16 тис.
Bi-directional Visitor Counter using Arduino and IR Sensors
4:48
TechKnowLogy Park
Переглядів 6 тис.
Effective Ways To Detect People With Common Sensors
7:43
Core Electronics
Переглядів 48 тис.
IoT Based Bidirectional Visitor Counter using ESP8266 & MQTT
7:50
How To Electronics
Переглядів 15 тис.
Tinkercad Arduino Circuit: Two Way Visitor Counter [Tinkercad Circuit]
12:56
''Бесплатные умные'' домофоны для глупых людей. За чей счет банкет?
12:48
Вадим Шегалов.Оккультные игры элиты
Переглядів 18 тис.
Broken Flex Repair #technology #mobilerepair
0:55
ideal institute aligarh
Переглядів 15 млн
I7 2600K тест в играх и сравнение с AMD Ryzen
17:53