themelisx / ESP32CarODB

Car OBD gauges Arduino TFT
GNU General Public License v3.0
10 stars 1 forks source link

Connecting display #6

Open pacraf opened 4 months ago

pacraf commented 4 months ago

at begin - thank you for great project.

Normally I use Arduino IDE, and here with platformio I can not find definintions of pin used to communicate with display... I searched code for all "MISO" words and found this part of code, that seems to do this, but in fact I don't know how to define specific pins.

` /! @brief Instantiate Adafruit GC9A01A driver with software SPI @param cs Chip select pin # @param dc Data/Command pin # @param mosi SPI MOSI pin # @param sclk SPI Clock pin # @param rst Reset pin # (optional, pass -1 if unused) @param miso SPI MISO pin # (optional, pass -1 if unused) / Adafruit_GC9A01A::Adafruit_GC9A01A(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk, int8_t rst, int8_t miso) : Adafruit_SPITFT(GC9A01A_TFTWIDTH, GC9A01A_TFTHEIGHT, cs, dc, mosi, sclk, rst, miso) {}

`

Could you please point out how to define example pins in project?

pacraf commented 4 months ago

the only definition I found are for CS , DC

define TFT1_CS 5

#define TFT1_DC 17

other are according to ESP hardware pinout, so: TFT SDA pin to ESP32 MOSI = 23 TFT SCL pin to ESP32 SCK = 18

TFT RST - reset not connected TFT BLK- backlight control not connected

If there is no bluetooth communication established (I see that in console there are messages about scanning, is there anything on screen displayed? I have no ODBII interface now, but screen is black. is this ok, or there should be anything on screen even without connection on bluetooth?

pacraf commented 4 months ago

So basically my mistake was to assume that reset is not connected. above connection is fine except that reset is connected to VCC

CS pin to ESP32 = 5 DC pin to ESP32 = 17 SDA pin to ESP32 MOSI = 23 SCL pin to ESP32 SCK = 18 RST - connected to display VCC TFT BLK- backlight control not connected

works ok.

benzhai731 commented 4 months ago

@pacraf does yours connect to your obd automatically? been trying it still say "no obd"

pacraf commented 4 months ago

Hi, Yes it connected automatically. In the car it works well, all parameters are displayed, But to prevent going to car and back to workbench, I took odbii adapter and connected it only to power supply, and it also works, I mean it connects and it shows voltage on display. Or can be helpful to test.

Now I try second display but no success. I mean with second lcd connected it refuses to connect to obdii. No idea why. But with one display it works great.

Hope I helped.

W dniu sob., 20.07.2024 o 18:48 benzhai731 @.***> napisał(a):

@pacraf https://github.com/pacraf does yours connect to your obd automatically? been trying it still say "no obd"

— Reply to this email directly, view it on GitHub https://github.com/themelisx/ESP32CarODB/issues/6#issuecomment-2241204320, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEI7ORWKVEOPQIKJRZJGPLZNKIFPAVCNFSM6AAAAABLCA6SM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGIYDIMZSGA . You are receiving this because you were mentioned.Message ID: @.***>

benzhai731 commented 4 months ago

@pacraf still have no success connecting on my obd, i even tried to put the obd mac add on the main.cpp still showing no obd thou, unless im doing it wrong. i downloaded the zip file esp32carobd-v.1.1.0 may i ask how u do it? did you put the mac or just download and upload on esp32?

benzhai731 commented 4 months ago

while checking some codes and remembered you tried for the second display saw on defines.h and it says #define MAX_DISPLAYS 1, so maybe you can change it in 2? for the second display? hehe

pacraf commented 4 months ago

@benzhai731 I don't know what is wrong in your setup. what says console log? in my "healthy" setup with one lcd it works and logs are like: Bluetooth initialized Bluetooth Slave device: OBDII Scanning for OBDII Adapter... Found device: Name: OBDII, Address: 00:1d:a5:68:98:8a, cod: 7936, rssi: -77 Scan completed Connecting to OBDII - 00:1d:a5:68:98:8a:00:00 (1)... Device connected succesfully! Connecting to OBD (1)... Connected to ELM327

and when in connects to ELM327 - on screen is shown displayed value. in my case now, only voltage, as I said - I have bluetooth odbII adapter on my bench now, not connected to car.

regarding your comment to second lcd, yes, this setting is changed I think correcltly, without changing second LCD is not initialized. to be more precise, for 2 lcd I change: in file configuration.h // Enable the 2nd TFT screen

define ENABLE_SECOND_DISPLAY

and in defines.h

define MAX_DISPLAYS 2

and logs says:

Bluetooth initialized Bluetooth Slave device: OBDII Scanning for OBDII Adapter... Found device: Name: OBDII, Address: 00:1d:a5:68:98:8a, cod: 7936, rssi: -76 Scan completed Connecting to OBDII - 00:1d:a5:68:98:8a:00:00 (1)... Connecting to OBDII - 00:1d:a5:68:98:8a:00:00 (2)... Connecting to OBDII - 00:1d:a5:68:98:8a:00:00 (3)... Cannot connect to Bluetooth device Bluetooth initialized

pacraf commented 4 months ago

@benzhai731 you also asked if I put MAC in code - no just upload, and it automatically discovered dongle.

pacraf commented 4 months ago

@themelisx Did you tried code with two LCD's ? could you suggest what can wrong with two lcd setup? both lcd works, but bluetooth is not pairing. error in console log is like :

Scanning for OBDII Adapter... Found device: Name: OBDII, Address: 00:1d:a5:68:98:8a, cod: 7936, rssi: -80 Scan completed Connecting to OBDII - 00:1d:a5:68:98:8a:00:00 (1)... [ 9514][E][BluetoothSerial.cpp:378] esp_spp_cb(): ESP_SPP_DISCOVERY_COMP_EVT failed!, status:1

when I searched for similar error, I found suggestions to downgrade esp32 platform. I tried many version back by changing in plantformio.ini platform = espressif32@X.X.X but not succeed, and I think that down from 5.x.x it refuses to compile.

I only change in code two lines (#define ENABLE_SECOND_DISPLA ; #define MAX_DISPLAYS 2) and basically second LCD works, but bluetooth shows this error (and obviously not work)

anyway - if you can't help - great project, I will use it with one lcd... THANK YOU.

benzhai731 commented 4 months ago

@pacraf i want to ask, when u said that you power on your obd to your workbench, is it the pin 16 positive and pin 4 negative, on 12volts? im using a elm327 mini obd2 by the way.

pacraf commented 4 months ago

@benzhai731 yes, but be carefull to look on proper view, I mean from adapter point of view, not to connect to mirrored side. here is picture that reflects properly, and i just connected 2 wires : +12 to 16, and GND to 4 or 5 (i thing both are connected together) this view is that like you jkust take adapter to hand and look on its pins. image my adapter looks like this one image but also this one works (my friend tested) image I mean it looks like the one on picture, but you never knows in fact what version etc...

benzhai731 commented 4 months ago

finally got it working! thanks man! your actually right i got the wrong pin 16! next im gonna figure out the second display

pacraf commented 4 months ago

good luck with that ;) i think there will be problem with version of libraries or esp framework. I wanted to try two display on esp8266 but from code now I think it is not possible. (it is not compiling, and definintions of additional keyboard is only for ESP32) - but I can be wrong. if you will crack this nut - let me know here !

benzhai731 commented 4 months ago

sure im using esp32 by the way, just ordered my second round display and other parts i needed,.. will let you know the soonest will let you know. thanks and to the author of this code!

pacraf commented 4 months ago

@benzhai731 I can be wrong , but I think that you can tr to work on double display even without second LCD. I think that LCD are only listening, not talking to ESP, so it will not know that there is no really second display connected. So you could try to compile for two displays and see if bluetooth is pairing. regarding esp8266 - I also use ESP32, but just wanted to try this one if double LCD works, and seems that this also is not good way to go...