Process
The Arduino and the code
We researched the types of sensors that we could use for the project and narrowed it down to 3 different sensors; Ultrasonic Sensor, Motion Sensor (PIR Sensor), and Thermal Array Sensor (TPA 81). The ultrasonic sensor emits a high-frequency sound (40kHz).
The sound travels through the air and if it finds an object, it bounces back to the module. It has a measuring angle of around 30 degrees and a ranging distance of 2 cm - 400 cm. The PIR sensor detects when a person has left or entered the area or approached the PIR sensor.
However, The PIR won't be able to detect the number of people around or the distance they are away from the sensor. It can sense up to 6 metres in distance and 110-degree x 70-degree detection range. The TPA81 can detect changes in heat levels and since all objects and living beings emit heat, it becomes a movement detector.
Flapping
After some discussion, we decided that for our project, we could go ahead with using the ultrasonic sensor as it is able to sense the presence as well as the distance of a person. It is also affordable compared to the TPA81.
In terms of the coding process, the ultrasonic sensor seems easier as well. The PIR sensor’s limitation of not being able to sense distance reduced the uses for the sensor so choosing it was not our first choice.
Using an Arduino Uno board, Breadboard, Jumper wires, Ultrasonic Sensor, Buzzer, and a 220ohm Resistor, we created a simple circuit that allows the buzzer to buzz only when a presence is sensed. The distance that we set it to be for this test was around 20cm.