How To Design A Touchless Bell Push Using Arduino
How To Design A Touchless Bell Push Using Arduino
For this project, we’ll design a touchless bell push, which can be
useful in homes or offices. The bell uses an ultrasonic sensor that
can be easily assembled with little cost.
Required components
1. Arduino UNO x1
2. HC-SR04 ultrasonic sensor x1
3. Buzzer x1
4. Breadboard
5. Connecting wires/jumper wires
Circuit connections
To assemble the touchless bell push, an HC-SR04 ultrasonic sensor
and a buzzer are interfaced with an Arduino board. Arduino UNO is
used for this project.
Circuit diagram
Arduino sketch
#include <NewPing.h>
#define TRIGGER_PIN 8
#define ECHO_PIN 9
#define MAX_DISTANCE 400
const int buzzer = 7;
:
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
float distance;
int i;
void setup()
{
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer,HIGH);
}
void loop()
{
distance = sonar.ping_cm();
if (distance < 10)
{
for(i=0;i<20;i++)
{
digitalWrite(buzzer,HIGH);
delay(50);
digitalWrite(buzzer,LOW);
delay(50);
}
for(i=0;i<20;i++)
{
digitalWrite(buzzer,HIGH);
delay(55);
digitalWrite(buzzer,LOW);
delay(55);
}
:
for(i=0;i<2;i++)
{
digitalWrite(buzzer,HIGH);
delay(60);
digitalWrite(buzzer,LOW);
delay(60);
}
for(i=0;i<2;i++)
{
digitalWrite(buzzer,HIGH);
delay(65);
digitalWrite(buzzer,LOW);
delay(65);
}
for(i=0;i<2;i++)
{
digitalWrite(buzzer,HIGH);
delay(70);
digitalWrite(buzzer,LOW);
delay(70);
}
}
digitalWrite(buzzer,HIGH);
}
A piezo buzzer is interfaced with Arduino and it works as the bell. It’s
wired to ring when a LOW logical signal is output from Arduino’s
interfaced pin. It stays silent when a HIGH logic is applied from the
Arduino pin to the buzzer terminal.
To install the library, simply open the Arduino IDE, go to Sketch >
Include Library > Add .ZIP Library, and then select the NewPing ZIP
file that you just downloaded.
Follow this step with the pin assignments, interfacing the sensor’s
trigger and echo terminals with the buzzer.
In the setup() function, the buzzer pin is set to output and raised to
HIGH logic by using the digitalWrite() function. In the loop() function,
the distance to any interference is detected using the NewPing
class’s ping_cm() method.
Results
:
:
Filed Under: Arduino, Microcontroller Projects
Tagged With: Arduino
:
:
:
:
:
: