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

Anyone still rocking a Pi Zero W smart drive for TeslaCam on Sentry Mode?

This site may earn commission on affiliate links.
Over the weekend I endeavored into this project. After multiple image writes using rufus (at least 10), I have it running. My micro SD card is 128GB and I divided my dash cam and music partitions in half. Once I was able test videos were copying when leaving the car and connecting to home WiFi, I moved onto the music.

I had already tested music sync with a couple of albums being copied over as an initial test. So then I erased that music and proceeded to connect through USB so I can copy files faster. Or so I thought. I plugged into a laptop and was presented with the CAM partition and the Music partition. So I then started copy my 30GB of music over to the appropriate partition. This took a good 2.5+ hrs. I was averaging around 3MB/sec on copy. Since I was short on cables, I just used the cable that was for my smart watch. So I didn't get to check to see if that was the issue. Do other people find copying music agonizingly slow?

Initial plugin to car presented with sentry mode icon and recording indicator. However music didn't show up at the time and it appeared that shortly after sentry mode wasn't available. After unplugging from USB hub and plugging back in, both items were working as it should. Once I copied all my music and plugged the Pi Zero W back, nothing showed up for about 7 minutes so then I pulled it out and plugged back in and everything appears to be working at this point.

I can't imagine having to reimage just so I can copy music over again as I'd rather a separate USB just for music at this stage.
USB writes won't ever be fast with a Raspberry Pi Zero. They're a bit faster on an Orange Pi Zero (I don't have the newer flavors of Orange Pi Zero at hand to test but they might be tad faster still).

The problem is that instead of writing directly to the storage, like with a regular USB drive, it's going through disk emulation software running on the Pi Zero, and it's not a particularly fast device to begin with. A combination of the slowdown due to g_mass_storage software emulation of a USB drive, and slow actual IO to the underlying storage, and various internal data paths that are slower than full USB speed, means that write speeds will always be mediocre at best on these lower powered Pi devices.

Hopefully a Raspberry Pi 4B will be much faster since it's not a lower power device. I plan to pick one up soon to play with.

Perhaps you can set up a Samba ("Windows") network share on your device and transfer the music via WiFi instead, this might be faster (or might not, for similar reasons these small Pi devices tend to have slow WiFi)
 
The problem is that instead of writing directly to the storage, like with a regular USB drive, it's going through disk emulation software running on the Pi Zero, and it's not a particularly fast device to begin with. A combination of the slowdown due to g_mass_storage software emulation of a USB drive, and slow actual IO to the underlying storage, and various internal data paths that are slower than full USB speed, means that write speeds will always be mediocre at best on these lower powered Pi devices.
I was hoping the separate images (video and music) could be written to directly. Similarly to writing the img file to SD.
Hopefully a Raspberry Pi 4B will be much faster since it's not a lower power device. I plan to pick one up soon to play with.
Got one but nothing interesting is even out to do anything with it at this point unless you just want to run Raspian.
Perhaps you can set up a Samba ("Windows") network share on your device and transfer the music via WiFi instead, this might be faster (or might not, for similar reasons these small Pi devices tend to have slow WiFi)
It is already setup to sync music through SMB share and tested. Am I missing something? How is this to make it faster than directly copying which still uses disk emulation?
 
I was hoping the separate images (video and music) could be written to directly. Similarly to writing the img file to SD.

Got one but nothing interesting is even out to do anything with it at this point unless you just want to run Raspian.

It is already setup to sync music through SMB share and tested. Am I missing something? How is this to make it faster than directly copying which still uses disk emulation?
The only way to really write "directly" would be to remove the SD card from the Pi, connect that directly to the PC, and copy that way (and it assumes they're regular partitions Windows can read and not disk images on a Linux partition or in LVM etc - which I think most of the Tesla USB projects use regular partitions, but I don't know if they all do). Then your only limitation is the speed of the SD card or SD card adapter.

I believe someone else said they'd already installed some flavor of Tesla USB software onto a 4 - thought I may be mistaken. While there may be no one step installs available yet, you can likely still install some of them the manual way on top of Raspbian.

The WiFi connection on the zero isn't great so it wouldn't surprise me if it was essentially just as slow as USB disk emulation. I had suggested it because there's less software / hardware overhead in going through WiFi and SMB versus disk emulation. Though as I said it might not matter since the WiFi isn't particularly fast on the Zero...
 
The only way to really write "directly" would be to remove the SD card from the Pi, connect that directly to the PC, and copy that way (and it assumes they're regular partitions Windows can read and not disk images on a Linux partition or in LVM etc - which I think most of the Tesla USB projects use regular partitions, but I don't know if they all do). Then your only limitation is the speed of the SD card or SD card adapter.

I believe someone else said they'd already installed some flavor of Tesla USB software onto a 4 - thought I may be mistaken. While there may be no one step installs available yet, you can likely still install some of them the manual way on top of Raspbian.

The WiFi connection on the zero isn't great so it wouldn't surprise me if it was essentially just as slow as USB disk emulation. I had suggested it because there's less software / hardware overhead in going through WiFi and SMB versus disk emulation. Though as I said it might not matter since the WiFi isn't particularly fast on the Zero...
I didn't notice any directories where it was obvious where it was stored. From the logs, I thought it created a single image file for music and for video. If you know where it's located, I would gladly test it and would have gone that route.
 
I didn't notice any directories where it was obvious where it was stored. From the logs, I thought it created a single image file for music and for video. If you know where it's located, I would gladly test it and would have gone that route.
The first versions were all manual installs (at best you ran a few commands to download a setup script to the Pi and execute it). Lately they've been conveniently offered as ready-made images to put on SD card. If any of them still have manual steps available to try, you can try to follow them starting from the vanilla Raspbian installation, but naturally they'll require a bit more knowledge of Linux / etc versus just using the "one step" images. But doing so would let you try it out on a 4B now without waiting on 4B compatible one step images.

Since nobody who has tried it has chimed in, I assume that everything "just works" if you go through the manual installation.

I don't have a 4 yet to do any testing. Didn't expect them to sell out so fast and so didn't pick one up right away, almost everywhere is sold out now. I ordered one via one of the online retailers and hopefully it'll be here this weekend ... normally I'd just stop by Microcenter and pick one up any day of the week, but the 4's are selling like hotcakes.
 
I don't have a 4 yet to do any testing. Didn't expect them to sell out so fast and so didn't pick one up right away, almost everywhere is sold out now. I ordered one via one of the online retailers and hopefully it'll be here this weekend ... normally I'd just stop by Microcenter and pick one up any day of the week, but the 4's are selling like hotcakes.
Don't forget this iteration has the wonky USB-C charger.
 
Just noticed a minor bug today using Pushover notifications. Previously it would report the time correctly when archiving. However, this time it had the time November 3, 2016 in the archiving message. Since Pushover already logs time in the notification, it is redundant to have it in the message.

Most likely what happens is the car is asleep and it can take up to a couple of minutes before you regain video and music capabilities. So if you leave the garage before it has a chance to NTP sync, it reports that default date. So the solution is to change the archive message and/or have it do an NTP sync before archiving begins.

I'm using the marcone fork, BTW.

edit: I see he is aware of the problem already
NTP sync? · Issue #93 · marcone/teslausb
 
My Pi 4 came in. some quick tests have me getting around 10MB/s through USB to the Pi.

I got about the same speed (10~12MB/s) over Samba via WiFi AC 5GHz (but as always with WiFi your mileage may vary)

I tested both writing to the SD card itself and also to USB attached storage (SSD via USB3 sata adapter). The speeds were about the same regardless, so the bottlenecks are USB OTG and WiFi still, but at least they're quite a bit faster on the Pi 4.

So, quite the improvement over the Pi Zero W and the Orange Pi Zero. Of course, it'll run hotter and take up more space...
 
So, quite the improvement over the Pi Zero W and the Orange Pi Zero. Of course, it'll run hotter and take up more space...
Thanks for the update. If you're not aware, there is a newer firmware that will make it run a bit cooler. Form factor is quite a bit bigger and I still don't have a case for my Zero yet. I should just print one out as I'm just using the antistatic bag for the time being while it is in the car. Not sure if this is related but when it got hot in the car, noticed that some cameras tend to pixelate. Noticed the file differentiation in size so that is a dead giveaway on how file will be viewed and synced.
 
Thanks for the update. If you're not aware, there is a newer firmware that will make it run a bit cooler. Form factor is quite a bit bigger and I still don't have a case for my Zero yet. I should just print one out as I'm just using the antistatic bag for the time being while it is in the car. Not sure if this is related but when it got hot in the car, noticed that some cameras tend to pixelate. Noticed the file differentiation in size so that is a dead giveaway on how file will be viewed and synced.

I haven't actually put anything in the car yet (using regular USB drives still), but my plan is to both put heatsinks on it and also use the Pi Power Hat which will both provide power from 12V and also has a fan to cool the Pi. Currently using the HighPi case and I'm using standoffs and GPIO stacking headers to raise the hat off the Pi (otherwise no room for heatsinks, plus also would have to cut a hole in case vs just break out one of the break away sections). Might end up with a different case eventually, the pickins was slim. Possibly could use a lower profile case and no standoffs / stacking headers by moving the fan on the Pi Power Hat to the top side of the board, but would depend on the case and so forth.

I did some longer tests and found the write speed to the SD card, after the first 30 seconds or so, varies a lot (even though it's a sandisk A1 rated card) between 6-12MB/s. Seems that sustained writes are not so great to that card. However, no such behavior (constantly at max USB g_mass_storage or WiFi speed) with the external SSD via USB.
 
Last edited:
Wondering if anyone knows how to fix the issue I have: music playback cuts out the moment the Pi catches my home wifi with the car still in motion. Is there a way to code in a delay of the archiving script?
I believe there was a setting for this in the setup variable config file.

# By default there is a 20 second delay between connecting to wifi and
# starting the archiving of recorded clips. Uncomment this to change
# the duration of that delay
# export archivedelay=20
 
  • Informative
Reactions: dsgerbc
The Pi Zero W works great as a USB stick that pushes files to another computer. The build with the prebuilt image from marcone/teslausb is very easy to set up - you just have to configure your WiFi network credentials and your file share credentials, and (optionally) split the drive into two partitions, one for music and one for video from the car.

I wouldn't expect that the Pi 4 would work for this, since it can't be programmed to be a USB device, only as a USB controller. I'd love to be wrong, since the Pi4 is a nifty device, but both Raspberry Pi and the TeslaUSB documentation is pretty emphatic on this point.