Code Monkey home page Code Monkey logo

teslamodel3hud's Introduction

TeslaModel3HUD

Head-Up Display for the Tesla Model 3 using a Raspberry Pi and CAN data captured from the car.

Features

This HUD displays similar information to what is shown on the top left of the Tesla Model 3's display.

  • Current date and time, converted from UTC to local time at the beginning of the drive
  • Current speed when driving, "P" when parked, "H" when brake hold is active
  • Turn signal state (may not blink exactly like the car display though)
  • Current "gear" state (i.e. P/R/N/D)
  • Current state-of-charge in percentage

To-do wishlist (not sure if these are all possible using CAN data):

  • Next navigation step
  • Reduce display brightness when the car display switches to night mode
  • Current TACC speed if cruise is enabled

Hardware

The Jetson Nano is more expensive, but it can handle 5-10 times higher screen refres rates than the RPi. This can make for a nicer experience with the speed updating real-time when accelerating, or the turn signal indicators blinking in alignment with the car display. Please note that the Jetson Nano does not have onboard Wi-Fi, so you will need to pull it out of the car for troubleshooting or changes. If you want Wi-Fi on the Jetson Nano, you will need a USB adapter like this one.

Software

Instructions

Connect up the Pi or Nano with your LCD monitor and a USB keyboard.

Get the Raspberry Pi 3B+ loaded with Raspbian Desktop, or the Jetson Nano with the initial image of L4T. You can remove packages like LibreOffice and Mathematica as we don't need them.

If you use the Jetson Nano, switch to the GNOME Desktop (instead of the default Unity Desktop that L4T comes with). You can do this by clicking on the settings icon at the login screen. In the Jetson Nano, you also need to auto-hide the Dock and install the GNOME extension "Hide Top Bar".

Install the needed software:

  • sudo apt install git python3-pip unclutter
  • pip3 install pyserial
  • Download 'Gotham Book' font and put the TTF file in .fonts in your home directory

Clone this project and get it running:

  • git clone https://github.com/ppamidimarri/TeslaModel3HUD
  • chmod +x serial_test.py reader_test.py tm3hud.py gui_test.py

Connect the CAN harness to the USB port and check that /dev/ttyUSB0 is now available. If your CAN device shows up with a different path than /dev/ttyUSB0, you need to update serial_test.py and canreader.py with that path. On the Jetson Nano, you need to add your account to the group dialout if you want to run the HUD application without sudo.

Open a terminal and try to run serial_test.py. You should see a bunch of CAN messages. Then try to run reader_test.py, you should see summary results like speed, state-of-charge, etc.

If both these tests run OK, check the path to hud.glade inside the tm3hud.py and gui_test.py files and update them if needed. You can now test the GUI with tm3hud.py. It should run in full-screen mode. If you want to test just the GUI layout without real data from the CAN harness, you can run gui_test.py. This is useful when your Pi or Nano is not connected to the CAN harness in the car.

If your GUI is starting in full-screen mode, it is time to set the HUD to start up on boot. The steps are different for each device.

Raspberry Pi

We have to edit two configuration files.

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart, remove the @xscreensaver line, and add:

@xset s off
@xset -dpms
@xset s noblank
@/home/pi/TeslaModel3HUD/tm3hud.py

sudo nano /boot/config,txt, and at the end, add:

display_rotate=0x10000

If you are using a Pi, reduce the screen refresh rate by looking in tm3hud.py for the line that contains GObject.timeout_add and increase the number. This is what works best for me in my testing:

GObject.timeout_add(500, self.update_data)

Jetson Nano

Disable the screensaver and screen off options.

Under Activities, search for Startup activities. Add two new startup activities:

  • xrandr -x to reflect the display
  • Full path to tm3hud.py, to start the HUD GUI

Now restart your device with sudo reboot and the GUI should start up!

Pictures

HUD in action HUD in action

Close-up of driver's view of HUD Close-up of driver's view of HUD

Side view of monitor and mirror mounts Side view of mounts

Close front view of HUD Close front view of HUD

Thanks

This project owes a lot to the following people who helped me:

teslamodel3hud's People

Contributors

ppamidimarri avatar

Stargazers

QiMa avatar  avatar Jirachai Chansivanon avatar  avatar  avatar  avatar Ting Shao avatar  avatar Ronald avatar Acres avatar zhou xingfa avatar James0124 avatar bd7iki avatar  avatar Ben Griffy avatar Robin Goupil avatar HiST avatar  avatar Stan Xing avatar  avatar Yizhi Wang avatar Fed avatar  avatar  avatar Ryan Gipson avatar  avatar  avatar  avatar Kevin Abraham avatar Ian avatar DosLin avatar Erdong avatar DefiedParty avatar 贾胜謇 avatar Michael Krueger avatar CodeForFun avatar Chris Whiteford avatar Ming Yang Tsai avatar Randy Eckman avatar Jay Christopherson avatar Tristan Maidment avatar Ariri avatar  avatar Ian Bernardo avatar  avatar  avatar Pablo Álvarez Córdoba avatar Thomas avatar  avatar kevin2018mc avatar  avatar  avatar Dave Johnson avatar  avatar Omeed avatar  avatar

Watchers

James Cloos avatar Ian avatar zhou xingfa avatar  avatar  avatar  avatar  avatar  avatar

teslamodel3hud's Issues

Sell it as a package

If you can put all these things together and sell it as a package I'll pay 300 plus parts

HUD display method

Interesting project ! Thanks for sharing it.

Curious, but have you considered pre-contouring the display then use the model 3 windshield as the display surface ? The windshield could be augmented with cling material for the silvering similar to how Garmin does:

https://www.gps4us.com/GARMIN-HUD-Windshield-film--P3148.html

I would imagine this may dramatically improve the aesthetics ?

-=dave

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.