700 Words | Approximately 4 Minutes Read | Last Modified on July 29, 2020
The long version
Here are the whys and hows but if you’re not interested, skip to the end for the short version.
Where I live in N22 a nearby council is implementing a “low traffic neighbourhood” - closing streets at one end and changing the layout of roads. It’s politic to say that some people like this idea, while some others do not like it so much. I wondered about the frequency of traffic outside my house and how the scheme would affect it. I wondered if there were any open source projects for traffic monitoring. I think I searched for “traffic survey raspberry pi” and found the telraam project. This seems to be in use in a lot of places already, often under the aegis of some local authority. It uses a small computer called a Raspberry pi and a tiny camera looking out of your window at the road. The Raspberry pi analyses the video from the camera and detects cars, bikes and pedestrians. It submits the counts to a central server which makes a nice dashboard with graphs and things. The BBC have a news story from Jan 2020 here.
Telraam sell a DIY kit here
I didn’t use their kit though so I can’t vouch for it. The Pi in that picture looks like an old model.
That case looks like the OKW case which you could get here if you wanted.
There are instructions here if you’ve bought one of their kits, but they’re generally useful if you’re doing it another way.
I already had most of the bits lying around, so I thought I would just have a go.
The setup was easy and the system is obviously well thought out. I had no problem setting it up for a london street even if that’s not where it was originally designed for.
The problem I had was keeping the camera attached to the window. I was originally using the adafruit camera case just gaffa taped to the glass. The window is east facing and gets very hot in the morning, so all the glue melted and it kept falling off. I upgraded to a zeroview (The PiHut list a cheaper version but it’s never in stock). The zeroview sticks fine but looks horizontally out, so doesn’t see the road. I’m using bits of tape to angle it at the road. Looks dodgy but has remained securely in place for a while now.
The Telraam website hosts a nice dashboard with lots of graphs including direction and speed of traffic. See mine here
I’ve not counted the cars myself, but the statistics it produces seem about right. The camera is cheap and can’t see the road once thw sun goes down, and there seems to be an hour of the morning when the angle of the sun dazzles the camera and it produces poor reaults. The telraam system seema to detect this hour has poor qulity data.
The video is analysed on the raspberry pi and it only uploads statistics. About once a day it uploads a low quality image so you can check that your camera is still poonting at the road. That image isn’t made public.
The short version
You will need:-
- A first floor window with a good view of the road
- A connection to the internet
- A raspberry pi (a 3 is fine if you have one, if you’ve not got one, get a raspberry pi 4) £34
- A good power supply (get the official one anything else is dodgy) £8
- A case for the pi with a slot for the camera lead - £10
- A raspberry pi camera module v2 - £24
- Some way of keeping the camera on the window (I used a zeroview)
An SD card (and some way of writing the Telraam software to the SD card)
You might want a camera extension lead. They come in lots of different lengths, just get the right one depending on where the pi is and where the camera is. The camera module comes with a lead, but it’s quite short.
How to set it up
It’s easy! Just follow their instructions.