Tunerstudio SPI LCD Gauge on a Pi

Post Reply
OSprey42
contributor
contributor
Posts: 26
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 9091 times
20220621_170212.jpg
20220621_170212.jpg (55.37 KiB) Viewed 9091 times
Luker
Posts: 2
Joined: Sun Feb 19, 2023 2:29 pm

Re: Tunerstudio SPI LCD Gauge on a Pi

Post by Luker »

2 round 3 or 4' displays retrofiting in bike, coould look nice.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Tunerstudio SPI LCD Gauge on a Pi

Post by AndreyB »

What is start-up time of this solution?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
md_sanci
Posts: 69
Joined: Thu May 30, 2019 6:13 am
Location: Romania
Github Username: shadowm60
Slack: Alex M
Contact:

Re: Tunerstudio SPI LCD Gauge on a Pi

Post by md_sanci »

I was thinking using this approach, so right now what i did is used this:
https://www.waveshare.com/product/raspberry-pi/displays/lcd-oled/7inch-dsi-lcd-b.htm

So on the back of this lcd fitted a 5v regulator and an mcp can interface, so now the rpi has an obd2 connector that i can connect to the car, i can read the can messages from the car and i could collect sensor data.

Problem is bootup time, maybe use kl30 and somehow boot up device when i unlock the car but too much work, so i kind of abandoned for now, it can still be used to get traces, or spy on diag tools.

A new attempt was using bluepill, this is stm32f103 so it needs just a can tranceiver and chibios running fin on it. Display can be a small SPI one, but what is still holding me back is how to pack it in a small box so i can actually use it on my car.

When i will have a first working prototype i will also share git project with all the files to get it working.
Post Reply