1
\$\begingroup\$

Eventually, I want to tap into the K-line of my Kawasaki Ninja with an (ISO 9141) OBD reader, using an ESP32 WROVER and a L9637 single-wire transceiver. To get there, I'm at the stage of confirming my L9637 chip is wired properly to my ESP32.

Here's where I am:

HardwareSerial Sender(1);   //  Serial port1 is the 'Sender'

/*
 * LilyGo TTGO T7 v1.5 pins
 *               ___________
 *    GND  RST  |           |  TXD  GND
 *    N-C   VP  |   ESP32   |  RXD   27                  ____________
 *     VN   26  |  WROVER   |   22   25   22 <- RX   1  |   SENDER   |  8  LI
 *     35   18  |   TTGO    |   21   32         LO   2  |   L9637    |  7  Vs(12v)
 *     33   19  |    T7     |   27  TDI     (5v)Vcc  3  | transceiver|  6  K  ->-> 
 *     34   23  |   v1.5    |   25    4   25 -> TX   4  |_____#1_____|  5  Gnd 
 *    TMS    5  |           |  GND    0            510ohm between K and Vs
 *    N-C  3v3  | WiFi+BLE  |   5v    2             caps to Gnd on each V
 *    SD2  TCK  |           |  TDO  SD1
 *    CMD  SD3  |______usb__|  SD0  CLK
 *         (back) (+) (-) LiPo Batt Conn
 *
 *  Because the L9637 is puts out 5v, and the ESP need 3.3v,
 *  to the RX, I added a 47k to Gnd, and a 470k to the ESP32.
 *  It worked.                                     
*/
//  define Rx and TX on the L9637 chip, with K probed:
//  TX is Input for K as output. RX is Output for K as input.
#define Sender_Txd_pin   25    //  to Tx on Sender
#define Sender_Rxd_pin   22    //  from Rx on Sender L9637

void setup() {
  Serial.begin(115200);

  //  init L9637 RX with a short HIGH-LOW
  Serial.println( "init with Rx HIGH" );
  pinMode( Sender_Rxd_pin, OUTPUT );
  digitalWrite( Sender_Rxd_pin, HIGH );
  delay(300);
  Serial.println( "sending Rx LOW" );
  digitalWrite( Sender_Rxd_pin, LOW );
  delay(25);

  Sender.begin(10400, SERIAL_8N1, Sender_Txd_pin, Sender_Rxd_pin);  // iso9141 baud rate
}

void loop() {
  Sender.println( 3 );    //  just an integer
  delay(2000);
}

Note: I've tested the code and the ESP32 serial ports extensively. That works well. I've check the wiring on the L9637 chip, properly powered, 510 Ω resistors, proper capacitors, with their K-lines connected to each other. When I Digital.Write to the sender L9637 TX, should I be able to see the K respond? Sometimes it seems like it does, and sometimes it doesn't. How do I make this robust?

\$\endgroup\$
5
  • \$\begingroup\$ Hi Rick! Welcome here! This site is pretty strictly organized in a Question -> Answer way, so your question must really be a technical question (currently you're asking whether someone is familiar with something. Someone answering "yes" to that is not the answer you'd want, is it?). I think your title should be something like "Verifying L9637 single wire transceiver communication" or similar, and you should really ask the question you mean to ask: "why does my communication partner sometimes respond, sometimes not?" (is my guess what the question is). Great to have you here! \$\endgroup\$ Commented Mar 20, 2021 at 11:13
  • \$\begingroup\$ Thanks, Marcus. Good advice. I updated it. \$\endgroup\$ Commented Mar 20, 2021 at 13:59
  • \$\begingroup\$ No, thank you for asking such a well-researched/backed question! \$\endgroup\$ Commented Mar 20, 2021 at 14:22
  • \$\begingroup\$ How do you handle the level conversion to the esp32? The L9637 is a 5V part and the esp32 is 3v3 and not 5V tolerant. \$\endgroup\$
    – Kartman
    Commented Mar 21, 2021 at 3:43
  • \$\begingroup\$ @Kartman - that's a good point - which I had not taken into consideration. With the ESP32 on USB power, the 5V pin is used to power both the OLED and the L9637, and is about 4.4v. So, the TX to the L9637 is at 3.3v, but the RX back into the ESP32 is at 4.4v. That needs to be fixed. Voltage divider? \$\endgroup\$ Commented Mar 21, 2021 at 12:40

1 Answer 1

1
\$\begingroup\$

Thanks to Kartman, I added a voltage divider on the ESP32 input from the L9637. On the transceiver RX I added a 47 kΩ to GND and a 470 kΩ to the ESP32. Seems to work. Getting good response now. I've tested it several times, and it is responding appropriately now.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.