This project will show various different pages that will display a number of different OBD sensors. Using a momentary push button, you can page through different UI layouts on the LCD screen, displaying multiple different sensors and data.
| Overview |
|---|
| β¨ Features |
| βΎοΈ Unlimited Data Displayed – Create page after page of different sensors to display. |
| π Full Color LCD Display |
| π¨ Dynamic Alerts for critical sensors – Temp |
| π Smoothed Display for fast changing values – Speed |
| π Page Switching with momentary push button |
| π§© Parts List |
| ESP32 |
| ST7735S 1.8inch RGB LCD Screen |
| TJA1050 CAN Transceiver Module |
| Momentary Push Button |
| π 12v to 5v Regulator |
Installation
Download and Install Arduino IDE. Once installed, extract the archive and open the lvgl-obd2-v2.0.3.ino. Set your working directory in Arduino IDE to
File >> Preferences >> Sketchbook Location
C:\Users\youruser\Downloads\lvgl-obd2-released-v2\lvgl-obd2-released-v2\lvgl-obd2-v2.0.3
The folder selected should have the folder libraries and lvgl-obd2-v2.0.3 in it. Next, go to
Tools >> Boards >> Boards Manager
Install esp32 version 2.0.7
When all is setup correctly, the code should now compile without any errors. If yea get errors relating to missing dependencies such as lvgl.h, ensure your working directory is set correctly in Arduino IDE and inside the selected directory you have the “libraries” folder.
Now, select the board partition scheme.
Tools >> Partition Scheme
Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
You can now go ahead and attempt to compile the sketch.
Sketch >> Verify/Compile
If compiling is successful, plug in the CYD. Select your COMM port and upload the sketch.
Tools >> Port
Select your CYD COMM port.
The current PIN definitions are set in the #define section. Here we are using GPIO22 and GPIO35 for CAN communication to the ESP32.
#define TWAI_TX_PIN GPIO_NUM_22
#define TWAI_RX_PIN GPIO_NUM_35
Below we can define the values at which switch the theme and brightness based on the LDR. Also, included in the sketch is a serial monitor outputs that will display the RAW LDR value, just open the Serial Output window in Arduino IDE. Usually, the higher the value, the darker it is, the lower the value, the lighter is it.
#define LDR_NIGHT_RAW 600 // BELOW this = night β DARK theme
#define LDR_DAY_RAW 2 // ABOVE this = day β LIGHT theme
