As the online shopping now a day’s became common and increasing day by day, it is necessary to protect the delivered items against domestic animals such as dogs and moneys etc. This project shows how to build an electronic device that automatically detects the presence of an animal in its vicinity and drive them away thus safe guarding the items. It also distinguishes human from animal and disable the alarm.
The device uses two ultrasonic sound sensors that detects the presence of an object nearby. One sensor is kept near to ground to detect the presence of an animal and the other is kept at half meter above the first sensor to detect presence of a human.
An audio buzzer is used to alarm the presence of the nearby animal and is disabled when human is present. A stick attached to a motor is used to drive away the animal.If an animal comes near the parcel the buzzer will ring and the motor will move the stick side by side to drive away the animal.
Working Description1) Detecting the presence of an animal or human
The presence of an object (animal or human) is detected with the help of ultrasonic distance measurement sensor. This sensor works by emitting sound waves at a frequency too high (40 kHz) for humans to hear (20Hz to 20kHz). It then wait for the sound to be reflected back, calculating distance based on the time taken to receive the sound.
Formula:Speed (S) = Distance (D) / Time (T)
as such Distance (D) = Speed (S) x Time(T) – (1)
Speed of sound is approximately 360 meters per second.
Time (T) =time difference between sound emission and receive /2. (by 2 is required to take care of to and fro time)
From (1) Distance (D) = 360 x T
For example if the sound is emitted at t1 = 0 sec and received at t2 = 0.01 sec (that is 10milli seconds)
Then D =360 x (t2-t1)/2 = 360 x (0.01-0)/2 = 1.8 meter.
2) Logic to distinguish between human and animal
Let say bottom sensor is S1 and top sensor is S2. The height of S1 should be
- less than the height of a medium size dog and
- greater than the height of parcel to be guarded
Height of S2 should be
- greater than the maximum height of dog or monkey and
- less than a 5 year old human child
The set point for detecting the presence of an object is set at 40 cm (400 mm). When an object distance is less than this set point, output of the sensors are made 1else 0. The logic used to distinguish between animal and human is described below.
3) Buzzer and Stick
When an animal is detected a buzzer is sounded to make an alarm. If the animal is still present a stick is used to scare the animal automatically.
Arduino Uno is used as the main controller in this project.
- It talks to the ultrasonic distance sensors
- performs all the required mathematical and logical operations
- controls the buzzer to make sound
- and controls the motor to move the stick.
Ultrasonic Distance Sensors: Two number of ultrasonic distance sensors (S1 and S2) are used to detect the nearby objects. These are connected to digital input and output pins of Arduino Uno board.
Buzzer: A buzzer is used to make sound when an animal is detected. It is connected to digital output pin-6 of Arduino Uno through a driver IC ULN2803.
Servo Motor with a stick: A servomotor along with a stick is used to scare the approaching animal. It is connected to PWM pin-9 of Arduino Uno.
12V Battery: A 12V battery along with a switch is used is power the entire hardware.
Complete circuit diagram is shown below
Place the complete hardware on a self-standing wooden plank as shown in the cover image.
SoftwareA block diagram based software Computer Aided Simulation Program (CASP) is used to program the board as I'm not much conversant with C/C++ coding. Below model is created to realize the required logic.
Model Description
BlocksS1, S2: are used to talk to the ultrasonic sensors.These blocks send a pulse to the sensors and receive the reflected pulse duration. They then calculate the distance based on the formulae described earlier. The output of these blocks is the distance measured in milli meters.
Two number of comparator blocks: They compare the distance from the sensor blocks with the set point (400mm). If the distance is less than the set point output is 1 else 0.
Logic to distinguish between human and animal
As explained earlier the alarm should come only when S1=1 and S2=0. So an AND and NOT logic combination is used to sound an alarm when animal approaches and not human.
Wiper Stick Logic
A sine wave block used to turn the servo motor to turn the stick and when the animal is detected.
Time Delay Blocks
ON time delay is used start the motor after some time delay.
OFF time delay is used stop the motor after some time after alarm is OFF.
Limitations & Future Improvements1) As seen from the video above, current design only works when the object is in front of the sensor. It cannot detect if the object is little side wards.
2) Sometimes, the sensors have difficulty in detecting animals with fur on their body.
Above limitation can be addressed by using other types of sensors such as passive infrared (PIR) sensor etc.
Procedure1. Download and install CASP software https://aadhuniklabs.com/?page_id=550
2. Check these videos on how to install CASP https://aadhuniklabs.com/?page_id=554
3. Download project files from Gitlab repository https://gitlab.com/tul.ishwa/projects/-/tree/main/safeguard_items and extract the zip file.
4. Build the circuit as shown in connection diagram
5. Run CASP. Open the project from the extracted zip file and open the workspace file ultrasonic_dist.wsp.
6. Open Setup Simulation Parameters and set the hardware programmer port to the serial port where Arduino Uno is connected.
7. Build the model and program the board.
8. Please note that model on the Arduino board will run only for finite time (may be 20 minutes or less based the license) as we are using free version of CASP. Just press reset button on the Arduino board to resume.
Comments