DIY a Dashcam

by dhruvarora561 in Circuits > Computers

3 Views, 0 Favorites, 0 Comments

DIY a Dashcam

nr-image-2.png

We are all familiar with Dashcams. It is a little camera which is attached to the dashboard of your car. It records footage, which comes handy when you get in a little dispute on the road.

These can be easily purchased, but we can also DIY them using a brainypi.

Supplies

  1. BrainyPi
  2. Keyboard
  3. Mouse
  4. Monitor
  5. USB webcam

Installing Motion

Motion is a software which will give us a nice UI to manage our Dashcam and will allow us to download footage from it.

It can be installed using a simple command

sudo apt install motion

After installing motion, one might encounter an error where motion fails to start because it is unable to write to the log file present at /var/log/motion/motion.log.

This can be resolved by creating a log file in home directory and changing its ownership to motion user.

sudo touch /home/pi/motion/motion.log

Now, we need to tell motion to use this file

sudo nano /etc/motion/motion.conf

Change the location of the logfile to the file created in previous step

Now, we'll change the ownership of the file

sudo chown motion:motion /home/pi/motion/motion.log


Finding the Camera ID

We need to specify the camera in the next step.

Before we do that we need the address of the camera.

Start by running

ls /dev/video*

Now, we need to find the correct name.

sudo apt install fswebcam

fswebcam will allow us to command the camera using terminal

Start by taking image using the devices list we got in step 5.

fswebcam --device /dev/video1 image.jpg

If the image is not captured, change /dev/video to the next device from the list in step 5.

Configuring Motion

We need to change a few things like default port and localhost setting

Start by opening the configuration file

sudo nano /etc/motion/motion.conf

Change the information given below

webcam_localhost=off
webcam_port=8088
control_port=8089

Now we will change the video device here to the one we got in previous step.

Find `videocapture` and replace the value here, from the one you got in step 2.

Restarting the Service

Now, we need to restart the service to apply the configuration changes

sudo service motion restart

Go to `http://localhost:8089` and there you will see the web ui for motion.