October 5, 2023
The previous version of the People Counter worked as it was supposed to, at least in our limited testing around the house. The device was able to accurately count people coming and going through a threshold, and distinguish between the two. The counts were updated in real time via LoRaWAN to a laptop. So while the device met the "works like" criteria, there were some things needing improvement. First the cost of the two Calipile sensors ($7.58 each per 3000) was too high; ~$15 BOM cost just for the sensors. Secondly, because the temperature baseline has to be frequently reestablshed for maximum accuracy, the average current usage was ~100 uA (~900 mAH per year), seriously limiting battery life. Neither of these is a show stopper, just areas for improvement.
I tried using the much cheaper AK9754 (now obsolete), which worked well but has a limited range. I also tried using very cheap ($0.85 each per 100) Senba S18 analog PIR sensors. These work well for presence detection and might be able to work to detect ingress/egress. They also consume very little power. However, they are a little on the large side, require a lens for long range, and being analog, I was never quite convinced of their reliability/accuracy. Still worth a try considering the cost, I just never got around to it.
Now, ST has introduced their version of a presence detector, the STHS34PF80 This is a single-pixel IR detector with embedded presence and motion detection APIs. I designed a 16 x 65 mm pcba with a form factor to allow easy mounting of an AA-sized 2400 mAH LiSOCl2 battery (holder on the back) with two STHS34PF80 on either end. One tricky bit was the STHS34PF80 only has a single I2C address, so I had to make use of a SN74LVC1G3157DRYR SPDT switch in order to separately communicate with each IR sensor on the I2C bus. I also added a mechanical switch and USB for convenience, a BME280 pressure/temperature/humidty sensor for environmental sensing, and a LIS2DW12 accelerometer for wake on motion. Any or all of these could be dropped in a final production design.
Digikey has these at ~$3.50 each per 2000 but there is no stock. Mouser prices are ~$5.47 each per 10 in stock. STStore has them for $3.68 each per 500. So the ~$7 BOM cost for the two IR sensors is half the cost of the Calipile.
Here is a github repository with some sketches showing how to configure the STHS34PF80 IR sensor for basic ambient and object temperature measurements as well as how to configure the embedded function algorithms and use them to detect presence and motion at up to 4 meters range. I also have a basic people counting sketch there which simply shows how to make use of all of the sensors on the board. This lacks the timing comparison that I have used for distinguishing egress and ingress events. But adding this is straightforward.
Ingress and egress detection works at 2 Hz IR sensor sample rate. This still needs to be optimized to maximize accuracy and eliminate false positives. The scheme relies on sensor interrupt on presence detection and comparison of the detection times to determine the direction of motion. With the RTC alarm period set at once per minute (plenty often for environmental data) the average current usage is ~19 uA in a one minute window (including one RTC alarm event) and ~31 uA in a ten minute window (including one LoRaWAN event and ten RTC alarm events). These values are the same at 32 MHz and 4.2 MHz CPU speeds since the MCU spends nearly all of its time in the lowest-power sleep state. The average current strongly depends on the IR sensor sample rate and increases as ~2 x ODR, so ~19 uA at 2 Hz becomes ~27 uA at 4 Hz and ~43 uA at 8 Hz, etc. Total average power will also depend on the LoRaWAN duty cycle.
Bottom line: People Counter 2.0 offers ingress/egress detection at half the BOM cost and at least half the power consumption of People Counter 1.0.
The next step is thorough testing and assessment of accuracy...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Thanks for the kind words Jim!
Sounds like you are asking to evaluate the PeopleCounter.v02 design. I have one that I have hand assembled that I used for development work but I don't want to give it up or hand assemble any more.
I am happy to share the pcb design with you so that you could ask a prototyping fab like Circuit Hub or Elecrow (I have used both) to make five or ten of these for your use. I would appreciate getting one for further evaluation. I am happy to share the latest PeopleCounter sketch as well. Further testing and development is certainly needed.
I am not convinced yet that lenses are required for this application, but this is something that we would learn walking down this path.
Let me know if this is something you might be interested in via e-mail at tleracorp@gmail.com.
Are you sure? yes | no
Kris,
Your thorough approach to IR sensor evaluation is much appreciated! I am following your ingress/egress detection use case with the ST STHS34PF80 with keen interest. Are you planning to provide the assembled dual sensor board via Pesky Products; can you share your target availability plans? I've acquired some of the ST sensors and your bare board via OSHPark, but would also like to evaluate your implementation. I also have one of the ST eval kits that includes a Fresnel Factor lens for narrowing the FOV and extending the range of detection. Thx, Jim M
Are you sure? yes | no