Not the snappiest of titles, but it covers what we are trying to achieve! Some very smart people have worked out how to make your Tesla believe your Pi Zero W is a USB drive, this then uploads your saved clips and Sentry mode events to either a local NAS or Online service when you connect to WiFi.

This guide focuses on getting the sync to work to Google Drive, as the NAS transfer seems to work off the bat with the headless setup guide found on the Marcone teslausb github page linked below.

The instructions I’ve based this off have come from:
https://github.com/marcone/teslausb
https://github.com/marcone/teslausb/blob/main-dev/doc/SetupRClone.md

I’ve then filled in the blanks from lots of googling and a discussion thread on the https://teslamotorsclub.com forum.

Here we go!

First off, you will need;
Raspberry Pi Zero W & Case
Micro SD Card – 64gb (£10.58 at time of writing)128gb (£16.42 at time of writing)
Micro USB lead to connect it to the car

Purchases via these links give a kick back to the Tesla Owners Group UK who use these funds to do great charity work.

Next you will need to grab the image from Gitlab, the Marcone fork is what I’ve used and seems to the most frequently updated.

https://github.com/marcone/teslausb

I’d suggest grabbing the image file and burning it to your micro SD card, on my Mac, I used ‘ApplePi-Baker’

Once the image is on the micro SD card, on your laptop or desktop edit the “wpa_supplicant.conf.sample” file and replace your WiFi details within the quotation marks in the below section:

network={
ssid=”YOURSSID (Wifi name)”
psk=”YOURPASSWORD (to connect to the Wifi network)”
key_mgmt=WPA-PSK
}

Once done, exit and save the file, rename it to remove the .sample, so the new file should be wpa_supplicant.conf

You are now ready to put the microSD into the Pi and boot it up!

Once the Pi has power (plugging into your laptop/desktop is fine to power it) you should then SSH into it, on a Mac I use Terminal, choose your favourite SSH client in Windows. To do this in Terminal: ssh pi@teslausb.local

The default password (you should change this once complete) is: raspberry

Once you are in, the next command to run is: sudo -i

Then: curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash

Once this is completed, we now need to configure rclone, run this to start: rclone config

Use the following options;

  1. n for new remotes
  2. gdrive for name
  3. 12 for Google Drive
  4. Leave client_id and client_secret blank (hit enter to leave blank on both)
  5. Option 1 (some people have said option 3 works just as well)
  6. Leave root_folder_id and service_account_file blank (hit enter to leave blank on both)
  7. n to skip advanced config
  8. n for autoconfig
  9. Copy the link to create a token, then approve in the Google authentication screen
  10. Copy the verification code and paste into your SSH session.
  11. n for team drive
  12. y to confirm

Once rclone config is complete, run:
export RCLONE_DRIVE=”gdrive”

Then run: rclone listremotes
This is to validate that you can see what you’ve just done has worked.

Then run the following one after the other:

export ARCHIVE_SYSTEM=rclone
export RCLONE_DRIVE=gdrive
export RCLONE_PATH=TeslaCam

rclone mkdir “$RCLONE_DRIVE:$RCLONE_PATH”
rclone lsd “$RCLONE_DRIVE”:

The last command should confirm that the TeslaCam folder now exists in Google Drive, if not, start over from the rclone config stage.

Assuming you just want to use your drive for TeslaCam / Sentry mode, run; export camsize=100%

EDIT: My advice would now be to set the camsize=60% and musicsize=10% leaving some free space on the drive. Without this, I started getting USB drive too slow errors, so instead of the above run:

export camsize=60%
export musicsize=10%

Next, run the following commands one after the other, the final command takes a good while to run as it installs lots of components and pulls down from the teslausb repo.

mkdir -p /root/bin
cd /root/bin
wget https://raw.githubusercontent.com/marcone/teslausb/main-dev/setup/pi/setup-teslausb
chmod +x setup-teslausb
./setup-teslausb

This is where I’ve had to do a couple of extra changes not in the original instructions as it would not work without them and trust me, I rebuilt that image about 50 times trying to get this working!

Once the setup-teslausb has finally completed, run:
mv /root/.config/rclone /mutable/configs 

The above moves the config directory to where rclone / teslausb expects them to be.

Next we need to create a symbolic link from the .config folder to the mutable config directory, to do this, run:
ln -s /mutable/configs/rclone /root/.config/rclone

If you run the following;
ls -l /root/.config

This should confirm your symlink is in place (the –> shows it’s working, it should look like this (but with correct time stamps!)

total 0
lrwxrwxrwx 1 root root 23 Oct 31 10:25 rclone -> /mutable/configs/rclone

That’s it! – run; halt

This will stop the Pi, you can now unplug the Pi. The next time you boot it up it’s good to go, so stick it in the car, do a test save once it’s booted up and the camera icon appears (teslausb only uploads saved records and sentry mode events).

You can SSH into the Pi to check what’s going on by reviewing the log file in the mutable folder by either tailing or editing the archiveloop.log file.

Dave.