IoT Enabled Intelligent Sensor Node for Smart City: Pedestrian Counting and Ambient Monitoring

An Internet of Things (IoT) enabled intelligent sensor node has been designed and developed for smart city applications. The fabricated sensor nodes count the number of pedestrians, their direction of travel along with some ambient parameters. The Field of View (FoV) of Fresnel lens of commercially available passive infrared (PIR) sensors has been specially tuned to monitor the movements of only humans and no other domestic animals such as dogs, cats etc. The ambient parameters include temperature, humidity, pressure, Carbon di Oxide (CO2) and total volatile organic component (TVOC). The monitored data are uploaded to the Internet server through the Long Range Wide Area Network (LoRaWAN) communication system. An intelligent algorithm has been developed to achieve an accuracy of 95% for the pedestrian count. There are a total of 74 sensor nodes that have been installed around Macquarie University and continued working for the last six months.


Introduction
With the proliferation of technological advancement, the idea of a smart city is emerging day by day. A city is named as smart once its intelligent and sustainable infrastructure is integrated with advanced technological solutions [1]. The essential purpose of building a smart city is providing a sustainable, environment-friendly life to its residents. It is predicted that 66% of the world population is expected to live in urban areas by 2050 [2]. Due to the industrial revolution and rapid urbanization, human societies are in great strain on resource consumption and environmental issues [3]. Thus, it has become an important issue to keep track of footpath traffic and environmental parameters for urban planning, retail development, major event crowd assessments, pedestrian safety, traffic flow management and assessments of the street development.
Researchers are seeking interest in people counting in office buildings as well as public places such as train stations. There are numerous researches that have been carried out on human counting using different technologies in the indoor environment [4][5][6]. Occupancy counting in smart buildings is implemented via video cameras, thermal cameras, sensors, radio frequency identification (RFID) and Wi-Fi [7] probe requests [8][9][10][11].
One of the most extensively used methods of human counting is the usage of a video camera. It also has a wide range of applications in the surveillance of potential areas for detecting unusual events, tracking customers in retail stores to control and monitor the movements of assets, monitoring elderly and sick people staying at home alone, recognize and track people [12]. The number of people in each frame of the video camera are determined based on the image processing algorithm. Some methods count the number of people by counting heads, whereas some methods count faces from the captured After reviewing the technologies used for pedestrian counting, it is decided to use the PIR sensors in this research as it is a cost-effective, low-power sensor compared to other existing technologies. The drawbacks of the PIR sensors are considered while designing the prototype. Therefore, the developed prototype will be able to overcome the downsides of the sensors. This paper presents a novel compact system that not only provides the pedestrian count but also gives information about the pedestrian's direction of travel and environmental data such as temperature, humidity, pressure, CO 2 and TVOC. The novel contributions of this paper can be summarized as follows: 1.
The sensitivity of the PIR sensors has been tuned, and a specific section from the Fresnel lens is chosen for receiving the IR emission from 1 m above the ground. Therefore, domestic animals such as dogs or cats will not be detected while crossing the footpath as the maximum shoulder height of a domestic dog is less than 100 cm [37].

2.
A novel method of the pedestrian count and direction detection system has been designed. Three PIR sensors cover the detection region across the width of footpath in such a way that the detection regions of the sensors do not overlap. Each of the three sensors is horizontally paired with another three sensors such that each pair can validate their detection as well as find the direction of travel of the pedestrian. Therefore, the system can provide highly accurate results, up to 95% compared to manual counting.

3.
A microcontroller-based low-power sensing device along with the low-power communication system has been proposed to increase the battery life. The system can be installed on the street pole without altering the other infrastructure of the city.

Materials and Methods
This section presents the necessary explanation for developing the smart counting system. It also explains the FoV of Fresnel lens of the PIR sensors, the novel method of pedestrian detection and finding the direction of travel, proposed algorithm, installation system, study locations, data transmission and collection system.

Field of View for PIR Sensor
A PIR sensor consists of two sensing elements and a Fresnel lens. The Fresnel lens focuses the emitted IR radiation to the sensing element. The sensing element absorbs the IR radiation and converts it into heat, which is converted into a minute electric current by the pyroelectric crystalline material [18]. A Fresnel lens is composed of a series of concentric grooves having a standard focal length. The significant advantage of the Fresnel lens is that the propagation direction of light does not change within a medium but only deviates at the surfaces of a medium. The different faceting and sub-lenses of the Fresnel offer a range of detection areas. The focal point of the FoV is divided into A-F sections (Figure 1a), which are 10 degrees apart from each other. The different sections (A-F) of the Fresnel lens offer a detection range from 4 m-10 m at full sensitivity, as shown in Figure 1b. The detection length can be decreased to 1.8 m at reduced sensitivity. The usage of the A-section at full sensitivity implies the installation of the sensor node at 11 m height of the pole. This is not possible in the practical scenario as the maximum height of the lamp posts is 6.5 m [38]. Therefore, it is necessary to operate the PIR sensors at a reduced sensitivity mode rather than full sensitivity. The detection length of each section of the Fresnel lens is measured by walking towards that section from a far distance covering other sections with Polyvinyl chloride (PVC) tape. Figure 1b,c shows the top view and side view of the FoV of the Fresnel lens of the PIR sensor (Parallax Inc., Rocklin, CA, USA, 555-28027 PIR sensor module) at full sensitivity while Table 2 shows the experimentally verified detection lengths of the A to F sections at full and reduced sensitivity. is necessary to operate the PIR sensors at a reduced sensitivity mode rather than full sensitivity. The detection length of each section of the Fresnel lens is measured by walking towards that section from a far distance covering other sections with Polyvinyl chloride (PVC) tape. Figure 1b,c shows the top view and side view of the FoV of the Fresnel lens of the PIR sensor (Parallax Inc., Rocklin, CA, USA, 555-28027 PIR sensor module) at full sensitivity while Table 2 shows the experimentally verified detection lengths of the A to F sections at full and reduced sensitivity.

Method for Pedestrian Detection
This research aims to cover 3 m wide footpath and limit the detection length to 1 m from the street level for avoiding the domestic animal. Three pairs of PIR sensors are used to develop the node for counting pedestrian and finding the direction of travel. The sensor node is mounted at 4 m of the electric pole, as shown in Figure 2a. The bottom PIR pair is placed at 0° from the y-plane so that a person walking adjacent to the pole can also be detected. Each section of the Fresnel lens has 10° FOV. Therefore, the detection region of the bottom pair can be calculated as follows: To find the appropriate focus angle of the middle pair of the PIR sensors, it is assumed that a person is standing at the edge of the detection region of the bottom pair as shown in Figure 2a. The middle pair is placed in such a way that the person detected by the bottom pair does not fall in the coverage region of the middle pair. From the graphical representation of this scenario, it is

Method for Pedestrian Detection
This research aims to cover 3 m wide footpath and limit the detection length to 1 m from the street level for avoiding the domestic animal. Three pairs of PIR sensors are used to develop the node for counting pedestrian and finding the direction of travel. The sensor node is mounted at 4 m of the electric pole, as shown in Figure 2a. The bottom PIR pair is placed at 0 • from the y-plane so that a person walking adjacent to the pole can also be detected. Each section of the Fresnel lens has 10 • FOV. Therefore, the detection region of the bottom pair can be calculated as follows: To find the appropriate focus angle of the middle pair of the PIR sensors, it is assumed that a person is standing at the edge of the detection region of the bottom pair as shown in Figure 2a. The middle pair is placed in such a way that the person detected by the bottom pair does not fall in the coverage region of the middle pair. From the graphical representation of this scenario, it is determined that the middle pair detection region should start at 21 • from the y-plane. Therefore, this middle pair detection region ends at 31 • from the y-plane. The minimum and maximum coverage regions of the middle pair are calculated as follows:  Figure 2a. Coverage regions of the sensors do not overlap due to applying this method while locating the PIR sensors. Therefore, the error can be minimized.
The required detection length of the bottom, middle and top PIR sensors can be found using the formula of a right-angle triangle, which is, hypotenuse = Ad jacent 2 + opposite 2 . The values of SA, SB and SD are calculated as 3 m, 3.17 m and 3.87 m, respectively. The appropriate selection of the sections of the Fresnel lens is necessary to minimize the error. If the selected section detects more area under the 1 m height of clearance, then tall domestic pets, such as dogs will be detected. When the selected section detects less area above the 1 m clearance, then pedestrians having a shorter height such as 1.1-1.2 will not be detected. As it is not possible to fine-tune the detection length of the commercial PIR sensor to achieve a full area of coverage, the section should be selected that provides minimum error region. Therefore, E, D and C-sections are kept active for the bottom, middle and top pairs, respectively. Bottom and middle PIR sensor pairs are operated at reducing sensitivity, whereas the top pair operates at full sensitivity to minimize the error. People on wheel-chair also come under the detection region. The required detection length of the bottom, middle and top PIR sensors can be found using the formula of a right-angle triangle, which is, ℎ = + . The values of SA, SB and SD are calculated as 3 m, 3.17 m and 3.87 m, respectively. The appropriate selection of the sections of the Fresnel lens is necessary to minimize the error. If the selected section detects more area under the 1 m height of clearance, then tall domestic pets, such as dogs will be detected. When the selected section detects less area above the 1 m clearance, then pedestrians having a shorter height such as 1.1-1.2 will not be detected. As it is not possible to fine-tune the detection length of the commercial PIR sensor to achieve a full area of coverage, the section should be selected that provides minimum error region. Therefore, E, D and C-sections are kept active for the bottom, middle and top pairs, respectively. Bottom and middle PIR sensor pairs are operated at reducing sensitivity, whereas the top pair operates at full sensitivity to minimize the error. People on wheel-chair also come under the detection region.

Development of the Sensor Node
The proposed system consists of six PIR sensors, one environmental combo sensor [39], QWIIC shield [40], Arduino UNO microcontroller [41], power converter [42], LoRa shield [43] for radio communication, solar panel [44] and rechargeable battery [45] to provide continuous energy. The PIR sensors are connected to the analog inputs of Arduino Uno. The environmental combo is connected to the Arduino Uno via the QWIIC shield that has four 3.3 V I 2 C ports and I 2 C sensors are connected to the shield via the QWIIC cable [46]. The solar charger shield and the LoRa shield are also connected with the main microcontroller. The 6000 mAh rechargeable battery and 6 V solar panel are connected with the power management block. A summary of the types of sensors and other electronics are listed in Table 3 and the circuit block diagram of the proposed system are shown in Figure 3. Table 3. Summary of the electronics used in the proposed system.  All the sensors and the necessary electronics were placed inside the mould that is designed using the Fusion 360 software, as shown in Figure 4a. A curvature plane was created to place the PIR sensors at the proposed angles. The PLA (PolyLactic Acid) filament was used to print the design in the DREAMER 3D PRINTER [48]. PIR sensors are placed in the holder in such a way that the E, D and C sections function for the bottom, middle and top pairs of the PIR sensors, respectively. Due to the usage of the holders, direct sunlight cannot affect the performances of the PIR sensors. A unique  All the sensors and the necessary electronics were placed inside the mould that is designed using the Fusion 360 software, as shown in Figure 4a. A curvature plane was created to place the PIR sensors at the proposed angles. The PLA (PolyLactic Acid) filament was used to print the design in the DREAMER 3D PRINTER [48]. PIR sensors are placed in the holder in such a way that the E, D and C sections function for the bottom, middle and top pairs of the PIR sensors, respectively. Due to the usage of the holders, direct sunlight cannot affect the performances of the PIR sensors. A unique environmental combo sensor's holder was designed to hold the sensor, which was connected with the glue on the box. One side of the holder is open so that it is exposed to the environment and able to read the environmental parameters such as temperature, humidity, pressure, CO 2 and TVOC. The processing units and all the connections are located inside the mould. environmental combo sensor's holder was designed to hold the sensor, which was connected with the glue on the box. One side of the holder is open so that it is exposed to the environment and able to read the environmental parameters such as temperature, humidity, pressure, CO2 and TVOC. The processing units and all the connections are located inside the mould.

Algorithm of the Pedestrian Count
To use the PIR sensors as the human counter, an intelligent algorithm has been developed to count accurately the number of pedestrians within the focus area of the PIR sensor. A flag variable and counter variable are used in this algorithm. Initially, the flag variable is stated at a LOW state. Usually, the output is LOW for the PIR sensor. The PIR sensor changes from LOW to HIGH state as soon as any person enters its focus zone and stays at the HIGH state for a certain duration before it goes back to LOW state. The time duration can be adjusted and is set in such a way so that the person takes a similar amount of time to walk the duration of its focus angle. Due to the change of state of the PIR sensor from LOW to HIGH, the value of the counter variable is increased by one and immediately the state of the flag variable is switched to HIGH state. This algorithm prevents the counter from counting more than once for the duration a pedestrian takes to cross the coverage region of the PIR sensor. As soon as the sensor goes LOW, the flag variables state is also changed to LOW and waits for the next person to cross.
The direction of the pedestrian is determined from their entry time of the incident IR beam. The width of the footpath is divided into three zones, and each zone is covered with one pair of the PIR sensors. When a pedestrian is crossing a zone, he will trigger both the sensors in the pair. By recording the entry times of each sensor beam and comparing the earliest time among them, the direction is detected. This algorithm may provide incorrect results if a second person enters the focus zone of a PIR sensor before the transition from HIGH to LOW due to the first person. In this case, the duration of HIGH state gets extended as shown in Figure 5 and multiple passersby can be counted as a single individual. To avoid such a scenario, an error correction algorithm is developed.
The error correction algorithm is based on a comparison of the average time of crossing (ATC) a PIR sensor coverage area by a human, with the time duration at HIGH state (TDHS) of the corresponding sensor. The average time required to cross the coverage region (dp) of the PIR sensor by a human walking with a speed (Vp) is found as: This algorithm mathematically calculates the number of the people, i.e., the increment of the counter variable as:

Algorithm of the Pedestrian Count
To use the PIR sensors as the human counter, an intelligent algorithm has been developed to count accurately the number of pedestrians within the focus area of the PIR sensor. A flag variable and counter variable are used in this algorithm. Initially, the flag variable is stated at a LOW state. Usually, the output is LOW for the PIR sensor. The PIR sensor changes from LOW to HIGH state as soon as any person enters its focus zone and stays at the HIGH state for a certain duration before it goes back to LOW state. The time duration can be adjusted and is set in such a way so that the person takes a similar amount of time to walk the duration of its focus angle. Due to the change of state of the PIR sensor from LOW to HIGH, the value of the counter variable is increased by one and immediately the state of the flag variable is switched to HIGH state. This algorithm prevents the counter from counting more than once for the duration a pedestrian takes to cross the coverage region of the PIR sensor. As soon as the sensor goes LOW, the flag variables state is also changed to LOW and waits for the next person to cross.
The direction of the pedestrian is determined from their entry time of the incident IR beam. The width of the footpath is divided into three zones, and each zone is covered with one pair of the PIR sensors. When a pedestrian is crossing a zone, he will trigger both the sensors in the pair. By recording the entry times of each sensor beam and comparing the earliest time among them, the direction is detected. This algorithm may provide incorrect results if a second person enters the focus zone of a PIR sensor before the transition from HIGH to LOW due to the first person. In this case, the duration of HIGH state gets extended as shown in Figure 5 and multiple passersby can be counted as a single individual. To avoid such a scenario, an error correction algorithm is developed. The error correction is activated for any PIR sensors that stay HIGH for more than 1.5 times of the ATC considering 50% tolerance. Before adding the corrected increment to the counter variable, it also compares the TDHS of the other sensor in the pair. Each of the paired sensors is placed in the mould at an angle that produces a 20 cm gap between their coverage regions. Therefore, the probable time period of crossing (PTPC) between the paired sensors is calculated as: If the values of TDHS for both the sensors in a pair are 75% near each other or the value of the counter variable is more than one for any PIR sensor in a pair within the PTPC, the increment is added. Otherwise, it does not add any increment correction. After counting the number of pedestrians by each pair of the PIR sensor, the total number of pedestrians is calculated as follows: To find a more accurate value of the pedestrian count, the Ntotal has been normalized using calibrated characteristics between the actual counted value and system counted value as explained in Section 3.1. Due to considering all the possible scenarios of the pedestrians walking pattern and feeding the system with actual count trends to ensure that the system provides more accurate results, the developed algorithm is defined as an intelligent algorithm.
Once the pedestrian counting and direction of travels are obtained for 10 min and environmental combo data are read. After reading all the sensor data, data is sent to the Thingspeak [49] server through the TTN (The Things Network) [50] gateway. The complete flow diagram of the developed system is shown in Figure 6. The error correction algorithm is based on a comparison of the average time of crossing (ATC) a PIR sensor coverage area by a human, with the time duration at HIGH state (TDHS) of the corresponding sensor. The average time required to cross the coverage region (d p ) of the PIR sensor by a human walking with a speed (V p ) is found as: This algorithm mathematically calculates the number of the people, i.e., the increment of the counter variable as: The error correction is activated for any PIR sensors that stay HIGH for more than 1.5 times of the ATC considering 50% tolerance. Before adding the corrected increment to the counter variable, it also compares the TDHS of the other sensor in the pair. Each of the paired sensors is placed in the mould at an angle that produces a 20 cm gap between their coverage regions. Therefore, the probable time period of crossing (PTPC) between the paired sensors is calculated as: If the values of TDHS for both the sensors in a pair are 75% near each other or the value of the counter variable is more than one for any PIR sensor in a pair within the PTPC, the increment is added. Otherwise, it does not add any increment correction. After counting the number of pedestrians by each pair of the PIR sensor, the total number of pedestrians is calculated as follows: To find a more accurate value of the pedestrian count, the N total has been normalized using calibrated characteristics between the actual counted value and system counted value as explained in Section 3.1. Due to considering all the possible scenarios of the pedestrians walking pattern and feeding the system with actual count trends to ensure that the system provides more accurate results, the developed algorithm is defined as an intelligent algorithm.
Once the pedestrian counting and direction of travels are obtained for 10 min and environmental combo data are read. After reading all the sensor data, data is sent to the Thingspeak [49] server through the TTN (The Things Network) [50] gateway. The complete flow diagram of the developed system is shown in Figure 6.

Study Location
There is a total of 74 sensors that have been installed near Macquarie University. Figure 7 shows the locations of all the sensor nodes. The sensor nodes have been working successfully for the last six months and providing the number of pedestrians, direction of travel and ambient parameters. Pole brackets were used to mount the proposed systems and solar panel on the electric pole. Figure 8 shows the mounting system with the solar panel on the pole.

Study Location
There is a total of 74 sensors that have been installed near Macquarie University. Figure 7 sho ocations of all the sensor nodes. The sensor nodes have been working successfully for the last ths and providing the number of pedestrians, direction of travel and ambient parameters. P kets were used to mount the proposed systems and solar panel on the electric pole. Figur s the mounting system with the solar panel on the pole.

Data Transmission and Collection
The proposed pedestrian counting system is based on the Lora Communication. It off ectivity of a few kilometers in urban areas and up to ten kilometers in rural areas. It is wid where low data rate, low power and low throughput are required. Utilization of license-f strial, scientific and medical (ISM) radio bands enables LoRaWAN to attract customers such smart city [51]. This communication system consists of two different layers. The physical laye d on the Chirp Spread Spectrum (CSS) modulation technique and the MAC-layer protoco untable for getting access to the network architecture [52]. The frequency shift keying (FSK

Study Location
There is a total of 74 sensors that have been installed near Macquarie University. Figure 7 shows the locations of all the sensor nodes. The sensor nodes have been working successfully for the last six months and providing the number of pedestrians, direction of travel and ambient parameters. Pole brackets were used to mount the proposed systems and solar panel on the electric pole. Figure 8 shows the mounting system with the solar panel on the pole.

Data Transmission and Collection
The proposed pedestrian counting system is based on the Lora Communication. It offers connectivity of a few kilometers in urban areas and up to ten kilometers in rural areas. It is widely used where low data rate, low power and low throughput are required. Utilization of license-free Industrial, scientific and medical (ISM) radio bands enables LoRaWAN to attract customers such as the smart city [51]. This communication system consists of two different layers. The physical layer is based on the Chirp Spread Spectrum (CSS) modulation technique and the MAC-layer protocol is accountable for getting access to the network architecture [52]. The frequency shift keying (FSK) is used in the LoRa communication to communicate between the gateway and sensor node [53]. Figure  9 shows the block diagram of the proposed system. After the installation of the sensor nodes, the data were collected and stored in the Thingspeak channel.

Data Transmission and Collection
The proposed pedestrian counting system is based on the Lora Communication. It offers connectivity of a few kilometers in urban areas and up to ten kilometers in rural areas. It is widely used where low data rate, low power and low throughput are required. Utilization of license-free Industrial, scientific and medical (ISM) radio bands enables LoRaWAN to attract customers such as the smart city [51]. This communication system consists of two different layers. The physical layer is based on the Chirp Spread Spectrum (CSS) modulation technique and the MAC-layer protocol is accountable for getting access to the network architecture [52]. The frequency shift keying (FSK) is used in the LoRa communication to communicate between the gateway and sensor node [53]. Figure 9 shows the block diagram of the proposed system. After the installation of the sensor nodes, the data were collected and stored in the Thingspeak channel. Sensors 2019, 19, x FOR PEER REVIEW 12 of 19 Figure 9. Block diagram of the Lora based pedestrian counting system.

Results and Discussions
This section describes the performance of the proposed system by comparing the system count with the manual count. It also explains how the accuracy of the system is improved. This section shows how collected data are displayed on the Thingspeak channel.

Data Collection and Validation
The developed system was installed on the pole at Macquarie University. The data was collected from the proposed system. The number of pedestrians, pedestrians coming from the left side and right side were also counted manually. The data was counted manually from 8:00 a.m. to 10:00 p.m. The flow of pedestrians changed due to the peak and off-peak time. The counting was done for three days (weekdays) continuously, and the average data were taken for data analysis. Table 4 shows the data of the manual count from 8:00 a.m.-10:00 p.m. with a 1-h time interval. A marker is used at 1 m height of the pole to count the animals in two different height groups such as below 1 m or above 1 m. The system is not capable of distinguishing among humans and pets taller that one meter. While doing the manual counting, no pet is found having a height more than 1 m. It can be said from this scenario that urban people prefer keeping smaller pets than taller pets. This nullifies the probability of error counting animals as humans by the system. The maximum error that occurs in this system counting is less than 10%.
In order to improve the accuracy, the manual count and system count data are plotted against each other, and the equation for determining the actual count is obtained. Figure 10a-c shows the relationship between the system count and the actual count for right, left and total pedestrians that follow the linear equations with a coefficient of determination (R 2 = 0.992, 0.9909 and 0.997) from the actual data. This linear equation was used to calculate the actual count from the system's count, which can be represented as follows: Pedestrians coming from the right side, Pedestrians coming from the left side, Total number of pedestrians, where x represents the actual pedestrian count and y represents the system's count. These equations were used as fitted lines for the final system.

Results and Discussions
This section describes the performance of the proposed system by comparing the system count with the manual count. It also explains how the accuracy of the system is improved. This section shows how collected data are displayed on the Thingspeak channel.

Data Collection and Validation
The developed system was installed on the pole at Macquarie University. The data was collected from the proposed system. The number of pedestrians, pedestrians coming from the left side and right side were also counted manually. The data was counted manually from 8:00 a.m. to 10:00 p.m. The flow of pedestrians changed due to the peak and off-peak time. The counting was done for three days (weekdays) continuously, and the average data were taken for data analysis. Table 4 shows the data of the manual count from 8:00 a.m.-10:00 p.m. with a 1-h time interval. A marker is used at 1 m height of the pole to count the animals in two different height groups such as below 1 m or above 1 m. The system is not capable of distinguishing among humans and pets taller that one meter. While doing the manual counting, no pet is found having a height more than 1 m. It can be said from this scenario that urban people prefer keeping smaller pets than taller pets. This nullifies the probability of error counting animals as humans by the system. The maximum error that occurs in this system counting is less than 10%. In order to improve the accuracy, the manual count and system count data are plotted against each other, and the equation for determining the actual count is obtained. Figure 10a-c shows the relationship between the system count and the actual count for right, left and total pedestrians that follow the linear equations with a coefficient of determination (R 2 = 0.992, 0.9909 and 0.997) from the actual data. This linear equation was used to calculate the actual count from the system's count, which can be represented as follows: 08: 00-09:00  0  0  61  25  36  65  26  39  09:00-10:00  0  0  50  23  27  52  24  28  10:00-11:00  0  0  45  21  24  48  22  26  11:00-12:00  1  0  76  38  38  76  38  38  12:00-13:00  0  0  103  51  52  107  54  53  13:00-14:00  0  0  43  24  19  43  25  18  14:00-15:00  0  0  23  17  6  24  16  8  15:00-16:00  5  0  37  21  16  36  21  15  16:00-17:00  3  0  49  29  20  51  28  23  17:00-18:00  0  0  52  31  21  52  30  22  18:00-19:00  2  0  38  24  14  38  24  14  19:00-20:00  0  0  19  14  5  20  15  5  After doing the corrections, the system was installed again on the pole and data was collected manually. Both data were compared. Table 5 shows the comparison between the corrected results versus the actual results. As no animal is found having height more than 1 m, the number of animals crossing the coverage region of the sensor node is not included in Table 5. It is seen from the table that the developed system's accuracy is improved to 95% after the correction.
The developed system provides highly accurate data without affecting human privacy compared to a camera-based system. An environmental combo sensor is also included in the system that provides temperature, humidity, pressure, CO2 and TVOC. Data collected from the sensor are compared with the environmental data from the Sydney weather station [54]. The sensors were Pedestrians coming from the right side, x = y + 0.7748 1.0437 (8) Pedestrians coming from the left side, Total number of pedestrians, x = y + 0.0338 1.0296 (10) where x represents the actual pedestrian count and y represents the system's count. These equations were used as fitted lines for the final system. After doing the corrections, the system was installed again on the pole and data was collected manually. Both data were compared. Table 5 shows the comparison between the corrected results versus the actual results. As no animal is found having height more than 1 m, the number of animals crossing the coverage region of the sensor node is not included in Table 5. It is seen from the table that the developed system's accuracy is improved to 95% after the correction. The developed system provides highly accurate data without affecting human privacy compared to a camera-based system. An environmental combo sensor is also included in the system that provides temperature, humidity, pressure, CO 2 and TVOC. Data collected from the sensor are compared with the environmental data from the Sydney weather station [54]. The sensors were calibrated by calculating the offset factors and applying to the BME280/CCS811 data. There are 74 nodes that are developed and installed close to Macquarie University around Herring Road (33 •

Data Transfer to IoT Cloud Server
A Thingspeak cloud server is used to store the data which is a free IoT cloud server for data storage. Sensor data were transmitted to the server every 10 min for increasing the battery time. The sampling time is controlled through Arduino programming. Figure 11 shows the real-time data of the developed system for few data. A Thingspeak channel can support a maximum of eight fields and various fields were reserved for the pedestrian coming from the right, left and total, temperature, humidity, pressure, CO 2 and TVOC. All the data were collected through the TTN gateway.
From Figure 11 the variation of the pedestrian numbers and direction of travel can be seen, and the pattern of the pedestrian flow is understood. A maximum number of pedestrians are walking during a particular time such as 08:00-10:00, 12:00-14:00, and 14:00-18:00 due to the starting of office time, lunchtime and ending of office time. Identical data can be seen for all three days. During the night, a minimal number of people can be seen.

Power Consumption
One of the significant outstanding challenges of the wireless sensor network (WSN) system is the selection of the appropriate sensor and communication technology since battery scaling is the main limit to sensor nodes miniaturization. The replacement of the battery is not possible or feasible in many cases. Therefore, efficient energy management is essential. The simplest way to reduce power consumption is to use low-power devices and passive sensors (such as the PIR sensors). A low-power microcontroller such as Arduino Uno has only 32 Kbytes of Flash memory and 2 Kbytes of SRAM. Power consumption in wireless sensor nodes has peaked when the radio is active. Therefore, wireless communication should be limited. Power consumption by the sensor node can also be limited by increasing the idle time and reducing the active time. Table 6 shows the current drawn by the sensors node in 10 min, i.e., 1 cycle. The current drawn by each and every component is calculated by measuring the amplitude of the voltage waveform from the oscilloscope across a 0.5 Ω resistance connected in a series with the microcontroller. Total power consumption by the sensor node including transmission is given by, where, V s = nominal voltage of the sensor node = 3.3 V I n = current drawn by the sensor node in 1 h = 40.01 mA I td = current drawn during transmission = 120 mA t td = time duration of data transmission = 60 mc f td = frequency of data transmission = 1 10 mins = 1 10×60 = 1 600 Hz A Thingspeak cloud server is used to store the data which is a free IoT cloud server for data storage. Sensor data were transmitted to the server every 10 min for increasing the battery time. The sampling time is controlled through Arduino programming. Figure 11 shows the real-time data of the developed system for few data. A Thingspeak channel can support a maximum of eight fields and various fields were reserved for the pedestrian coming from the right, left and total, temperature, humidity, pressure, CO2 and TVOC. All the data were collected through the TTN gateway.
From Figure 11 the variation of the pedestrian numbers and direction of travel can be seen, and the pattern of the pedestrian flow is understood. A maximum number of pedestrians are walking during a particular time such as 08:00-10:00, 12:00-14:00, and 14:00-18:00 due to the starting of office time, lunchtime and ending of office time. Identical data can be seen for all three days. During the night, a minimal number of people can be seen.

Power Consumption
One of the significant outstanding challenges of the wireless sensor network (WSN) system is the selection of the appropriate sensor and communication technology since battery scaling is the main limit to sensor nodes miniaturization. The replacement of the battery is not possible or feasible in many cases. Therefore, efficient energy management is essential. The simplest way to reduce  The current drawn by the sensor node, I n is calculated based on the idle time and active time of the electronic devices in 10 min, i.e., 1 cycle.
Therefore, the total current consumption by the sensor node, It is assumed that the battery will be able to discharge 100%, though it is not able to do so in the practical scenario. From the above numerical calculations, it is found that the transmission of data every 10 min enables the battery sustainability to 151 h. The battery is charged by the 6 V 6 W solar panel during daylight. There will be continuous power to the system unless the sun does not come out at all for a consecutive six days.

Conclusions
An IoT enabled pedestrian count, direction of travel and ambient parameters determination system is successfully presented in this paper. The PIR sensors detect the movement and convert the data into the pedestrian count and direction of movement. The developed system is tested at various times of the day to evaluate the performance. This novel method counts pedestrians with 95% accuracy and avoids counting any movement of domestic animals such as dogs or cats. The method does not require any images or videos thus protecting human privacy. The environmental combo provides all the necessary information of the weather such as temperature, humidity, pressure, CO 2 and VOC. The installation of the sensor nodes on the electric pole reduces the financial burden. The implementation cost of the system is about 250 US dollars, which includes the purchase of electronic consumables in small numbers. The total cost of fabrication will significantly reduce if the productions are made in large numbers. The current price though is less compared to other existing systems thus making this a potential candidate to implement in a smart city.
The open-access database of the system promotes identifying hotspots and taking necessary action for pedestrian safety and facilities improvement. Moreover, it will help the City Council to improve the planning and provision of transportation services. Furthermore, this will enable local businesses to monitor the pedestrian traffic flow and manage business resources to improve efficiency and increase revenue. Environmental monitoring data will help in understanding air quality and taking essential measures for making the city greener. Therefore, the existence of such sensor nodes in a city provides an opportunity for decision-makers to test assumptions and scenarios, reducing the chance of costly mistakes with the infrastructure. That is why it is adopted by the Macquarie park district, Sydney, Australia, which is experiencing considerable growth of office developments over the past two decades and is expected to continuingly expand as Sydney's knowledge hub in near future. Without such a mutual policy and implementation framework, urban planning projects may place tremendous pressure on the precinct, transportation and inhabitants whilst also leading to costly and ineffective solutions. It is anticipated that the major cities in Australia and other countries will adopt this technology very soon. In addition to pedestrian counting, this system can also be implemented in a smart building to know the number of people inside and outside the building during emergency evacuation.
Although there are so many advantages of the proposed system, there are some limitations as well. This system is not able to differentiate between humans and animals having height more than 1 m. Due to keeping 1 m clearance from the street level, babies sleeping on the pram are not counted.
Future work would be the inclusion of more sensors such as noise sensor, wind speed determination, rain sensors, visibility sensor, etc. Moreover, the long term collected data would be analyzed to predict the trends. The environmental effect on the pedestrian movement would also be analyzed for different applications.