Tunerstudio SPI LCD Gauge on a Pi

Post Reply
OSprey42
contributor
contributor
Posts: 24
Joined: Thu Sep 16, 2021 8:18 am

Tunerstudio SPI LCD Gauge on a Pi

Post by OSprey42 »

I wanted a gauge on my car that had several parameters on it and interfaced directly to the ECU. The easiest way I thought to achieve this was to buy several SPI full colour LCD displays and connect them to a Pi and mirror the HDMI main display so that the tunerstudio dash in full screen mode fills up the gauge screen. This is definitely a very overkill way of making a gauge considering how powerful a Pi is but it works and now my gauge can play doom so it's really a win win.

I used both a 1.3" 240x240p round screen with a GC9A01 driver and a rectangle 1.77" display with the ST7735 driver. Both of these required different methods to work which I'll detail. The images of the final product are attached. For either to to work you'll need a Rasberry Pi (I used a 3b) and a full tunerstudio licence so you can do a custom dash layout. I'd highly reccomend when setting up the Pi to make sure the remote desktop and/or SSH works so you don't need to have it plugged into a normal HDMI display to set it up. I also tried this on the single core Pi W and it didn't work as it was not powerful enough to run Tunerstudio. The quad core Pi W 2 might work but at the time of writing good luck finding one of those.

Square/Rectangle LCD
For the square LCDs, go to this github page and scroll through the list of supported LCD drivers and Pi hats in the doccumentation. Next go and find an LCD that uses one of those drivers (or click the link in this post above). I chose the 1.77" LCD that uses the ST7735 driver (referred to as the ST7735R in that github page, R for rectangle not to be confused with the ST7735S for square).

To get it running on the Pi I followed this tutorial using the option with the fbcp-ili9341 library. He also details it a bit better in this article. The github page linked above also has some good doccumentation of how to set it up.

To wire it up I followed this guide. Note that the data control and reset pins can be wired to any GPIO, you just need to define what GPIO pins number (not pin number!!!) they are on the Pi when building the code.

Round 1.3" LCD
To get this working I followed this tutorial. This pretty much worked although refer to the below notes for some reccomendations.

Notes
For both LCDs, you can scale the resolution of the Pi and HDMI main display to better suit the LCD resolution. When you get to the step of adding the below commands into /boot/config.txt, the first two numbers after "hdmi_cvt=" are the screen resolution. If you find that the main HDMI display is black but the LCD works after setting this it might be because the Pi cannot run at a resolution that low. This was the case for the round display which the tutorial says to use the commands pasted below where it specifies a 300x300 display. For the round screen I found the below settings didn't work so I didn't paste any of them into the config.txt, only uncommented "dtparam=spi=on" which was a reccomendation in the comments of the instructables page. This meant that the round LCD was mirroring a 1080p 16:9 display (HDMI connected) so the picture was a bit skewed but it worked fine as you just stretch the gauges in TS until they fill the area. For the Rectangle LCD, I set the screen resulution to the same aspect ratio (4:3, 800x600) and that meant the LCD picture wasn't skewed.

hdmi_force_hotplug=1
hdmi_cvt=300 300 60 1 0 0 0
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
display_rotate = 1


Tunerstudio Auto Load
To get Tunerstudio to auto run I followed this tutorial. Note that one of the comments had some useful tips which helped me as the command he used in the video did not work on my Pi 3:
Autostart isn't located there anymore on Pi 4. I used: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart. Copy Path for TunerStudio.sh (Wherever you extracted it) and add @"copied path" at the top in the autostart file. Do not enter "copied path". Type @ then press Shift+Ctrl+V to paste the path that you copied. Ctrl+O to write the file. Ctrl+X to exit the file. Type Reboot and Pi will reboot and autostart TunerStudio. NOTE: ALL PATHS ARE CASE SENSITIVE SO IT'S BEST TO COPY AND PASTE!!!! I am running TS directly from the Downloads folder which is where Chromium puts it when you download it. I didn't use Terminal to extract it and I didn't download any programs to extract it. Just Right-Click and 'Extract here'.
Attachments
20220622_203510.jpg
20220622_203510.jpg (79.97 KiB) Viewed 385 times
20220621_170212.jpg
20220621_170212.jpg (55.37 KiB) Viewed 385 times
Post Reply