Traffic counter

A loop under the tarmac notices every vehicle that passes on our road. It has been counted since 2003, and since December 2018 every single passing is logged with its time.

This month
–
Last vehicle: –
Today
–
 
Typical day
–
average, last 12 months
Counter
–
 

A typical week

Vehicles per hour, average over the last 52 weeks

The last 60 days

Vehicles per day; shaded columns are weekends

Month by month

Vehicles per month, every year since 2019 on top of each other: summer is busiest

Show as a table

Year by year

Vehicles per year. Before 2018 the count ran from 1 April to 31 March.

Records

Since December 2018

How it works

Since November 2026

  1. The loop. Wire laid under the tarmac. Every car changes the loop's inductance as it passes over it.
  2. The detector, a Sarasota 215B fed through a 240 to 120 VAC transformer, notices the change and closes a relay for as long as the vehicle is over the loop.
  3. The counter is a Wemos D1 mini (ESP8266, a WiFi microcontroller the size of a stamp). It counts each relay closing, ignoring spikes shorter than 50 ms and anything within 2 s of the last vehicle, stamps it with the exact time and sends it over WiFi. If the network is down it keeps up to 600 vehicles and sends them later with their real times.
  4. The server stores every vehicle in a database, confirms each one back to the counter, and writes the figures on this page. On the 1st of every month it adds last month's summary.
  5. Home Assistant listens too, and flashes a yellow lamp indoors for every vehicle.

Three LEDs on the counter

Green blinks slowly: the program runs. Blue is lit while a vehicle is over the loop. Red means trouble: steady = no WiFi, fast blink = no contact with the server, slow blink = the server has not confirmed the vehicles.

The original build, 2018

From December 2018 to November 2026 a Raspberry Pi B+ did the counting. The loop and the detector are still the same.

Drawing: the loop under the road, the Sarasota 215B detector and the Raspberry Pi
Overview: the loop under the road, the detector and the Raspberry Pi.
The junction box at the foot of a tree, opened, with the cable
The junction box by the road, opened up.
Wires from the loop cable in the junction box
Two loops share one CAT5 cable. Its many conductors let you choose the sensitivity: connecting turns in series (here blue and brown) gives a stronger loop.
The new connector block in the junction box
The old connector replaced; the second loop uses only the blue pair. Everything got WD-40 before the lid went on.
Raspberry Pi with a red, a green and a blue LED and the white relay wires
The Pi with its three LEDs and the white wires from the relay.
Two resistors and a capacitor on the relay input
Two 2.4 kΩ resistors in series, plus a capacitor and a resistor in parallel, protect the input and stop contact bounce. The D1 mini uses the same network.

With two loops a known distance apart on the same road, the counter could in theory work out each vehicle's speed. The Pi's Python program · All monthly summaries as text · The page as it was in 2018