domnulvlad / KLineKWP1281Lib

Arduino / ESP / RPi Pico library integrating the proprietary VAG Key-Word 1281 protocol (KWP1281/KW1281)
https://domnulvlad.github.io/KLineKWP1281Lib/
GNU General Public License v3.0
40 stars 5 forks source link

Connection not possible on esp32 or esp8266? #7

Closed gamesmusic454 closed 1 month ago

gamesmusic454 commented 1 month ago

Hi, I tested the library with an Arduino mega 2560 using Serial1 (Tx in pin 18) ang everything is communicating. Then I have switched to an nodemcu with the esp8266 and nothing seems to work, I've played with different pins and tried to use AltSoftSerial but nothing, same result with esp32 (Wroom-esp32).

I want to know if there's some special procedure when it comes to esp's or if I'm doing something wrong with my setup.

I'm doing all of this on my golf mk4 from 1999 so it's not OBD.

I can provide photos or schematics to make things more clear. Thanks for the help.

domnulvlad commented 1 month ago

Hi.

If you just uncomment the proper configuration in configuration.h of every demo and use those pins, it should work directly without any modifications.

I believe your issue is that your transceivers don't work at 3.3V logic levels. The MEGA is 5V, while ESP32 and ESP8266 are both 3.3V.

You can use any LIN transceiver to do the job. I believe the MCP2003 should work very well. These should be the connections:

VSS - GND
VBB - 12V
LBUS - K-line
CS - 3.3V
TXD - TX
RXD - RX

Yes, the RX and TX should not be crossed. You also need a resistor, like 10k, between RXD and 3.3V. Also, there should be 500ohm-1k between K-line and 12V.

PrintService3D commented 1 month ago

Hi, I tested the library with an Arduino mega 2560 using Serial1 (Tx in pin 18) ang everything is communicating. Then I have switched to an nodemcu with the esp8266 and nothing seems to work, I've played with different pins and tried to use AltSoftSerial but nothing, same result with esp32 (Wroom-esp32).

I want to know if there's some special procedure when it comes to esp's or if I'm doing something wrong with my setup.

I'm doing all of this on my golf mk4 from 1999 so it's not OBD.

I can provide photos or schematics to make things more clear. Thanks for the help.

Hi, ich bin zwar ein recht neuer User. aber ich nutze selber einen ESP32, ESP32 SuperMini und einen D1Mini. alle funktionieren einwandfrei, mit der ESP ist es ein bisschen spielerei. ich selber nutze nebenbei noch das Nextion Display, ich nutze folgende ansprache:

include // Include SoftwareSerial library for ESP8266

include "EasyNextionLibrary.h"

include

define TX_pin 7

define RX_pin 6

SoftwareSerial K_line(RX_pin, TX_pin); // RX, TX for K-Line EasyNex myNex(Serial1); // Use hardware serial for Nextion wichtig ist auch die initialisierung. somit fange ich normal an mit Serial.begin gefolgt von Serial1.begin Dann diag.connect und dann Nextion.begin.

die richtige Pinwahl ist beim ESP32 wichtig. Ich hoffe ich konnte dir helfen

domnulvlad commented 1 month ago

I can guarantee the pins in configuration.h for every example work perfectly for any of those boards 😁

So that leaves only the possibility of a hardware problem, like a bad connection. But since they said it worked on Arduino, that probably means their transceiver doesn't work at 3.3V, that's why I suggested it. Now let's wait for their answer :)

PrintService3D commented 1 month ago

Aber da sie sagten, es funktionierte auf Arduino, bedeutet das wahrscheinlich, dass ihr Transceiver bei 3,3 V nicht funktioniert, deshalb habe ich es vorgeschlagen. Warten wir jetzt auf ihre Antwort :)

Here we already have the first problem, we don't know which chip he uses :D ESP32 and ESP8266 all support the 5V output voltage, of course you should stick to that :D

domnulvlad commented 1 month ago

No... There is no ESP32 or ESP8266 which supports 5V logic. If you put 5V on their pins, you may destroy them. And they can't output 5V, only 3.3V.

PrintService3D commented 1 month ago

No... There is no ESP32 or ESP8266 which supports 5V logic. If you put 5V on their pins, you may destroy them. And they can't output 5V, only 3.3V.

5V output voltage is no problem, the ESP32 has the 5V output voltage onboard. it just can't get 5V into the input :)

domnulvlad commented 1 month ago

If you have 5V on your ESP32 board, it's coming from USB. There is a regulator which converts it to 3.3V. The ESP32 module (the metal rectangle on the board) never gets 5V, so it can't output it.

gamesmusic454 commented 1 month ago

Hi, sorry for this much time without response, I've finally figure it out! It was that my adapter needs 5V supply from the Arduino as the board don't supply that rail in the USB 5V (Because the laptop would do that) so it was a matter of connecting that, I've been messing around like crazy analizing if TX and RX voltage leves were enought, it's been a crazy journey for a fault like this, sorry guys. Thanks for help

As a final thought I would want to know if I can contribute in any way to the development. Thanks.