Implementation of Arduino-based Counter System

DOI : 10.17577/IJERTV9IS090456

Download Full-Text PDF Cite this Publication

Text Only Version

Implementation of Arduino-based Counter System

Mullapudi Chaitanya Krishna1

Student,Electronics and Communication Engineering, Vellore Institute of Technology, Vellore,

Tamil Nadu, India

AbstractAutomated counter system is an efficient solution for counting the number of people entering or leaving a room. This paper attempts to provide a unique solution which can automatically count the number of people. It intelligently discovers and counts the number of people with the help of internal code from the Arduino UNO. This has been achieved by using an Infrared sensor, piezoelectric sensors and the development board Arduino UNO. Two Infrared sensors are placed at entry and exit of a room. A series of piezoelectric sensors are placed under a mat between the two infrared sensors. The sensors acquire the data and sends to the arduino which maintains the count. The system requires low voltage and minimum maintenance to continue the operation.

KeywordsCounter system, development board, Arduino UNO, Infrared sensor, Piezoelectric sensor


    We are in a world of digital transformation. In every aspect technology is one common thing people depend upon. If we look back in the 1970s, people used to count visitors manually by counting them or they used a manual tally counter. But today we can see that many methods have been introduced to count people without the need of any human presence. The sensors and cameras will simplify our job of counting the people. We just need to program them to perform the required task. The primary method of counting visitors include hiring people to stand and manually count the number of guests or workers who enter or exit from the venue or location. Even the tally counters are not user friendly and dont have many advantages. Therefore, these methods prove to be unreliable and come at a great cost.

    In recent times, counting visitors has become an essential task for people working in sectors which include customers where the number is used as a satisfaction tool by the administrators. Hence, people began researching methods to count people efficiently without hindrance. Since then many methods have been introduced which are now used in various sectors around the world. However, there are certain disadvantages with every method and it is up to the administrators to decide the best method to count visitors. One method might be efficacious but extremely expensive. Another one can be quite feasible and cheap but not efficient.

    The objective of this paper is to provide a suitable solution for counting people in an office or a place where the intensity of people is moderate to high. The solution used basic sensors such as IR and piezoelectric and are programmed using a development board called Arduino. This paper is intended to provide an efficient yet inexpensive solution for people who are in need of it.


    There is more than one method to count the visitors. It ultimately depends on the intensity of people. The following papers were studied and analyzed to understand the current scope of people detection:

    Bruno F. Carvalho and others [1] have suggested a method that utilizes sensors for detecting people. The ultrasonic sensor plays a dominant role in identifying objects and accurately calculates the distance between the sensor and the objects. The ultrasonic sensor constantly measures the distance of objects ahead, sending a signal through Trigger pin e receiving through Echo. Two ultrasonic sensors are placed side by side and an algorithm is devised to count the number of visitors entering the premises. They have also implemented another method which uses motion sensors to detect any motion of an object or a person and compared the two methods. Both the methods are successfully tested in an environment. But this method cannot detect more than one person at a time. If two persons pass through the system side by side, the system will detect only one person.

    Jeong Woo Choi and others [2] have proposed a method that uses IR-UWB radar sensors for counting people. IR- UWB radar uses an impulse signal that occupies wide bandwidth. It is a technology that transmits an impulse signal and recognizes various situations by processing multiple signals that are received after being reflected from multiple human and objects. The algorithm devised for this method is implemented using ARM Cortex-M4 and Raspberry Pi 2 modules. Two IR-UWB sensors with antennas are fixed to count the number of people. Though the system can detect multiple people at a time, it is not cost efficient. The sensors are high expensive in the market.

    Another approach using IR sensors was proposed by Jothibasu M, Aakash B and others [3]. IR sensors play a vital role in identifying objects. In this method, two IR sensors are placed adjacent to each other which detect the visitors. The logic behind the working of the counting process is simple, when the person crosses the sensor near the door and then to the sensor away, it recognizes as an increment in count. Apart from being a bi-directional counter, this method can be used to control home appliances and helps in consuming less electricity. This method cannot detect more than one person at a time. If two persons pass through the system side by side, the system will detect only one person.

    Jingwen Li [4] have designed an approach that uses Bag- Of-Features (BOF) model to count the number of pedestrians. The system can also select pedestrians and non-pedestrians samples automatically and update the classifier in real-time to make it more suitable for certain specific scene. The dataset

    used is CASIA pedestrian counting dataset and trained using SVM classifier. The system requires real time monitoring of the pedestrians via camera modules which are very expensive. Kartik Madhira and Aditya Shukla [5] have proposed a method that uses image processing techniques to count human specific areas such as ATMs, retail shops, malls etc. The people counter solution was made using computer vision library OpenCV for Python computer language. The method achieved around 80-93% accuracy. The cameras were positioned in many angles to test the accuracy of the method.

    The system requires real time monitoring of the persons via camera modules which are very expensive.

    Shubham Mathur and others [6] have come up with a method that uses image processing with sensor feedback for counting people entering or leaving a lab. Histogram of oriented gradients (HOG) technique was used for this method. The images are captured using Raspberry Pi fitted with a RaspiCam. A pair of PIR sensors is installed to instruct the system to capture the images. The data can be sent via Bluetooth to local servers for security purposes. An efficiency of 83% is achieved using this method. The equipment used in this system is very expensive. The sensors add extra cost to the system apart from camera module and Raspberry Pi.

    Another method proposed by Dr.P.Satyanarayana and others [7] involves the use of OPEN CV3 using python 3.5.2. The implementation goes on like the process of background subtraction on the incoming frames followed by the blob analysis using which the person can be detected and by using virtual lines, the count of the people entering and leaving a particular area can be evaluated. The system requires real time monitoring of the persons via camera modules which are very expensive.

    David Beymer [8] proposed a method that involves 3D stereo vision. The stereo system performs real-time 3D reconstruction by employing table lookup to map from image coordinates and isparities to 3D. Based on the 3D coordinates, the scene is (1) segmented by filtering out pixels outside the volume of interest, and (2) reprojected to a top- down, orthographic view. Finally, people are detected and tracked in the orthographc reprojection using a Gaussian mixture model and Kalman filtering. The system requires real time monitoring of the persons via camera modules which are very expensive.


    1. Infrared sensor:

      An infrared (IR) sensor emits and detects infrared radiation. It is used to detect obstacles. An IR sensor consists of IR transmitter, receiver, operational amplifier (Opamp), variable resistor and an light emitting diode (LED) in brief. IR transmitter is an IR LED which emits light in the range of infrared frequency. IR light is invisible to us because the wavelength of IR radiation (700 nm 1mm) is much higher than visible light. IR light have emitting angle of approximately 20-60 degrees with a range of approximately few centimeters to several feet.

      The photodiode receiver acts as the IR receiver which detects the reflected IR light. Photodiode is an LED with black color coated on its outer side. The Opamp is used as a voltage comparator in the IR sensor. The variable resistor is used to

      calibrate the distance range at which the object should be detected.

      Fig. 1 Infrared Sensor

      The sensor consists of three pins namely vcc, ground and vin. The vcc pin is connected to a 5 volts DC supply to power up the sensor. The ground pin is connected to ground. The vin pin is connected to one of the digital input/output (I/O) pins of arduino. Once powered up, the sensor transmits IR light. Whenever there is an obstacle in front of the sensor, the light will get reflected which is detected by the IR receiver.

    2. Piezoelectric sensor:

      The piezoelectric sensor has the ability to convert mechanical stress to electrical energy (AC output). The principle involved is piezoelectric effect. It is a reversible effect means if electric energy is provided, mechanical stress is induced. Common materials used in piezoelectric sensors are quartz, Rochelle salt. Synthetic materials including zinc oxide and gallium arsenide are also used.

      The sensor has two terminals namely positive and negative. The positive terminal is connected to one of the analog pins of arduino and the negative terminal is connected to ground. By pressing the sensor, the mechanical energy produced is converted to electrical energy.

      Fig. 2 Piezoelectric Sensor

    3. Arduino UNO

    Arduino is an open-source microcontroller board based on ATmega328p microcontroller [11]. It is one of the popular development boards used for experimental purposes and it serves as an intermediate to Internet of Things (IoT) [12]. The board consists of other components such as serial communication, crystal oscillator, voltage regulator etc. It consists of 2 KB of RAM, 1 KB of ROM, flash memory of 32 KB and can be easily programmed with the open-source software Arduino IDE.

    It also includes 14 digital I/O pins for both reading and writing data, and 6 analog pins for reading input:

    GND (3 pins): Abbreviation for Ground. The board consists of 3 pins and is used as the negative terminal of any sensor or circuit connected to the Arduino.

    5V & 3.3V: These pins supply 5volts and 3.3 volts of power to the circuit respectively. Most sensors are designed to be compatible with these 2 voltages.

    Power: All Arduino boards require a power source to run on. There are two ways to power the board. The first is by using a USB cable connected to a computer. Alternatively, the board can be powered by connecting it directly to a wall power supply using the barrel jack given. But the voltage of the power source should be in the range of 6-12V.

    Analog: Analog pins are designated under Analog In label and consist of pins A0 to A5. These pins can read signals from analog devices such as piezoelectric sensors and convert it to binary data for the processor to read.

    Fig. 3 Arduino UNO

    ATMEGA 328P-PU: ATmega328 is a single-chip microcontroller.

    Digital: The Digital pins are numbered from 0 to 13 on the Arduino UNO. They are used for both digital inputs like accepting data from a digital sensor and also as digital outputs like powering an LED.

    Reset button: Pushing the reset button restarts the code uploaded to the board.

    Main IC: The black cuboid with metal legs is the most important part of arduino, known as an Integrated Chip or IC. The IC used in arduino UNO is the microprocessor ATmega328P.

    whenever a person passes through the mat it records the signal and the value is high for a certain period of time. The person then passes by the IR sensor which detects the entry. The algorithm is designed in such a way that if both piezoelectric and the entry IR sensor are high at the same time, it detects the person and the count is increased by one.

    Fig. 4 Hardware of the project which includes IR sensors and piezoelectric mat

    When a person exits and passes through the mat, the weight of the person is converted to an electrical signal, which surpasses the threshold and is set high. The person then passes by the IR sensor which detects the exit. Now since both the sensors (piezoelectric and exit IR sensor) are set high, the system detects the person is leaving and the count is decreased by one. The person passes through both the IR sensors but since there is a delay in activating the piezoelectric sensor, only one of the sensors get time to detect by the time a person passes through the system and count is detected.

    The system is designed so that even if two persons enter or exit simultaneously the threshold is set to detect the two persons and the count is increased by two.


    The system consists of a piezoelectric mat. The piezoelectric sensors are distributed evenly on the mat and the connections are made to the analog pin of Arduino UNO board. Two IR sensors are installed at either end of the mat at a sufficient height from the ground. The first IR sensor which is programmed to detect the entry of a person is placed on the exit side of the mat. The second IR sensor which is programmed to detect the exit of a person is placed on the entry side of the mat.

    When a person enters and passes through the mat, the weight of the person, which is in the form of external stress to the piezoelectric sensor, is converted into an electrical signal. The electric signal is greater than a certain threshold, and the digital output is high. The threshold value is set so that

    Fig. 5 inside view of the piezoelectric mat






    The counter system is designed to detect the number of visitors entering or leaving the premises. The experiment is performed in a room. A total of five scenarios were considered. Results were obtained which are mentioned in the following table.









    Fig. 6 Scenario 1 One person entering the room










    Fig. 7 Scenario 2 One person leaving the room

    Fig. 8 Scenario 3 Two persons entering the room at the same

    Fig. 9 Scenario 4 Two persons leaving the room at the same time

    Fig. 10 One person entering and other person leaving the room at the same time

    Fig. 11 Results of the experiment


The counter system has the ability to detect two simultaneous visitors, entering or leaving at the same time. The system is developd using Arduino UNO development board and its IDE. The project uses two IR sensors and several piezoelectric sensors for more accuracy and precision. Arduino helps achieve the coordination among the sensors.

The system is designed to use at places like laboratories or classrooms where the intensity of crowd is intermediate. The system can be enhanced by installing industrial IR sensors which have better sensitivity at detecting persons at sufficient

distance. The size of the mat can also be increased based on the area available. The data can be sent to cloud and store it for future use. The data can also be monitored live for security purposes and can be used for further IoT applications.


  1. Carvalho, Bruno & Silva, Caio & Silva, Alessandra & Buiati, Fábio & de Sousa Junior, Rafael. (2016). Evaluation of an Arduino-based IoT Person Counter. 129-136. 10.5220/0005954601290136.

  2. J. W. Choi, X. Quan and S. H. Cho, "Bi-Directional Passing People Counting System Based on IR-UWB Radar Sensors," in IEEE Internet of Things Journal, vol. 5, no. 2, pp. 512-522, April 2018, doi: 10.1109/JIOT.2017.2714181.

  3. Jothibasu M, Aakash B, Shanju Ebanesh K, Gokul Vinayak L, Automatic Room Monitoring with Visitor Counter (ARM

    VC), IJITEE, Volume-8 Issue-7, May, 2019

  4. Jingwen Li, Lei Huang and Changping Liu, "An efficient self- learning people counting system," The First Asian Conference on Pattern Recognition, Beijing, 2011, pp. 125-129, doi: 10.1109/ACPR.2011.6166686.

  5. K. Madhira and A. Shukla, "Pedestrian flow counter using image processing," 2017 International Conference on Energy, Communication, Data Analytics and Soft Computing (ICECDS), Chennai, 2017, pp. 1911-1915, doi: 10.1109/ICECDS.2017.8389782.

  6. S. Mathur, B. Subramanian, S. Jain, K. Choudhary and D. R. Prabha, "Human detector and counter using raspberry Pi microcontroller," 2017 Innovations in Power and Advanced Computing Technologies (i-PACT), Vellore, 2017, pp. 1-7, doi: 10.1109/IPACT.2017.8244984.

  7. Dr.P.Satyanarayana , P.Gopikrishna , K.Soukhya , M.Satvik , Y.CharanKumar, A Robust Bi-Directional Algorithm For People Count In Crowded Areas, IJPAM, Volume 116 No. 6 2017, 73-78

  8. K Mohana Prasad et al 2019 IOP Conf. Ser.: Mater. Sci. Eng. 590 012012.

  9. Beymer, David. (2000). Person counting using stereo. 127-133. 10.1109/HUMO.2000.897382.

  10. Wikipedia contributors. "Piezoelectric sensor." Wikipedia, The Free Encyclopedia. Wikipedia, the Free Encyclopedia, 28 Jun. 2020. Web. 18 Aug. 2020.

  11. Arjun Varma, Ashwath A, Ayush Verma, A. Bagubali, Kishore V Krishnan, Implementation of Obstruction Avoiding Robot using Ultrasonic Sensor and Arduino UNO, IJRTE, Volume-8 Issue-4, November 2019.

  12. Wikipedia contributors. "Arduino." Wikipedia, The Free Encyclopedia. Wikipedia, the Free Encyclopedia, 18 Aug. 2020. Web. 18 Aug. 2020.

  13. Dhaief, Zahraa. (2016). People Counting Technology. 10.21884/IJMTER.2016.3142.ABPRK.

  14. S. Saxena and D. Songara, "Design of people counting system using MATLAB," 2017 Tenth International Conference on Contemporary Computing (IC3), Noida, 2017, pp. 1-3, doi: 10.1109/IC3.2017.8284344.

  15. S. Saxena and D. Songara, "Design of people counting system using MATLAB," 2017 Tenth International Conference on Contemporary Computing (IC3), Noida, 2017, pp. 1-3, doi: 10.1109/IC3.2017.8284344.

Leave a Reply