Car Raspberry Pi3 Dash Cam




Introduction: Car Raspberry Pi3 Dash Cam


I have previously worked with Arduino boards to develop a motion based mobile alerts. But always wanted to work with Raspberry Pi because of the diversified projects that could be done relatively easily because it is a full blown mini computer running on Debian based Linux. Then I remembered looking for a Car Dash cam a couple of years ago, but never bought one as they didn't feature all the requirements that I had in mind. The timing was perfect as I was already trying to explore Raspberry Pi and this use case made perfect sense to me to play around. Luckily for me they released RaspBerry Pi 3 model very recently, so went for it.

My expectation was below:-

1) Automatically start the raspberry Pi, start webcam and record in segments of 30 min as you soon turn on the car 12V+ Ignition Key.

2) Store videos for a month considering I spent 60 Hrs of driving on an average. Then delete any video files more than 30 days old.

3) Log all actions into a log file and again delete anything more than 30 days old.

4) When car ignition key is turned off, video recording should stop after 30secs and a graceful shutdown of OS has to be initiated. After 2 minutes, the power has to be completely cut off from the car battery. I don't want to risk with a dead car battery at any cost.

5) Finally the most important thing is to access the video and log files from my Android mobile device without connecting any cables or having to connect any keyboard/mouse/display to raspberry pi. [i.e. need to conveniently access files from inside my car cabin thru either bluetooth or wifi]

Step 1: Ended Up Buying the Following Hardware

1) 12V 2amp Wall Wart - This is mainly to simulate the car battery during my development/testing effort.

2) 12V Dc on/off toggle switch. Can be handy when required, but optional.

3) Snap plugs for easy installation and snug fit.

4) DC 12V Multifunction Self-lock Relay PLC Cycle Timer Module from Ebay - This will give you the 2 min delayed physical power off to the Raspberry Pi.

5) 2 LM2596 Step Down Module DC-DC Buck Converter - one to convert 12V Car Voltage to 5V to power up Raspberry Pi and the other - 12 to 3.3V to be connected to one of GPIO input pins[This will be used to signal turn on/off from Car Ignition 12V]

6) micro USB cable, cut off and then will be soldered to one of the LM2596 voltage regulator.

7 RaspBerry Pi3

8) RTC module - ds3231. To maintain time for raspberry pi...Note as it is installed in car there is no way for me to maintain time unless we have this module. We can also go without this module, but this makes life much easier to have the files organized and have the right timestamps.

9) Universal PCB Board to hold all components together in a neat layout.

10) 22 Gauge wires for soldering components together.

11) USB Web Cam - Anything from the compatibility chart here. Didn't use Raspberry Pi camera module as I was concerned about the length of flex cable to be used with the CSI port. Also bought a USB extension cable as in my case I required more than 2 meters of wire.

12) 32 GB micro SD Card - almost 4-5 GB will be used for OS and have at least 20 GB remaining to store 50 hrs of video [DVD quality]

Step 2: Tools Required

1) Solder kit

2) Hot Glue Gun

3) Cutting tools - nose plier, wire cutter, wire stripper

4) Heat Shrink Tubes, electrical tapes

5) Your own custom case - I used a small neat storage box from michael's store.

6) Multimeter for testing and tuning voltages for LM2596 Step Down Module DC-DC Buck Converter

Step 3: Set Up Everything

1) Install Noobs to RaspberryPi 3 using the 32GB SD Card.

2) Tune the 2 LM2596 Step Down Module DC-DC Buck Converter. One to 5V and the other to 3.3V be connected to one of GPIO input pins[This will be used to signal turn on/off from Car Ignition 12V]

3) Configure the timer circuit to function-10 [120 sec Delayed relay switch off once trigger goes off - This is how you achieve physical shutdown of Raspberry Pi after 2 mins, once car Ignition switch is turned off.]

4) Connect the 12V Wall Wart and all other components as shown in diagram. For now skip the timer circuit to make development faster.

5) Connect RTC module - ds3231. I followed anotherinstructionfrom Instructables. This will make sure time is always maintained.

6) Configure your wifi for 2 routers - 1) home - for development/testing 2) to your mobile[Wifi Tethering].

7) I didn't use raspberry bluetooth as didn't find any easy way to connect automatically without display and share files later to my mobile.

8) Install avconv for USB video recording.I didn't use motion to record as that was more for motion based recording and didn't quite get the controls i needed.

9) Install Apache web server. so that you can access files directly through http.

10) Connect everything as shown in the circuit diagram. I am no expert in doing circuit schematic diagrams :) and hopefully my rough diagram explains everything even to the novice reader over there.

Step 4: Write Some Shell Scripts/python Code

I have published all scripts and folder structure to GitHub. Below would give some overview on what is done.

Put the following Crontab entries on bootup so that everything starts once pi finishes bootup.

To record from USB Cam

@reboot /home/pi/CamProj/scripts/shell/ &

To monitor Ignition position through GPIO pins/python code and shutdown system gracefully

@reboot sudo python /home/pi/CamProj/scripts/python/ &

Delete any video/log files older than 30 days. For a 32 GB SD card this archival policy was good.

@reboot sudo /home/pi/CamProj/scripts/shell/ &

Step 5: Solder All Components Together and Final Testing

I soldered all components together and hot glued into the plastic box. Wasn't a perfect work, but hey I was impressed myself with the final look as I was totally new to this. I did some extensive testing for hrs to make sure the setup was pretty stable and fined tuned the code at this stage.

Some testing I did to make sure all worked:-

- Was the file deleted after a pre set time? I don't want the sdcard to become full and crash the entire system.

- How good was the recording when camera was shaked and under low light settings? It was good for a USB camera and would have been much better if it was a Pi Camera. Anyway I didn't go for that because of the flex cable length restriction.

- Simulated the car key Ignition on/off toggle very frequently/randomly to make sure the OS booted up/shutdown and all logs were captured as expected.

- Did some field testing with car with Key Ignition on/off before I put the system inside the car.

- Accessed the video files from inside car cabin using Android Wifi Tethering in mobile and with Apache web server running on Pi. [i.e Pi connects to mobile as router]

Step 6: Time to Connect to the Car

- The wiretap differs between various car models, but you would need 3 basic connectors coming out of the car

a) 12V always on from battery

b) 12V Ignition key On

c) Ground wire

- Use suction cup with mount to fit the USB Cam nicely behind the rear view mirror.

- Pass the Usb cable behind the headliner to A-Pillar to go inside the glove box and to the engine bay as shown in pic. I didn't remove the headliner and A-pillar for these and was able to push the cable from side. But was forced to remove the glove box to get proper access to route the wire further.

- Keep the Pi box in a place where it does not move, connect the USB cable, power cables and zip tie all in place.

Step 7: Conclusion

Below are my observation after having this installed in car for a couple of days

- First I was very much impressed with the stability and complete autonomous nature of the system.

- Every time Pi booted, recorded and shutdown gracefully.

- No drain of battery.

- The quality was acceptable considering Pi does real time MPEG 4 encoding. Will try Pi Camera module for 720P recording later if I could figure out a way to overcome the cable length restriction without any signal loss.[I need 3 meters of cable length going inside tight corners with twists] . Appreciate any suggestions here.

- Check out the video quality yourself which I took after all was connected.

- Last but not the least, the joy you get during the whole build process and viewing the end product work has no words to describe. Pls input your feedback for improvements/suggestions and I will try to incorporate.


This Instructable info is to share my experience and intended purely for informational purpose only. Changes may occur in circumstances at any time that may affect the accuracy or completeness of the information presented within any section. I do not accept responsibility for any loss,expense or liability that you may incur from using or relying on the presented information.



    • Metalworking Contest

      Metalworking Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Water Contest

      Water Contest

    27 Discussions

    I am sorry for my ignorance but can I add some features in the camera - let's say object or light detection? Is this possible?

    Nice one. Is there a way to make it with some kind of manual record and stop buttons?

    Hi would this work with a raspberry pi 3b+?

    Hi. Thank you for you instruction. Please tell me about relay. CH1 uses 12V+ Ignition to start on relay (red square in attached scheme)?


    To use Pi Cam, how about separating the build in two boxes. One containing RPI 3, RTC and the two LM 2597 boards with Pi cam mounted on it. The other box containing the timer circuit. Only 4 wires to run between the two for the 12VDC inputs to the LM 2597 boards.

    So, I'm looking into this, and the more I see the LM2596 triggering the 3.3v on the GPIO pins, why not an optocoupler, or even a mechanical relay switch to just cross the 3.3 to ground on the rpi, this way you don't have a whole component.

    I'm about to do this, as I've forked your github and about to add a raspicam version of your usb video recorder. I'll extend it a bit so I can do a push request, but the LM2596 on that gpio pins makes me nervous.

    I'm going to follow yours, then follow this one ( ) to compare, since I have several LM2596 kits I got from amazon.


    Thanks for your inputs, have couple of queries with that setup and appreciate your response.

    1) Looks like GPU hardware encoding is supported only through CSI port. So even if it is adapted to HDMI Cable will it still support GPU encoding and will I be able to achieve the 720P, 30fps video recording?

    2) Does that setup still support/work with the pi Camera python libraries?

    Yes, it's just passing the CSI signals over the HDMI cable, there is no encoder, it's it a 1:1 wire pass through. And I've tested it with a 3m HDMI cable from amazon, it's very flexible, and fits around the tight corners in my Honda Fit and Chevy Silverado.


    1 year ago

    Your circuit is a bit confusing around the timer. On the right side, there are two connections labeled NO and COM. Can you clarify that area's connection to power? It looks like the NO and COM are connected to each other, to the battery and to the positive connector on the LM2596 (5v). Is this the case, or does the connection from the COM port jump over both the connection to the NO port, and the ground to the LM2596 (5v).



    3 replies

    Yeah..It did look confusing when i see it now. COM receives always ON circuit[+12V] from car battery. NO - Normally Open goes as an input [ +5V via LM2596 ] to Raspberry PI. You can see more configuration options for this timer in

    So for clarity's sake, they are two separate connections.

    I'm assuming you take out the SD card to view any footage?

    I was thinking of something like this that could work in tandem with an Android Phone (and something like Tasker) to transfer data via wifi/bluetooth to the phone. Perhaps from there we could upload to a service such as google drive or dropbox for access at any time?

    If it's too much to ask for every piece of footage to be transferred (lots of uploading, file transfer to phone, etc), perhaps a physical button could initiate the transfer of the past ~3 minutes of footage?

    I really like the idea of a completely autonomous dashcam that automagically gets the footage on my computer at home in some way or another.

    1 reply

    I am already accessing the files using mobile tethering[Step 4 screenshot] to retrieve only that is of interest to me. But you can very well extend this to upload all your files to your home server using wifi and a simple python program considering the proximity of car garage.

    Hi Marco,

    I have thought about this and was sceptical initially about the compatibility/interference and tight corners that the cable needs to go through. Anyway I am trying to directly solder the 15 pin flex cable to the 19 pin HDMI cable instead going through the module [Why not do it the hard way :)]. I am working with an upgraded version of this project now and will let know once it works without any issues.

    Appreciate your inputs as well !!!



    Would this work with a RPi 1 Model B+ or zero?

    Hi Vijay, Nice idea. I tried to search for building a dual channel dash cam and landed on your project (see: It is a good start for me. If you happen to know any input on how this project can be modified to accommodate a secondary cam please let us know. Thanks again.

    1 reply


    I really wouldn't recommend 2 USB cameras attached to Raspberry PI3, as it will enforce all video encoding in CPU resulting in resource hogging & poor video quality.

    You can have 1 USB and 1 Raspberry Pi camera. That will definitely work, as Pi camera uses the CSI port and thus not heavily relying with Raspberry Pi CPU.

    The final picture would look like :-

    1) 1 USB camera - Uses CPU and records @ 480 resolution/15 frames per sec

    2) 1 Pi Camera - Uses GPU and records @ HD.

    I haven't tried this setup, but it should work for most part without any issues.

    Refer to my GitHub for coding instructions. You can use the crontab to add an entry for another Pi camera using python program.

    Best of luck and let us all know on how it comes.