Originally I was using an old USB camera and although it kind of worked it wasn't great.
Some time later the Pi camera was announced and so I waited....
When it arrived I was very impressed and as the CPU usage was so very low
I wondered if I could combine it with my old USB version and maybe add a GPS.
Hardware - Raspberry Pi model B, 256Mb
OS - Arch Linux (or Raspbian)
Case - Stealth Black Raspberry Pi Case from modmypi
Front camera - Pi camera
Rear USB camera - Microsoft LifeCam HD-3000
GPS - Adafruit Ultimate GPS Breakout
LEDs - 3 x 3mm (red, green & yellow or blue)
Pi camera mount - From pimoroni
SD card adaptor - pIO microSD card adapter from modmypi
SD card - Samsung 32Gb micro SD PRO Card Class 10 UHS-I from dataio.nl
Here it is! A nice new case, some flat top LEDs and the GPS tucked inside. The Pi camera can also
be raised or lowered in the mount. All in all I'm pretty happy with the way it has turned out.
If you want to see the install instructions click here. Below is further information on how it was made.
I managed to reduce the GPS / Pi camera interference issue and now everything is running really well.
I have moved the GPS unit back inside the Pi case and have updated a lot of the programs including
adding a global resource file. Still a few things to do but I am going to start making a nice new (slightly
less swiss cheese like) dashcam unit very soon.
Dashcam version 3
I've now moved the GPS unit on top of the case to try and stop the interference from the Pi camera but
it has not really helped. The readings are usually good but it can easily wander way off-course, if I
disconnect the Pi camera it is consistently accurate. I'm not happy with it though and it defeats the
purpose of why I changed the unit from version 1.
Front Pi camera
The Pi camera is fixed in place above the SD card slot in the camera mount I bought from pimoroni.
As it has 4 slots I thought it could be raised or lowered as desired but unfortunately the first time I
moved it one of the holding tabs broke. No biggy though, it's fine where it is. I used the standard Pi
cam. ribbon cable but it is slightly folded so it can run along the left inside the case.
The video for the Pi camera records at 960 / 540 by default but is dependent on the size of the memory
card. If it is more than 32Gb it can record at 1920 / 1080. If a USB memory stick is detected it can
write to that instead of the internal card. I think this is actually more favourable as it seems to perform
better (although I have not tested thoroughly). Between 10pm - 6am (or user defined) raspivid runs
with the "-ex night" option. Approximately every 15 minutes raspivid ends and immediately starts
a new recording.
Rear USB camera
I had a Microsoft HD-3000 camera for this. I've borrowed other USB cameras, some had slightly
better resolution or faster frame rates but their was not much between them so I stuck with what
I had spare. It is held in place on the rear right car headrest using velcro. It is quite discreet and barely
visible from outside of the car. I put it there a long time ago and haven't had to touch it since.
It connects to the Pi on the dashboard using a 3 metre long USB extension cable.
The rear camera video is recorded using the excellent motion software program. It was hard to find
some proper specs. regarding the HD-3000 but running at 512 / 288 @ 12fps gives good enough
results. Every 10 minutes it starts a new video file.
There are three LEDs on the front right next to the USB slots. The red comes on when a power source
is connected. The green lights up when the OS is running and available and the yellow is a general
GPS and video recording status indicator. If the Pi is having problems with the GPS, video recording
or a system problem the yellow and / or green will flash at different rates (I do need to document this
As you can see this case has been through a lot. If / when I can resolve the GPS problem
I will make a shiny new dashcam.For this I wrote a C program (with thanks to Blog of Adam for getting me started) which uses gpsd to
read the GPS units data. The time, location, speed etc. are all written to one main logfile. Another file
is written at the same time in gpx format with tracking information which can then be viewed in google
earth for example. I have had the most problems with the GPS though. It is possible to fit the GPS unit
inside the Pi case in a couple of places but the Pi camera interferes with the GPS unit very badly. I did
trying using some copper plate to shield it but to no avail. It would be so nice to have the GPS inside
the case but I just can not get it to work well together with the Pi camera.
A status file is updated every minute with the uptime, CPU clock speed (usually 700Mhz or 900Mhz)
and temperature. If the unit temperature rises above 82°C it will stop the motion process as this uses
a fair chunk of CPU. Once the temperature falls below 78°C motion starts up again. I am not sure how
useful this is yet but it was easy enough to implement. (As far as I can tell, if the temperature rises
above 85°C the Pi will switch itself of immediately but don't quote me on that.)
A script for each camera runs every 2 or 3 minutes to keep an eye on the video space. Once the
thresholds are reached the oldest files are deleted until sufficient space is available again.
If a network connection is detected SAMBA starts up so you can access all the files.
I added new larger soft button (well, I had a spare hole) just to make it easier to reach. A quick press
will issue a system power-off command and a longer 2+ second press will send a system reboot.
This will probably be the final setup, at least using this Pi case. It has taken a lot of punishment. I have
opened and closed it countless times. Many holes have been drilled and cut into it but it's still holding
together really well. The plastic is also really nice as it is very flexible and fairly easy to drill or cut.
If you are looking for a basic, cheap case then I would recommend it.
The GPS works well, the Pi camera is great but the interference issue when they are running together
is frustrating. I might try the version 1 setup with the GPS at the other end to see if that's any better.
When the unit is shutdown using the button the green and yellow LEDs switch off to indicate it's
stopped but the Pi writes/flushes to the SD card for a second or two longer.
On a sunny day the unit can get pretty cooked on the dashboard and could overheat. Further testing
(and some sunshine) is needed.
Some things I am thinking of doing:-
- Creating some kind of global resource file you can change all the settings in.
- Having NTP sync with the GPS time.
- If a USB stick is inserted have all camera and log data write to it (not just the front camera only).
- Maybe moving the power connector to somewhere more convenient.
- Text overlay on the Pi camera video recording with date, time, location, speed etc.
- A fisheye lens to get a wider view of the road.
- Adding a microphone
Dashcam version 2
The Pi camera is inside the case laying flat on top of the ethernet socket and connected via a 5cm
ribbon cable. The 32Gb SD card has been swapped for a 32Gb micro card (in an adapter). The idea
was to have the unit vertically mounted on the dashboard but after a USB memory stick, power and the
USB camera are all connected the thing looked very large in the screen grip and takes up too much
space for my liking.
I wanted to try and hide the wiring.
In the end I wasn't really that happy with how the unit looked or how much space it took up on the
windscreen when it was all connected up and so, onto version 3...
Dashcam version 1
The Pi camera sits on top of the case over the top of the CSI slot facing towards the ethernet and USB
connections. It is held in place with blue tack and connected via a 5cm ribbon cable. I also installed
a RTC so the video file creation names would be correct and also so that the time text overlay on the
motion software video for the rear camera would be right.
Three coloured LEDs are placed above the SD card slot (which faces the driver) to show the device's
status. A click button for halting or rebooting the OS sits above the power connector on the right
Sadly I never took any pictures of the original (blue tack and all), but this version 2 picture shows the
location of the LEDs above the SD card and the poweroff / reboot momentary button.
Although this worked really well I could not find a robust way to hold the Pi camera unit in place and
with it always being upright it was not very easy to store in a glove box. I toyed with the idea of a flip-
up hinge mechanism but this was beyond my means (and skill).