Go Down

Topic: Bike interface OBD (Read 91324 times) previous topic - next topic

aster94

#165
Mar 29, 2019, 11:27 am Last Edit: Mar 29, 2019, 11:31 am by aster94
Hey Aster
I posted here about a year ago and finally got around to trying out something. I loaded your library up onto my arduino uno and tried the example sketch you have on github.

My bike is a honda CB500F (PC45) 2013 Model.
I tried to uncomment the honda but got this error message while compiling:
-------------------------------------------------------------------------------------------------------------------

Code: [Select]
C:\Arduino\libraries\KWP2000\src\KWP2000.cpp: In member function 'void KWP2000::requestSensorsData()':

C:\Arduino\libraries\KWP2000\src\KWP2000.cpp:505:19: error: 'request_sens' was not declared in this scope

     handleRequest(request_sens, LEN(request_sens));

                   ^

Using library KWP2000 at version 1.1.0 in folder: C:\Arduino\libraries\KWP2000

-------------------------------------------------------------------------------------------------------------------

I went to look into the code and saw your comment about the yamaha and honda being probably the same, so I tried uncommenting just the yamaha and was able to compile.

Next, I hooked up my setup to the bike and tried reading data. The output I got back is attatched. I'm not really sure that it's what I should be getting - as soon as the ECU turned on it would not stop sending out data...maybe you could advise me here?

I'd really like to get this working and help you to extend your library. If you could tell me where to start, that would be great!

Also, here some pictures of my setup. The mess of hotglue is the L9636 chip with dupont wires soldered to the appropriate pins. Crude, but it works. I didnt have any 510 Ohm resistors, so I took 2 1k in parallel - should be fine, right?
https://imgur.com/a/I1a5Yit



Hi! sure i would like to help!

so before starting do you have any possibility to get a board with two serial port? like an arduino mega or stm32f1?

the arduino UNO you are using is not well suited for this work because it has only one serial port and you are usint that serial to programming, serial monitor and comunication with the ECU, definitely too much.
You could use a software port, you should be able to get it working but a real serial would be almost error free

then we could figure out something to send only the 0x80 and 0x02 your bikes needs!

by the way that error is there because i never implemented the protocol for yamaha and honda, i will add a compile #error to prevent people to run it!

CapFirepants

#166
Apr 03, 2019, 12:39 pm Last Edit: Apr 03, 2019, 08:59 pm by CapFirepants
Hi! sure i would like to help!
Hey aster - I got the board today, what's the next step?
Edit: Does this mean TX from the L9637 should go to the arduino pin 13?
https://imgur.com/q51aoG9 ?
Serial2 on the mega is on pins 18 and 19 though, if I'm correct?
http://https://www.theengineeringprojects.com/wp-content/uploads/2018/06/introduction-to-arduino-mega-5-768x413.png

aster94

that means that you said to the library that your TX is on pin 13, you should set it to the TX pin of the serial you are using with the motorbike, i "wrote" a documentation, you can see it if you have any doubt: https://github.com/aster94/Keyword-Protocol-2000/blob/master/documentation.md#public--kwp2000hardwareserial--kline_serialconst-uint8_t-k_out_pinconst-uint32_t-kline_baudrate

https://github.com/aster94/Keyword-Protocol-2000/blob/5f818a8ca7fbd0a6a7108e619a21f0b65f3fc844/examples/basic_working/basic_working.ino#L11

have you found any resources about the protocol used by the CB500F?

CapFirepants

that means that you said to the library that your TX is on pin 13, you should set it to the TX pin of the serial you are using with the motorbike, i "wrote" a documentation, you can see it if you have any doubt: https://github.com/aster94/Keyword-Protocol-2000/blob/master/documentation.md#public--kwp2000hardwareserial--kline_serialconst-uint8_t-k_out_pinconst-uint32_t-kline_baudrate

https://github.com/aster94/Keyword-Protocol-2000/blob/5f818a8ca7fbd0a6a7108e619a21f0b65f3fc844/examples/basic_working/basic_working.ino#L11

have you found any resources about the protocol used by the CB500F?
I see, thanks! It's clear now.

Yes, a few resources are here:
A quite similar project (I think) using a raspberry pi with python
Project source
Data table for the protocol
ECU hacking thread with a bit of info

I havn't really found anything on the CB500F in perticular but id think the protocol is the same?

aster94

#169
Apr 07, 2019, 11:39 am Last Edit: Apr 07, 2019, 11:41 am by aster94
A quite similar project (I think) using a raspberry pi with python

This is a good resource, it think it is better to start with a simple sketch using this:

put K-line low for 70msec
put K-line high for 120msec
Send: FE 04 FF FF
No response is expected
Wait 200msec
Send : 72 05 00 F0 99
respond: 02 04 00 FA

Could you write a sketch with this sequence? I will check it and make all the necessary changes :)

if the ECU responds probably it is using the same procotol, do you have a digital analyzer? It would be very useful and them are very cheap (https://it.aliexpress.com/item/Pi-nuovo-USB-ANALIZZATORE-LOGICO-SALEAE-24-M-8CH-logic-Analyzer-24-M-8-Canali-Buffer/32986676965.html?isdl=y&albslr=206232166&src=google&aff_platform=true&albcp=1750018938&aff_short_key=irey5Th&gclid=CjwKCAjwv6blBRBzEiwAihbM-VTTvRXzfnRVt_BS5_fRDdWlBpSbP9xkQbzu9-WIiN_vFAXT6pfXSxoCTcUQAvD_BwE&albad=340648237322&albag=76953555268&albch=apprmkt&albagn=1500039111)


CapFirepants

#170
Apr 08, 2019, 07:26 am Last Edit: Apr 08, 2019, 07:27 am by CapFirepants
This is a good resource, it think it is better to start with a simple sketch using this
.......
I tried writing such a sketch as follows:
Code: [Select]

Serial serial;
Serial2 bike;

// put K-line low for 70msec
digitalWrite(18, LOW); // Im not sure I can do it like this. Maybe I need to have another pin which is conneted to the kline directly, passing the L9637?
delay(70);
// put K-line high for 120msec
digitalWrite(18, LOW); // again, not sure if this would work
delay(120);
// Send: FE 04 FF FF
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
Serial2.write(message0, sizeof(message0));
// No response is expected
// Wait 200msec
delay(200);
// Send : 72 05 00 F0 99
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};
Serial2.write(message1, sizeof(message1));
// respond: 02 04 00 FA
for (int i = 0; i < 4; i++)
{
  while (!Serial2.available())
    ; // wait for a character
  int incomingByte = Serial2.read();
  Serial.print(incomingByte, HEX);
  Serial.print(' ');
}
Serial.println();

Im not sure I can really just write the tx pin on the L9637 low, I assume it would not work and I would need to have another digital pin that I can pull to ground with a beefy resistor to avoid frying my board?

I dont have a logic analyser sadly. Ordered one just now :)


TriB

Im not sure I can really just write the tx pin on the L9637 low
Yes, that should be fine!

Looks like that in my code:
Code: [Select]
//Honda ISO-9141-2
void fastInit9141() {
  Serial.end();
  setKline(LOW);
  delay(70);
  setKline(HIGH);
  delay(120);  
  Serial.start(10400);
}


And then I "stole" a code, which I havenĀ“t tested yet:
Code: [Select]
bool startCommHonda() {
  //http://projects.gonzos.net/ctx-obd/
  //  Send "Wakeup" message: FE 04 FF FF. No response is expected
  //  Wait 200msec
  //  Send "Initialise" message: 72 05 00 F0 99
  //  The ECU should respond with: 02 04 00 FA

  //72 07 72 11 00 14 F0 (RPM)
  //02 1A 72 11 00 00 00 18 00 62 57 EF 10 91 63 FF FF 77 00 00 00 80 63 1A 51 DA (ECU response)
  //1A = 26 = overall length
  //72 07 72 D1 00 06 3E (Speed)
  //02 0C 72 D1 00 03 00 00 00 00 00 AC (ECU response)


  /*
    This protocol is very similar to Honda PGMFI (car ECU)

    request : 72 07 72 11 00 14 F0
    72 : Cmd
    07 : frame length
    72 : Sender ID 1 (?)
    11 : Sender ID 2 (?)
    00 : start number of data to be read in RAM
    14 : end number of data to be read
    F0 : CheckSum

    reply : 02 1A 72 11 00 00 00 18 00 62 57 EF 10 91 63 FF FF 77 00 00 00 80 63 1A 51 DA
    02 : Cmd & 0F
    1A : frame length
    72 : duplicate Cmd ????
    11 : Receiver ID 1 (?)
    00 : Receiver ID 2 (?)
    00 00 18 00 62 57 EF 10 91 63 FF FF 77 00 00 00 80 63 1A 51 : 14 data
    DA CheckSum
  */

  /*
    72 05 00 F0 99 (Gear indicator request for Init comunication)
    02 04 00 FA (ECU response)

    72 07 72 11 00 14 F0 (Gear indicator request for RPM)
    02 1A 72 11 00 00 00 18 00 62 57 EF 10 91 63 FF FF 77 00 00 00 80 63 1A 51 DA (ECU response)

    72 07 72 D1 00 06 3E (Gear indicator request for Speed)
    02 0C 72 D1 00 03 00 00 00 00 00 AC (ECU response)
  */


  //Slow Init or:
  //k-line low for 70msg. and high for 130msg.

  //ECU Adress/Format ?
  //Overall lenght !
  //SID, ECU Adress ?
  uint8_t reqLen;
  uint8_t req[6];
  uint8_t respLen;

  // Start Communication Wakeup-Message
  req[0] = 0xFE;
  req[1] = 0x04;
  req[2] = 0xFF;
  req[3] = 0xFF;
  reqLen = 4;

  //Send Wakeup-Message without header or something:
  sendRequest(req, reqLen);

  delay(200);
  //No request to excpect

  req[0] = 0x72;
  req[1] = 0x05;
  req[2] = 0x00;
  req[3] = 0xF0;
  req[4] = 0x99;
  reqLen = 5;

  //Send "Initialise" message
  sendRequest(req, reqLen);

  respLen = receiveResponse();
  // Response should be 02 04 00 FA
  if ((ecuBufferIn[0] == 0x02) && (ecuBufferIn[1] == 0x04) && (ecuBufferIn[2] == 0x00)) {
    ECUconnected = true;
    return true;
  }
  // Otherwise, we failed to init.
  //Reset ECUConnected & LED + delay 5 Seconds
  ErrorAppeard(ERROR_StartCom);
  return false;
}

Off course the "sendRequest" & "receiveResponse" functions are just from my current solution. But it should be enough to understand how it should work.

aster94

#172
Apr 10, 2019, 11:31 pm Last Edit: Apr 11, 2019, 04:18 pm by aster94
Hi CapFirepants

This would be a good starting point:
to start the connection you should send a 'S' in the serial monitor (opened at 115200) and then you should read "Starting sequence" then hopefully you will see an answer from the ECU!

Code: [Select]

#define debug Serial
#define bike Serial2
#define TX_PIN 17
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};

void setup()
{
    debug.begin(115200);
}

void loop()
{
    char incomingCommand = 0;
    while (debug.available() > 0)
    {
        incomingCommand = debug.read();
        debug.println("Command: ");
        debug.println(incomingCommand);
    }

    if (incomingCommand == 'S')
    {
        initHonda();
    }

    while (bike.available() > 0)
    {
        char incomingByte = bike.read();    // i am not sure if char is correct, maybe byte is better
        debug.print(incomingByte, HEX);
        debug.print(' ');
    }
}

void initHonda()
{
    debug.println("Starting sequence");
    bike.end();
    pinMode(TX_PIN, OUTPUT);
    delay(10);

    // put K-line low for 70msec
    digitalWrite(TX_PIN, LOW);
    delay(70);

    // put K-line high for 120msec
    digitalWrite(TX_PIN, HIGH);
    delay(120);

    bike.begin(10400);

    // maybe a little delay the serial could be not ready

    bike.write(message0, sizeof(message0)); // the kwp2000 needs 10ms between two bytes, here we are sending them all together
    // No response is expected

    // Wait 200msec
    delay(200);

    bike.write(message1, sizeof(message1)); // same here
    // respond: 02 04 00 FA
    debug.println("Waiting response");
}


note that i changed the tx pin since the serial2 uses the number 17: https://www.arduino.cc/reference/en/language/functions/communication/serial/

as trib already said you the L9637 is completely able to manage 5V! (https://www.st.com/resource/en/datasheet/l9637.pdf)

i made a few comments in the sketch about things i am not sure if they would work

please paste here the output you get!

can't wait for your news :)

edit: i corrected little errors in the sketch

CapFirepants

please paste here the output you get!

can't wait for your news :)

Yes, that should be fine!

Looks like that in my code:
Code: [Select]
//Honda ISO-9141-2
void fastInit9141() {
  Serial.end();
  setKline(LOW);
  delay(70);
  setKline(HIGH);
  delay(120); 
  Serial.start(10400);
}


Hey guys! I was finally able to try out the communication with the ECU just now after having a pretty busy week.
I used aster94's code with some slight modifications - I used serial 1 to communicate and changed the TX pin back to 18. I also used Bytes when recieving the response from the bike. However, I didn't get the expected 02 04 00 FA back, insted see the following output:

Motor on and in neutral
Code: [Select]

16:24:48.473 -> Command: S
16:24:48.473 -> Starting sequence
16:24:48.888 -> Waiting response
16:24:48.888 -> FC 0 FF 0 0


Motor off
Code: [Select]
16:25:05.469 -> Command: S
16:25:05.469 -> Starting sequence
16:25:05.847 -> Waiting response
16:25:05.847 -> F8 0 FF 0 0


The output confuses me a bit. Is the bike using a different protocoll?

aster94

#174
Apr 13, 2019, 07:39 pm Last Edit: Apr 13, 2019, 07:41 pm by aster94
I checked the source code of gonzo, and the initialize sequence is not as he described it, it is excatly the opposite!  :smiley-confuse:

see the file ctxobd.py, this is an extrac from there: he put the k line high for 70ms then low for 200ms then send the request
Code: [Select]

TIMEKLOW = 0.070 # Kline is pulled low for this time
TIMEKHIGH = 0.20 # quiet time after low pulse before wakeup
...
pfio.digital_write(KLINEOUT,1)
time.sleep(TIMEKLOW)
pfio.digital_write(KLINEOUT,0)
time.sleep(TIMEKHIGH)


so i rewrote the sketch using these values:

Code: [Select]

#define debug Serial
#define bike Serial1
#define TX_PIN 18
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};

void setup()
{
  debug.begin(115200);
}

void loop()
{
  char incomingCommand = 0;
  while (debug.available() > 0)
  {
    incomingCommand = debug.read();
    debug.print("\nCommand: ");
    debug.println(incomingCommand);
  }

  if (incomingCommand == 'S')
  {
    initHonda();
  }
  checkResponse();
}

void checkResponse()
{
  while (bike.available() > 0)
  {
    byte incomingByte = bike.read();
    debug.print(incomingByte, HEX);
    debug.print(' ');
  }
}

void initHonda()
{
  debug.println("Starting sequence");
  bike.end();
  digitalWrite(TX_PIN, HIGH); // this is not an error, it has to came before the pinMode
  pinMode(TX_PIN, OUTPUT);
  delay(70);

  digitalWrite(TX_PIN, LOW);
  delay(200);

  bike.begin(10400);

  // maybe a little delay the serial could be not ready, edit: no it is ready

  bike.write(message0, sizeof(message0)); // the kwp2000 needs 10ms between two bytes, here we are sending them all together
  bike.flush(); // wait to send all
  // No response is expected

  // wait 200ms and avoid echo
  debug.print("Echo: ");
  uint32_t start_time = millis();
  while (start_time + 200 > millis())
  {
    checkResponse();
  }

  bike.write(message1, sizeof(message1)); // same here
  // respond: 02 04 00 FA
  debug.println("\nWaiting response");
}


and I checked it with the logic analyzer, it is exactly as expected, see the attachments

anyway if you found more resources on the honda protocol send them because the gonzo website doesn't look very reliable anymore

CapFirepants

#175
Apr 13, 2019, 08:57 pm Last Edit: Apr 13, 2019, 09:38 pm by CapFirepants
Hey, thanks for the info regarding the pull up / down times.
I tried the new version of the sketch and got these outputs:

With motor on
Code: [Select]
20:50:06.546 -> Command: S
20:50:06.546 ->
20:50:06.546 -> Starting sequence
20:50:06.819 -> Echo: F0 0 FF
20:50:07.026 -> Waiting response
20:50:07.026 -> 0 0  


With motor off
Code: [Select]
20:50:21.833 -> Command:
20:50:21.833 ->
20:50:21.833 -> Starting sequence
20:50:22.108 -> Echo: F0 0 E1
20:50:22.315 -> Waiting response
20:50:22.315 -> 0 0


Similar to before, it seems to me.

I did find this pgmfi thread which has a bit of the info about the protocol. They have a different message to init the communication, the 02 04 00 FA pops up here as a response as well though: http://forum.pgmfi.org/viewtopic.php?f=57&t=22199&sid=73f41ea0c92683bdda995453fc7f0de2
In this post someone mentions he uses a 2016 CB500X abs, which is nearly the same as mine (The CB500F/X/R all have the same engine but a different body. F is a naked bike, X is a crossover and R a "sports" style bike. Im pretty positive the ECU is also the same.)

aster94

#176
Apr 13, 2019, 09:46 pm Last Edit: Apr 13, 2019, 09:47 pm by aster94
i registered and saw the first page where they say that the init sequence is:
Quote
k-line low for 70msg. and high for 130msg.
so similar to the values in gonzo description have you saw the other pages and could you confirm these?

I wrote a new version which waits 10ms between two bytes.
please test this:

Code: [Select]

#define debug Serial
#define bike Serial1
#define TX_PIN 18
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};

void setup()
{
  debug.begin(115200);
}

void loop()
{
  char incomingCommand = 0;
  while (debug.available() > 0)
  {
    incomingCommand = debug.read();
    debug.print("\nCommand: ");
    debug.println(incomingCommand);
  }

  if (incomingCommand == 'S')
  {
    initHonda();
  }
  checkResponse();
}

void checkResponse()
{
  while (bike.available() > 0)
  {
    byte incomingByte = bike.read();
    debug.print(incomingByte, HEX);
    debug.print(' ');
  }
}

void initHonda()
{
  debug.println("Starting sequence");
  bike.end();
  digitalWrite(TX_PIN, HIGH); // this is not an error, it has to came before the pinMode
  pinMode(TX_PIN, OUTPUT);
  delay(70);

  digitalWrite(TX_PIN, LOW);
  delay(200);

  bike.begin(10400);

  sendRequest(message0, sizeof(message0));
  // No response is expected

  // wait 200ms and avoid echo
  debug.print("Echo: ");
  uint32_t start_time = millis();
  while (start_time + 200 > millis())
  {
    checkResponse();
  }

  sendRequest(message1, sizeof(message1));
  // respond: 02 04 00 FA
  debug.println("\nWaiting response");
}

void sendRequest(uint8_t request[], uint8_t len)
{
  for (uint8_t i = 0; i < len; i++)
  {
    bike.write(request[i]);
    
    bike.flush(); // wait to send all
    if (i < len - 1)
    {
      delay(10);
    }
  }
}


if this doesn't work:

Code: [Select]

#define debug Serial
#define bike Serial1
#define TX_PIN 18
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};

void setup()
{
  debug.begin(115200);
}

void loop()
{
  char incomingCommand = 0;
  while (debug.available() > 0)
  {
    incomingCommand = debug.read();
    debug.print("\nCommand: ");
    debug.println(incomingCommand);
  }

  if (incomingCommand == 'S')
  {
    initHonda();
  }
  checkResponse();
}

void checkResponse()
{
  while (bike.available() > 0)
  {
    byte incomingByte = bike.read();
    debug.print(incomingByte, HEX);
    debug.print(' ');
  }
}

void initHonda()
{
  debug.println("Starting sequence");
  bike.end();
  pinMode(TX_PIN, OUTPUT);

  digitalWrite(TX_PIN, LOW);
  delay(70);

  digitalWrite(TX_PIN, HIGH);
  delay(130);

  bike.begin(10400);

  sendRequest(message0, sizeof(message0));
  // No response is expected

  // wait 200ms and avoid echo
  debug.print("Echo: ");
  uint32_t start_time = millis();
  while (start_time + 200 > millis())
  {
    checkResponse();
  }

  sendRequest(message1, sizeof(message1));
  // respond: 02 04 00 FA
  debug.println("\nWaiting response");
}

void sendRequest(uint8_t request[], uint8_t len)
{
  for (uint8_t i = 0; i < len; i++)
  {
    bike.write(request[i]);
    
    bike.flush(); // wait to send all
    if (i < len - 1)
    {
      delay(10);
    }
  }
}


You can check the logic analizer output with this program https://www.saleae.com/downloads/

CapFirepants

I ran both sketches and always got this response:
Code: [Select]
21:58:53.815 -> Command: S
21:58:53.815 ->
21:58:53.815 -> Starting sequence
21:58:54.125 -> Echo: F0 0
21:58:54.367 -> Waiting response
21:58:54.367 -> 0 0 0 C0 0


Sadly my logic analyzer hasn't arrived yet.

I've also found this:
https://github.com/MCU-Innovations/HondaECU
It has the CB500R listed in the table which is 90% the same bike.
Also https://bitbucket.org/enly1/hondagearindicator/overview which is for a 1000RR and also uses the same init as gonzo.
Thoughts?

aster94

#178
Apr 13, 2019, 10:33 pm Last Edit: Apr 13, 2019, 11:27 pm by aster94
seems that the delay of 10ms between two bytes is not needed

Code: [Select]
#define debug Serial
#define bike Serial1
#define TX_PIN 18
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};

void setup()
{
  debug.begin(115200);
}

void loop()
{
  char incomingCommand = 0;
  while (debug.available() > 0)
  {
    incomingCommand = debug.read();
    debug.print("\nCommand: ");
    debug.println(incomingCommand);
  }

  if (incomingCommand == 'S')
  {
    initHonda();
  }
  checkResponse();
}

void checkResponse()
{
  while (bike.available() > 0)
  {
    byte incomingByte = bike.read();
    debug.print(incomingByte, HEX);
    debug.print(' ');
  }
}

void initHonda()
{
  debug.println("Starting sequence");
  bike.end();
  pinMode(TX_PIN, OUTPUT);

  digitalWrite(TX_PIN, LOW);
  delay(70);

  digitalWrite(TX_PIN, HIGH);
  delay(120);

  bike.begin(10400);

  sendRequest(message0, sizeof(message0));
  // No response is expected

  // wait 25ms and avoid echo
  debug.print("Echo: ");
  uint32_t start_time = millis();
  while (start_time + 25 > millis())
  {
    checkResponse();
  }

  sendRequest(message1, sizeof(message1));
  // respond: 02 04 00 FA
  debug.println("\nWaiting response");
}

void sendRequest(uint8_t request[], uint8_t len)
{
  for (uint8_t i = 0; i < len; i++)
  {
    bike.write(request[i]);
  }
  bike.flush(); // wait to send all
}


if this doesn't work the problem is in the wiring, please could you post some pictures and a schematics?

CapFirepants

seems that the delay of 10ms between two bytes is not needed

Code: [Select]
#define debug Serial
#define bike Serial1
#define TX_PIN 18
byte message0[] = {0xFE, 0x04, 0xFF, 0xFF};
byte message1[] = {0x72, 0x05, 0x00, 0xF0, 0x99};

void setup()
{
  debug.begin(115200);
}

void loop()
{
  char incomingCommand = 0;
  while (debug.available() > 0)
  {
    incomingCommand = debug.read();
    debug.print("\nCommand: ");
    debug.println(incomingCommand);
  }

  if (incomingCommand == 'S')
  {
    initHonda();
  }
  checkResponse();
}

void checkResponse()
{
  while (bike.available() > 0)
  {
    byte incomingByte = bike.read();
    debug.print(incomingByte, HEX);
    debug.print(' ');
  }
}

void initHonda()
{
  debug.println("Starting sequence");
  bike.end();
  pinMode(TX_PIN, OUTPUT);

  digitalWrite(TX_PIN, LOW);
  delay(70);

  digitalWrite(TX_PIN, HIGH);
  delay(120);

  bike.begin(10400);

  sendRequest(message0, sizeof(message0));
  // No response is expected

  // wait 25ms and avoid echo
  debug.print("Echo: ");
  uint32_t start_time = millis();
  while (start_time + 25 > millis())
  {
    checkResponse();
  }

  sendRequest(message1, sizeof(message1));
  // respond: 02 04 00 FA
  debug.println("\nWaiting response");
}

void sendRequest(uint8_t request[], uint8_t len)
{
  for (uint8_t i = 0; i < len; i++)
  {
    bike.write(request[i]);
  }
  bike.flush(); // wait to send all
}


if this doesn't work the problem is in the wiring, please could you post some pictures and a schematics?
No Luck. I got the same response as before:
Code: [Select]
09:11:34.417 -> Command: S
09:11:34.417 ->
09:11:34.417 -> Starting sequence
09:11:34.619 -> Echo: F8 0 FF
09:11:34.653 -> Waiting response
09:11:34.653 -> 0 0


Here's an album with pictures:
https://imgur.com/a/sWckoxa
Let me know if I can clarify anything with more pics.

Go Up