Piezoelectric sensors collect data by converting mechanical energy into electrical energy. When used to count vehicles, the sensor is mounted in a groove cut into road's surface.
When a car drives over the piezoelectric sensor, it squeezes it and causes an electric potential - a voltage signal. The size of the signal is proportional to the degree of deformation. When the car moves off, the voltage reverses.
This change in voltage can be used to detect and count vehicles.
The counting device which is connected to the sensors is housed in an enclosure by the side of the road. Data may be collected locally via an Ethernet or RS232 connection to a laptop, or may over a mobile phone network.
Piezoelectric traffic counter by the side of the road
Photo by Louis van Senden [CC BY-SA 4.0]
Counting vehicles with piezoelectric sensors has the disadvantage that the road needs to be closed during installation. The units can generally only monitor one or two lanes of traffic at a time.