Difference between revisions of "Tinkla Buddy"

From Tinkla: Tinkering with Tesla
m (Custom Tinkla Menu)
m (History)
Line 63: Line 63:
 
==== History ====
 
==== History ====
  
===== v1.32 =====
+
===== v1.33 =====
 
* Tesla 2020.24.6.1 compatibility
 
* Tesla 2020.24.6.1 compatibility
 
* [[#Cron_Jobs|Remote cron capabilities]] that allow you to run bash scripts on CID every 1, 5, 15 or 60 minutes (requires root persistence)
 
* [[#Cron_Jobs|Remote cron capabilities]] that allow you to run bash scripts on CID every 1, 5, 15 or 60 minutes (requires root persistence)

Revision as of 22:42, 11 August 2020

T Buddy.png

What is Tinkla Buddy?

Tinkla Buddy (formerly rPanda) is a nice solution for our Teslas to have Instrument Cluster [IC] integration without root.

If you don't have root access to your Tesla, you can now enjoy these benefits:

  • OpenPilot Integration into IC for pre-AP cars.
  • In car WiFi Access Point
  • Remote App (work in progress)
  • Vitals to Tinkla
  • Factory mode
  • and More!

The entire Tinkla Buddy install costs about $200 USD, depending where your source components. There will be a subscription of $150 for the first year and $100 for each subsequent year. Subscription fees will be used to maintain the remote access Bastillion server for the Remote App and other remote services.

Tinkla Buddy Install Kit

  1. EPAuto 12V Car Add-a-circuit Fuse TAP Adapter Mini ATM APM Blade Fuse
  2. RealQvol FriendlyARM NanoPi R1S portable small route all Chi H3/H5 dual Gigabit Ethernet port 512M memory OpenWRT linux pi mini
    1. NanoPi on EV Cables Company H5
  3. DC 12V To 5V 3A 15W USB Output Power Adapter Converter Module For Car Boat
  4. TRULE 128GB Micro SD Memory Card High Speed Class 10 Micro SD SDXC Card with SD Adapter (128GB)
  5. UGREEN RJ45 Coupler Cat7 Cat6 Cat5e Ethernet Cable Extender Adapter LAN Connector in Line Coupler Female to Female (Black)
  6. Eyelet
  7. Tripp Lite USB 2.0 Hi-Speed A to Micro-B Cable (M/M) 3-ft.
  8. Professionally made cable set from https://www.evcablescom.tech/products/tinkla-buddy-cable

or instead of EV Cables Company's cables you can make your own using:

  1. Cable FAKRA HSD LVDS 1m female male Dacar 535 4-Core
  2. Network cable with RJ-45


Creating the SD card

  • On Windows PCs you can use Win32DiskImager to create to burn the image to the SD card for your Tinkla Buddy.
  • On Linux flavors (including Mac OS) you can just use the dd command.
dd if=tinkla_buddy.img of=/dev/dse status=progress

where tinkla_buddy.img is the name of the disk image you downloaded from this site and /dev/sde is the device corresponding to your SD card mounted on Linux.

Writing the image to the SD card can take 30 minutes.

Disk Images

Please select the appropriate image for your device.

Device Image MD5sum
R1S H5 v1.22-H5 (built 03/22/2020) 77f1c932262e44b9267dd7a85d87c969
R1S H3 v1.22-H3 (built 03/22/2020) 38181aa0f508f2e599806e9a94ade3ca

Note: the image file is very large (650+ Mb compressed) and will take some time to download. Also, depending on the speed of your SD card, it may take a long time to burn.

History

v1.33
  • Tesla 2020.24.6.1 compatibility
  • Remote cron capabilities that allow you to run bash scripts on CID every 1, 5, 15 or 60 minutes (requires root persistence)
  • Fixes for persistence scripts to work well with 2020.20 and newer Tesla software
  • Speed/reliability improvements
v1.27
  • Fully boot without being connected to either IC or CID
  • Reduce number of QtCar restarts by detecting IC state
  • Increase automatically switch back to analog to 5 min to allow for buddy reboots without changes to IC
  • Increase number of checks for state of IC and CID before pulling Vitals
v1.26
  • Allow Buddy to boot without IC/CID on
  • Bug fix for IC not turning on after deep sleep

(Note: Vitals need to be re-enabled after each version upgrade)

v1.25
  • Bug fix for vitals without root on latest versions (up to 2020.12.11.5)
  • Bug fix with Factory Mode on latest versions (up to 2020.12.11.5)
  • Detects automatically if cars has AP hardware (1/2/2.5/3)
  • Detects automatically if car has MCU1 or MCU2 hardware
  • Vitals checking is an option now in Tinkla Menu and is disabled by default
v1.22
  • Fully redesigned networking stack for faster response on boot, activation and interaction
  • Now Tinkla Buddy can be installed between IC and MCU (IC <--> Buddy <--> MCU) or between MCU and APE (MCU <--> Buddy <--> APE) allowing it to work on both MCU1 and MCU2 cars.
  • Auto-detection of MCU type (Tegra vs Intel)
  • Auto-detection of AP type (pre-AP, AP1, AP2, AP2.5, AP3)
  • Auto-detection of installation location
  • Improved WiFi stability
v1.21
  • Fixes issue with starting persistence mode
  • LEDs now show status of tinklaBuddy and availability of valid cert
v1.20
  • Menu button trigger for Tinkla Menu for older (LIN based) steering wheel controls
  • Fixes brightness control
  • Resolves issue with crash when car would go in sleep mode

Buddy Installation

The hardest part of installing a Tinkla Buddy is finding an always-on power source. The three most viable options are (a) if you have a Tesla with the Cold Weather package there is a fuse box near the accelerator which makes this a 30 minute install, (b) if you have a fuse box behind the passenger kick panel (2016 and later) and you'll need to re-crimp your 12v red wire for an hour install, or (c) if you don't have a fuse box in the cabin pull a wire through a gasket on the firewall behind the washer fluid reservoir in the Frunk which can take 1-2 hours.

For those getting the Buddy for Beta testing, you need to send @BogGyver#9177 your VIN, so he can add it to his server.

Instrument Cluster Connections

There are multiple videos on how to remove the Instrument Cluster [IC], here is one for the Model S:

Tools worth investing in:


Step-by-Step guide to remove the IC

Step 1

Remove the “faux leather” knee-board trim just below the IC and steering wheel. It’s the large piece with a soft touch feel to it. This piece is held in place by pegs. It’s easiest to start over on the right side just below the hazard lights button, to the left of the MCU. Put your palms facing away from you, touching the soft surface, and grab the top ledge of the trim with your fingers and pull back. It will eventually pop out, and you can work your way to the left and remove the parts under the vent to the left of the steering wheel. To be safe, put the piece of trim in a safe place where it won’t get scratched. Back seat, or trunk, are good options.

Winter14.pngWinter12.jpg

Winter13.jpg




At the same time, go ahead and remove the small “hatch” cover trim panel on the left side of the dash where the door meets the dash. There is a screw in here (red arrow) that holds the top dash trim to the frame which is essential to remove! The video instructions to remove the IC did not include this screw.

The upper right and right pics show other screws that will need to be removed. Go ahead and remove the two on the left now.




Step 2

Winter15.png






Next you have the small piece of trim just above the steering wheel. Note that this can be very tight. It’s held on only with pegs. The IC disassembly video didn’t show this part (it was already loose). You can see two plastic tabs on the left and right side. Don’t grab and pull straight back. Instead, grip them from the bottom and pull the bottom up at a slight angle. The tabs will pop out quickly (see pics below).






Winter16.pngWinter17.png



Remove more screws! There are two screws under the small trim piece you just removed, on the right and left sides. Remove both of them. Also, in the right pic below, remove the screw on the right.

Winter18.jpgWinter19.jpg



Winter20.jpg




Step 3

It’s dash time! There is a thin plastic panel above the IC, on the bottom of the sun guard. Pry it off with a trim removal tool. It’s held in place with 4 pegs (right pic).




Winter21.jpg

Winter22.jpgWinter23.png

Next take out two more screws holding the frame to the trim. Then, put in your air-shim tool and pump it up! This is the part where you want to make sure you removed that one screw in the side hatch! Pump it up until you reveal the screws shown in the pics above. At this point, you should be able to remove the silver colored IC shroud.



Winter24.jpg

Step 4

Almost there. Now remove your two AC vent trim pieces. Be careful with this part, as these are the pieces that make your car look pretty. They don’t make Lacewood anymore in my case. Put these somewhere soft where they won’t scratch, like on the carpet. Use a pry tool to pull them away from the dash on the bottom. Make sure you’ve removed the screw holding them into the dash on the top as well (it’s one reason we raised the dash in the last step).

Now you have access to the final two screws (pic below).

Winter25.png



Step 5

Now you can pull the IC out towards you, and then rotate it so that the screen faces the roof of the car.

Winter26.jpgWinter27.jpg

The fakra connector is coming straight out. Get a flat head and push on the tab. In my case it was taped tightly to the loom bringing power in, so there was no fear of it falling into the dash. If that does happen to you, you can get to it by going under the steering wheel (see pics below for reference). Plug your new cable into the IC and then plug the other into the car’s cable (only one right way to plug them). Route the cables back in the hole behind the IC where the original network cable came from. Push the IC back into place on its alignment pegs. You’ll want to get both cables over to the left “hatch” on the left of the dash; that’s a good place to put the Buddy. In my case I just stuck it next to the pedal so running power was easy.

Winter28.jpgWinter29.jpg

After you have opened up the IC, and you can access the Fakra cable on the back, you can connect your LAN Fakra-RJ45 cable directly on to the back of the IC. Then you can take the WAN Fakra-RJ45 cable and connect it to the cable that was previously connected to the IC.

Here is a diagram of the end result:

Rpanda.png

While the Dash is already open, this is a good time to run power for your Tinkla Buddy.

Power

Based on your Tesla Model and included packages, you'll want to follow the corresponding installation guide for Power. We'll need a 12v constant power supply. Places like the USB outlets or 12v accessory outlet is no good because those switch off when the car is "off". If you have an AP1 car or have completed the full AP1 retrofit and you aren't using it for OpenPilot power, you can just use the empty OBD port.

Tesla w/Cold Weather Package or Tesla Model X (Fuse Box in cabin)
----Step 1 - Remove Console trim and Footwell trim
----Step 2 - Remove the trim panel under the steering wheel
----Step 3 - Now it’s time to get power
Tesla S built 2016+ (Fuse Box in cabin)
Tesla w/o Fuse Box in Cabin

Tesla w/Cold Weather Package or Tesla Model X (Fuse Box in cabin)

If you have a Tesla with the Cold Weather package then there is a fuse box near the accelerator which makes this a 30 minute install. [1]

Model X You will need a new Fuse Holder and a ring terminal for Power.
Step 1 - Remove Console trim and Footwell trim

You need to remove two pieces of trim on the center console and footwell: the soft touch faux leather trim that runs along the side and beside the driver’s seat and the hard plastic that it overlaps slightly. Remove the soft faux leather one first. Start at the very end near the driver seat and pull it away from the center console (see right pic). It’s held on with pegs.


Winter1.jpgWinter2.jpg


Removing the plastic bit is a little more complicated. First, grip it from the exposed opening and pull it away from the center console and dash. It makes contact with the airbag and trim under the dash. You’ll need to angle it upwards and rotate it up while also pulling the bottom towards you. Push the accelerator pedal out of the way to pull the trim towards you. This will also be 100% easier if you set your footwell carpet aside. You’ll want to place the soft leather piece somewhere it won’t get scratched like the back seat.


Winter3.pngWinter4.jpg


Now that you have the side panels off, you can see the exposed fuse box near the accelerator (below).


Winter5.jpg


Step 2 - Remove the trim panel under the steering wheel.

You’ll want to remove this screw on the right, and a corresponding one on the left below the dash (red arrows).

Winter6.jpgWinter7.png

Winter8.png





Note the power adapter for the footwell light (black connector in right pic). You’ll use a flathead screwdriver to remove it. Afterwards your footwell looks like the right pic.






Winter9.jpg





On the left is a view of the accelerator pedal with the fuse box just to the right of it. Also shown at the top of the pedal is the connector where you plug your comma pedal in. If you haven’t done so yet, this is an opportune time to put the pedal in, too.





Winter10.jpg

Winter11.jpg


Step 3 - Now it’s time to get power

If your fuse adaptor has a butt connector, you’re half way there. First, cut and strip the end of the wire coming from your USB power supply (if not already stripped). Crimp it into the butt connector. Then, choose a suitable fuse in the fusebox. The 5A brown fuse on right should work. Put the 5A fuse in the free slot of your adaptor. Then, plug the adaptor in as shown (the fuses are pointing down). Finally, route the loop connector to the 10mm screw just below and to the right of the fuse box. Screw it in and you have ground.

Winter30.jpgWinter31.jpg


Winter32.jpg



Once you're done running power we can move on to connecting the Tinkla Buddy.

Tesla S built 2016+ (Fuse Box in cabin)

If you have a 2016 or later Tesla then there should be a fuse box behind the passenger kick panel and you'll need to re-crimp your 12v red wire which will make this about an hour install.


Once you're done running power we can move on to connecting the Tinkla Buddy.

Tesla w/o Fuse Box in Cabin

If you don't have a fuse box in the cabin then pull a wire through a gasket on the firewall behind the washer fluid reservoir in the Frunk. Depending on your method of poking a hole in the gasket and your method of pulling your 16-18 gauge wire through your hole, this can take between 1-2 hours if not longer.

Tools required:

  • 13mm socket (for the ground)
  • Plastic pry tool
  • Fishing tape (or metal hanger)
  • Sharp tool to poke a hole in a rubber gasket.
TB1.JPEG

Above you can see Fuse Box 2 in the Frunk. The red wire from TBuddy is tapped into an empty F36 fuse. (this car doesn't have Air Suspension.)

TB2.JPEG

Above is a zoomed out view of where the red wire runs to get to Fuse Box 2

TB3.JPEG

The picture above is looking behind the washer fluid reservoir, you can see a gasket that will give us access to the cabin.

TB4.JPEG

Above is a closer view of the gasket in the frunk that we can use to route cables into the cabin.

TB5.JPEG

Above is the cabin side of the gasket, hiding low and left when you take off the driver's side kneeboard.

TB6.JPEG

Above is a zoomed out view of the compartment behind the kneeboard. there is a plastic panel on the left which is easy to remove and has two 13mm bolts you can use for ground.

Once you're done running power we can move on to connecting the Tinkla Buddy.

Connecting the Tinkla Buddy

Before you're ready to power the Buddy:

  1. Make sure you have the RJ-45 barrel on the network cables,
  2. the IC and CID are online,
  3. and the Tesla is ON. (Press and hold the Brake until you hear/feel the car turn on.)

Then while the Buddy is unplugged from power, insert the RJ-45 cables into the correct jack on the Buddy.

  • The CID goes in the WAN port
  • The IC goes in the LAN port.
The SD card with the latest disk image should be inserted into the Tinkla Buddy BEFORE power is connected to the Buddy.

Now you can plug power into the Tinkla Buddy.

At this point the Buddy will reboot 3-4 times, and then attempt to receive the certs from the Tinkla Buddy server.  This takes about 4-5 minutes. Image inflation can take a good deal longer. Walk away from your car and give the Buddy about 20 minutes to finish initializing. When you return you should see two flashing green LEDs on the Tinkla Buddy and one red flashing LED.

Install Complete

To get IC AutoPilot integration view, update your OpenPilot Configuration File to look like: enable_das_emulation = True then when the car is "On" showing PRND, the IC will do a soft restart and change to the AutoPilot view.

To see if it is working you have two ways to activate the Tinkla Menu:

Menu.png
  1. Press steering wheel menu button 4 times, if this does not work, then go to step 2.
  2. Press park button 4 times fast.

Configuration / Setup

There are two ways to easily setup and configure your Tinkla Buddy after install.

  1. Using the Tinkla Menu
  2. Using the Tinkla Access Point webapp
  3. Using Tinkla Bastillion Server (Advanced)

Using the Tinkla Menu

The Tinkla Menu has various basic configuration settings you can activate. You can activate the menu with either four presses on the Wheel's Menu button or (if you're parked) four presses on the Parking Brake.

Menu.png
  1. Tinkla
    TMenu.png
    • Buddy
      TBuddy.png
      • Restart - Restarts Tinkla Buddy's processes.
      • Reboot - Reboots Tinkla Buddy, entirely. (Not recommend)
      • Update - Checks for a Tinkla Buddy update.
      • Quiet - Puts the device in a quiet mode for Service Center visits.
    • Wifi
      TWifi.png
      • Info - This shows the current Wireless Access Point name and password to join the network and use your car's 3g or LTE internet.
    • IC Int. - Here you can Turn Integration On or Off
      TIC.png
      • IC integration allows OpenPilot to appear on the Instrument Cluster similar to Tesla AutoPilot. It also shows data from your Baolong TPMS as if you have a Conti TPMS retrofit.
      • Please note: it can take up to a minute for your IC to restart the processes in integration mode and it will flicker twice during the process. The IC isn't rebooted, just restarting processes.
    • Tunnels - Here you can turn Tunnels On or Off
      TTunnel.png
      • Turning tunnels on allows you to use the Tinkla Bastillion server to SSH into your Tinkla Buddy and it enables the remote control app (in development)
  2. Tesla
    TTesla.png
    • Tokens - If you are a security researcher and have access to your car's systems, you'll be able to see it here.
    • Ludi
      TLudi.png
      • Temps - This option adds a temperature gauge to the bottom left third of the power graph when using IC Int.
      • On - This option adds the temperature gauge from above, shows a wireframe of your car exposing front and rear motors, and adds a power value and peak usage graph to the left side of your IC.
      • Off - Disables all of the Ludi additions.
    • Misc
      TMisc.png
      • VLow - Sets air suspension very low (your car must be parked to enable).
      • IC SS - <Known Bug> This will take a screenshot of your IC and email it to you. (You'll need to SSH into Tinkla Buddy to configure /home/pi/.tinkla/email_settings)
      • CID SS - <Known Bug> This will take a screenshot of your Central Infotainment Display [CID] and email it to you. (You'll need to SSH into Tinkla Buddy to configure /home/pi/.tinkla/email_settings)
    • Advanced
      TAdvanced.png
      • Dev - This will enable you to access Dev Mode.
      • Fact - This will enable you to enter Factory Mode.
      • Unlock -This will unlock the Diagnostic Port.
      • Kill - This will kill any staged software updates.
  3. Info
    • ...
  4. Custom
    TCustom.png
    • This set of menus are for your use to add/run your own menu scripts to run from the Tinkla Buddy and show the results on your CID. All additions and changes will need to be added to your Tinkla Buddy via SSH to /home/pi/.tinkla/your_commands.json
      TCustomMenu.png

Using the Tinkla Access Point webapp

Setup WiFi for access to Tinkla Buddy App.

First activate the TB on your CID using either the wheel menu button or (if parked) parking button four times. Select Tinkla.

Menu.png

Then select WiFi.

TMenu.png

Then select On, to turn on the WiFi SSID.

TWifi.png


On your Cell phone look for the SSID tinklaAP, the WiFi password is teslaFr33

TB-wifi(4).jpg

Select the SSID and it will assign an IP (it may tell you there is no internet). The next thing to do is go to your favorite browser on the phone, and enter the following URL http://10.5.5.1


You will be presented with the log in screen. The first time password is 1234

Then of course hit Login

TB-wifi(5).jpg

Now you can start exploring.

Using Tinkla Bastillion Server

This method is not recommended for initially setting up your Tinkla Buddy. This is a great way to tinker and customize some areas of your Tinkla Buddy and is only a Linux Command Line Interface [CLI].

https://tinkla.us:8443/

Contact BogGyver for account setup and Authenticator setup.

From the Bastillion server you can gain SSH access to your Tinkla Buddy from anywhere in the world. With SSH access you can perform more intimate setup of your Tinkla Buddy so screenshots can be emailed to you or create your own custom menu options in the Tinkla Menus.

Custom Tinkla Menu

In the /home/pi/.tinkla folder there is a file called your_commands.json Where the custom menu items should be added. There are already examples in the file you can follow.

For long command sequences it is best to create a script in /home/pi/.tinkla and just call the script with something like /bin/bash /home/pi/.tinkla/my_script.sh from the your_commands.json.

{"menu":[
{"id":1000,"text":"The file that generates this section is /home/pi/.tinkla/your_commands.json. The base menu for it has ID 1000 and we suggest to keep all the other submenus you might create with unique IDs above 1000. Look at the file for suggestions how to create custom commands. ","options":[
{"label":"Menu","type":"menu","value":"1001"}, #this will open the menu defined as id:1001
{"label":"Reboot TB","type":"shell","value":"reboot"}, #this sends "reboot" as a command. 
{"label":"Some Script","type":"shell","value":"/bin/bash /home/pi/.tinkla/my_script.sh"} #no comma after the last option.
]},
{"id":1001,"text":"This is just an example of a submenu. Here I just defined 1 button. The Back button is added automatically to any Menu.","options":[
{"label":"Main Menu","type":"menu","value":"1"}
]}                                                                                                              ]}

To run a script on the CID, and as long as you have persistence enabled, then you can include these commands inside my_script.sh to have some thing run on the CID:

scp CID_script.sh cid:/tmp/CID_script.sh
ssh cid bash /tmp/CID_script.sh
ssh cid rm /tmp/CID_script.sh
Cron Jobs

If you already have persistence setup, then you can have scripts set to run periodically based on where you place your script.sh. Based on the directory you use, you can have a script run afterReboot (MCU reboot, not Tinkla Buddy), every 1, 5, 15, or 60 minutes.

Scripts within these folders MUST have filenames ending in .sh.

/opt/tinkla/cron/afterReboot
/opt/tinkla/cron/everyOneMinute
/opt/tinkla/cron/everyFiveMinutes
/opt/tinkla/cron/everyFifteenminutes
/opt/tinkla/cron/everyHour

For those users that have root persistence, I recommend adding a clean_traces.sh file to the /opt/tinkla/cron/everyOneMinute folder containing the following code

sed -i '/192\.168\.90\.101/d' /var/log/sshd/current
sed -i '/key type ssh-dss not/d' /var/log/sshd/current
cat /dev/null > /var/log/auth.log
echo 'set +o history' > /root/.bashrc
cat /dev/null > /root/.bash_history
echo 'set +o history' > /home/tesla/.bashrc
cat /dev/null > /home/tesla/.bash_history





References