Surveillance Detection Scout - Your Lookout on Autopilot
Surveillance Detection Scout is a hardware and software stack that makes use of your Tesla's cameras to tell you if you're being followed in real-time. The name, as you likely gathered, pays homage to the ever-effective "Surveillance Detection Route". When parked, Scout makes an excellent static surveillance practitioner as well, allowing you to run queries and establish patterns-of-life on detected persons.
-- Feb Update: README to be updated shortly to reflect initial FCR.
Before going any further, I want to make sure to acknowledge the people (and repositories) who helped this project, with or without knowing they did so.
- TeslaUSB (https://github.com/marcone/teslausb).
- ALPR-Unconstrained (https://github.com/sergiomsilva/alpr-unconstrained).
- Facenet (found at https://github.com/davidsandberg/facenet) and facenet_trt (https://github.com/JerryJiaGit/facenet_trt).
- TeslaJS (https://github.com/mseminatore/TeslaJS) build off the original work of Tim Dorr (https://tesla-api.timdorr.com/)
- The whole team at Tevora (https://threat.tevora.com).
Information
Scout is a simple to install (at v1.0), and simple to use tool for analyzing video data from Tesla Model S, 3 and X camera feeds.
Scout is intended to be built on an Nvidia Jetson Xavier or Nano, but you may use a Raspberry Pi 4 if real time notification isn't a priority.
Detailed documentation coming shortly.
First Things First (Polling Data)
Even if you don't yet have the hardware necessary to start running inference with Scout, you can start polling your vehicle, so that at least you can start to capture your historical trip data. Scout utilizes TeslaJS for polling.
NOTE: Replace all CHANGEME areas in code
If you'd like to restart the poll script automatically if it crashes (internet outage or similar), uncomment lines 3 and 4 of setup.sh
, and comment line 5.
Finally, run ./scripts/TeslaJS/setup.sh
.
Xavier Setup
- Jetpack SDK full install
- Install NVMe SSD (great instructional article here)
- 3D print Xavier base cover to hold antennas
- Install wireless adapter and antennas
- Install Node
- Install, configure and start up a MongoDB instance
- Create one 240GB EXT4 partition on the SSD
- Copy the files in
scripts/Xavier/l4t-usb-device-mode
over to/opt/nvidia/l4t-usb-device-mode/.
- Plug the rear USB C into a Windows or Mac, then
/opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode-start.sh
- Once you see the drive come up on your Windows or Mac, reformat it (from said Windows/Mac) as EXT4
- Eject the drive from Windows/Mac
- Run
service nv-l4t-usb-device-mode stop
- Close and reopen the Disks app on Xavier
- Create another partition, 284GB, EXT4
- Create a partition image of the 240GB partition which you just reformatted- save it inside the new 284GB partition as
sdsusb.img
- Delete the 240GB partition
- Create a 500GB EXT4 Partition
- In
/opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode-config.sh
, uncomment line 110 and comment line 109 - Get the UUIDs of the two partions on the SSD, and update the CHANGEME areas of
./scripts/Xavier/setup.sh
appropriately - Run
./scripts/Xavier/setup.sh
and./setup.sh
from thescripts/alpr-unconstrained
directory - Reboot Xaxier
- Add the lines in ./scripts/Xavier/crontab to your user's crontab
- Congratulations, you are now a data hoarder.
- The lp2 directory requires a weights file which you can download here. This is simply custom training YoloV3 to detect license plates using the Google OpenImages dataset.
- You should run the command in unixTS from within the mongo shell to add unixTS field to any existing poll docs. This will be implemented as an automated method shortly.
Try powering down the Xavier and plugging it into a Tesla USB slot (unplug your existing flash drive first if you're using one), using the provided Xavier USB-C to USB-A cable, and powering the Xavier via USB-C car charger (into the USB-C port on the side of the Xavier with the other various ports). Tesla will either automatically mount the device, or if you see the camera icon with a gray dot, you can press-hold on the camera button to mount the device. That gray dot should turn red.
Next Up: Familiar Face Detection, then GUI. Watch this repo to be notified as code is released. Releasing code as soon as I am able.
BOM
List:
- Nvidia Jetson Xavier (https://www.amazon.com/NVIDIA-Jetson-AGX-Xavier-Developer/dp/B07G5FCJQB) or Jetson Nano (https://www.amazon.com/NVIDIA-Jetson-Nano-Developer-Kit/dp/B07PZHBDKT)
- 1TB PCIe NVMe - M.2 (https://www.amazon.com/Samsung-970-PRO-Internal-MZ-V7P1T0BW/dp/B07BYHGNB5)
- Wireless Network Adapter (https://www.amazon.com/Wireless-Card-2-4GHz-Intel-8265-NGW/dp/B07Q3NG5CZ)
- Antennas for Wireless Adapter (https://www.amazon.com/CHAOHANG-RP-SMA-Antenna-Soldering-Wireless/dp/B01E29566W)
- USB C Car Charger - 30W Minimum (https://www.amazon.com/Charger-Anker-PowerDrive-Adapter-MacBook/dp/B071WYF9HP)
- USB C Cable (https://www.amazon.com/Anker-PowerLine-Durability-Including-Matebook/dp/B071XYBPMN)
Disclaimer
This framework is provided for educational purposes only. Using this framework without permission from all appropriate parties may be against the law depending on your jurisdiction. Use at your own risk.
You may use this library with the understanding that doing so is AT YOUR OWN RISK. No warranty, express or implied, is made with regards to the fitness or safety of this code for any purpose. If you use this library to query or change settings of your vehicle you understand that it is possible to make changes that could inadvertently lower the security of your vehicle, or cause damage, through actions including but not limited to:
- Unlocking the vehicle
- Remotely starting the vehicle
- Opening the sunroof
- Opening the frunk or trunk
- Lowering the battery charge level
- Impacting the long-term health of your battery
Please be careful not to use this code in a way that loads the Tesla servers with too many concurrent requests. Calling the Tesla REST APIs at a very high frequency will stress the Tesla servers and could get your IP or favorite cloud service blocked by Tesla. Or in the worst case it could cause Tesla to revoke the key that enables access via this and many other libraries.