People counter based on capacitive sensing
In this article I will describe the operation of a people counter that uses capacitive sensing. This people counter uses two sense wires to detect the motion of a person through a hallway or entrance. These sense wires are mounted vertically to the wall and sense when a person is close to the sensor. These wires are placed so that the person walks past one wire and then the other when entering the room and vice versa when leaving. The control circuit and microcontroller can determine whether the person is "close" to a sense wire, and this can be used to determine the direction in which the person went.
An image of the setup I used is shown below
In this image, the black parts represents a wall and the red part represents the door. The green and cyan crosses indicate the positions of the sense wires. If a person walks along the blue arrow, they will first be closer to the cyan cross than to the green cross, then closer to the green cross than the cyan cross. The control circuitry interprets this as a person leaving the room.
Hardware and software
The people counter is based on an Arduino Mega that connects to two oscillator circuits. Each oscillator is connected to one sense wire, and the oscillator's frequency is determined by how close someone is to the sense wire. The schematic of the oscillator is shown below.
The 4pF and 50pF capacitors are not part of the circuit, but are parasitic capacitances in the circuit. Without them, the simulation would not oscillate.
Suppose the circuit powers up with the 75pF capacitor empty and the transistor off. The voltage at the collector of the transistor rises and current begins to flow through the inductor, charging the 75pF capacitor. Once the voltage is high enough, the transistor switches on and pulls the right side of the inductor to ground. However, since an inductor resists changes in current, the voltage on the 75pF capacitor continues to increase even when the transistor is already on. This keeps the transistor from turning off right away. Once the energy in the inductor has been depleted, the capacitor starts to discharge until the transistor switches off. Again, the inductor will continue to discharge even after the transistor has switched off. This allows the circuit to oscillate, rather than finding a stable voltage.
When a person approaches the sense wire, the capacitance between the sense wire and ground increases. Since the sense wire is connected in parallel to the 75pF capacitor, the total capacitance increases and the frequency decreases. This frequency change is measured by the microcontroller
The microcontroller counts the number of cycles of the oscillator in 100 milliseconds. If no one is near either sensor, the detector can be calibrated by adding an offset to one of the oscillators so they have a similar value. When either value goes below a certain threshold value, then the person is near that sense wire. If the person is detected near one wire and then the other within two seconds, then the microcontroller assumes that the person has entered or left, depending on the order.
The circuit described above was built from components found in other electronics. It is possible to use a similar capacitor value, for example, 100pF. Also, the two oscilators do not have to be built using the same parts, as long as they have the same values. It is not necessary to precisely match the transistors, it should be sufficient for them to have the same or similar part numbers.
Code and schematics available here
Alternative configurations
The above configuration is the only configuration I have tested. However, the following are some additional setups that could work as well.
Hallway
In this setup, instead of having the sense wires be on one side of the hallway only, they are on both sides and are connected at the top. This makes the reliability less dependent on the position of the person in the hallway.
Around a door
In this setup, the sense wires are located on the floor, with one on each side of a door. For safety, the wires should be located under a carpet or mat, but I don't know what the effect of the carpet would have on the reliability. I also don't know how the people counter would interpret shopping carts and similar large objects.
Comments
Post a Comment