Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Pi Zero W - Dashcam and Music Sync Control from Browser

This site may earn commission on affiliate links.
I just finished up Version 2 of this.

Video Showing Features Here:

Still working on a few things but thought we could get some discussion going.

Features:
  • Sync Dashcam Footage wirelessly to your computer or network share.
  • Sync Music to your Tesla
  • Control Interface from your Tesla Browser
  • Repair FAT32 file structure on TeslaCam Partition without unplugging
Specific Hardware Used (any pi should work):
Pi Zero W w/ plastic clear case: https://amzn.to/2q5aeCD
Samsung 256 Card: https://amzn.to/2PIgw6A

I have my scripts available; however it still requires a lot of manual configuration because there are so many variables:
for example:
  • How you want to partition your card
  • The size of your card
  • The network source you want to sync to
  • The protocol of the network source you want to sync to.
  • The dynamic DNS settings to connect to the pi from your Tesla Browser.
That said here are my scripts for reference:
rpi scriptsv2.zip

Additional Tips
  • You actually don't HAVE to run this from your Tesla Browser, you could do it on your phone or computer as well; that way you wouldn't need to use a WAN based IP for access.
  • If you want to use this on the go; you can do it; but you have to set up a ddns and port forwarding with a wireless hotspot.
  • You can turn the raspberry pi and this interface remotely from the Tesla APP by turning Climate Control ON. That way you don't even have to go out to your car to initiate a sync. You can do it entirely remotely.
 
dashcam2.png
Did some more tweaking... changelog:
  • Now shows size of dashcam and music drives and % full
  • fixed filename issue not showing special characters for music filenames
  • cleaned up one-click sync script
  • added music partition to the FAT32 repair process.
New Scripts here: v3: rpi scriptsv3.zip
 
I just finished up Version 2 of this.

Video Showing Features Here:

Still working on a few things but thought we could get some discussion going.

Hi @cbutters, this looks fantastic and thank you for sharing. I was working on building this one out cimryan/teslausb, yet to finish though as I just received my rPI 0/w and work stuff in the way. My friend told me with this one I linked he has had no issues for over a week if that helps and he leaves climate cooling on for 15-20 minutes for the wireless upload of his recordings. Nice to see and hear different ways of doing this, hotspot, dns, etc...

Should there be a step to stop the recording before unmounting the drive to avoid getting the dirty bit that needs to be cleaned out or do you think this does not matter?
Do you have version control somewhere to see progress or would you rather us follow this post as you enhance/update your work?
I ask because as I see the title Version 2 in your yt video.

Regardless, great stuff and following to see progress. I'm going share to others in the groups I am in to help you with feedback. :)
 
Awesome work! I was thinking about putting something like together, but didn't get around to it. Have you considered adding a script to join the mp4 files together into larger chunks with ffmpeg or something similar before syncing them? That would be a great feature to reduce the number of files.
 
  • Like
Reactions: laudbrian
Sorry if this is obvious, but is the Rpi plugged into the USB port on the Tesla and the car sees it as a drive?
Power source for Rpi?
Yep Rpi is plugged into the USB port on the Tesla. The Rpi is running a special mode so the car sees an image file on the Rpi as a usb storage device. On demand you can unmount it from the Tesla and mount it to the Rpi's system to then sync files over wireless. The Power source is a single usb cable into the tesla and requires no outside power (I'm even using it with a splitter for my Nomad)
 
  • Informative
Reactions: davedavedave
Should there be a step to stop the recording before unmounting the drive to avoid getting the dirty bit that needs to be cleaned out or do you think this does not matter?
Do you have version control somewhere to see progress or would you rather us follow this post as you enhance/update your work?
I ask because as I see the title Version 2 in your yt video.

There SHOULD be a step to stop the recording. But there is no way I know of to initiate that from the web browser. (The pi interface does have an option to repair the file system though.)

my version control is just in the file package name. I don't have any github experience or anything. I should probably play around with it. but for now I'll just update this thread and my youtube channel as well.[/user]
 
  • Helpful
Reactions: laudbrian
Is it possible to have the rpi mount the dashcam filesystem read only so you don't need to unmount it from the tesla while you copy? If so you could have it automatically copy the files locally every 15 mins, and then remotely sync from your local store when you are home. You would have a more durable store of video files (since the Tesla will automatically remove non-saved files after an hour) and you reduce the likelihood of filesystem corruption.
 
Is it possible to have the rpi mount the dashcam filesystem read only so you don't need to unmount it from the tesla while you copy? If so you could have it automatically copy the files locally every 15 mins, and then remotely sync from your local store when you are home. You would have a more durable store of video files (since the Tesla will automatically remove non-saved files after an hour) and you reduce the likelihood of filesystem corruption.
That's a great question. I'll play around with that and see if it is possible. It could be the image file is inaccesible.... but worth a shot.
 
Couple questions. If you run with the RPi, don't you need to shut it down before turning off the car? Won't the PI itself be subject to memory corruption otherwise? Can you charge a phone and run a RPi off the same port?
Ideally yes you need to shut down the Pi before turning off the car; but impossible to pull off right now as there is no way for the Tesla to signal the Pi that it is about to shut down. I suppose you could give a shutdown command option in the web interface; but it would be impractical to try to press that button every time you unlock and lock your car. So far I haven't experienced any corruption on the pi data volumes themselves. *knock on wood*
 
Ideally yes you need to shut down the Pi before turning off the car; but impossible to pull off right now as there is no way for the Tesla to signal the Pi that it is about to shut down. I suppose you could give a shutdown command option in the web interface; but it would be impractical to try to press that button every time you unlock and lock your car. So far I haven't experienced any corruption on the pi data volumes themselves. *knock on wood*
I think this is a nifty idea, and I still kind of want to do this, but I might wait and see if you get corruption issues. The car turns itself on and off allot. I just setup an old wireless G router in the garage with DDWRT on it as an access point, so the tesla can get a more reliable, albeit, slower signal connection. (I figure it's good enough for light usage anyways). Tesla shows 1 bar when it connects to the N home internet, so I set it to use the AP instead (it's right above it).
 
@cbutters I need some help please:
When I run this (step k):
sudo /etc/init.d/nginx restart

[....] Restarting nginx (via systemctl): nginx.serviceJob for nginx.service failed because the control process exited with error code.

See "systemctl status nginx.service" and "journalctl -xe" for details.

failed!
it isn't clear if steps k & l are supposed to edited into the file at step 12 or they are supposed to be run after saving and closing the file created in step 12.

I also don't know how to perform steps 13 and 14. I try drag and drop but that doesn't work help on how to do this from a file folder on the computer that I am running terminal from would be helpful.
Thanks