Giter Site home page Giter Site logo

Connection problem about elmduino HOT 14 CLOSED

powerbroker2 avatar powerbroker2 commented on July 22, 2024
Connection problem

from elmduino.

Comments (14)

tomek8308 avatar tomek8308 commented on July 22, 2024 1

OK. I will try to turn off bluetooth on all devices in the car tomorrow, maybe some are pairing and blocking the connection.

from elmduino.

tomek8308 avatar tomek8308 commented on July 22, 2024 1

Unfortunately, no device blocked the bluetooth connection.
However, I was able to solve the problem.
ESP32 worked properly for the first few days so I decided that ESP32 has a problem.

  1. I have cleaned the Flash memory
  2. I uploaded the bootloader again
  3. I have uploaded the ESP32 test
    Connection problem has resolved ESP connects correctly with ELM327 all data is transferred.
    Thank you for your help.

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on July 22, 2024

What sort of OBD scanner is it? Is it a classic bluetooth device or is it a BLE version?

When you try the ESP32_test.ino example, are you able to send AT commands?

from elmduino.

tomek8308 avatar tomek8308 commented on July 22, 2024

Yes, it's a classic ELM327. I have two different models on both there is the same effect. If I can connect, I can send AT commands and send PID and receive responses. Everything worked fine and I tested for several days. Suddenly he stopped connecting by accident, I noticed that the connection is only after sending the pairing pin 1234 on another device. I had a second ESP32 - started working but the situation repeated after a few days. I think the problem lies in pairing ELM237 with ESP32, but I don't know how to solve it because I'm not a programmer. I decided to take care of this project and I liked it, I managed to display DPF data and temperature. It would be great if it worked again.

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on July 22, 2024

From the video I can see it failed the second phase of connection. The ESP32 test sketch overrides this "second phase" and allows you to send queries and AT commands manually. In order to debug, I need to know if you can still get proper AT and query responses from the ELM327 using the ESP32 test sketch. That'll be a big help to determine what went wrong.

Also, when you say "I decided to take care of this project", does that mean you took it over from someone?

from elmduino.

tomek8308 avatar tomek8308 commented on July 22, 2024

Tomorrow I will check the possibility of sending AT commands in test mode. As for the project, I saw on YouTube a video of the engine parameters display in ESP32 + Oled and I decided to do something similar myself. After the first successes, there was a connection problem that I couldn't solve myself. So I came back to basics and I start again with ESP32_test.ino to get a stable connection with ELM327 but my knowledge is too small.

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on July 22, 2024

Interesting, could you post a link to the video?

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on July 22, 2024

I found a bug in the code and applied a fix in version 2.0.12. Update your library and try using the ESP32 test sketch and post what happens when you send the following ELM327 commands:

AT E0 //Echo off
AT S0 //Spaces off
AT SP0 //Mode --> Automatic
010C //Query RPM

from elmduino.

tomek8308 avatar tomek8308 commented on July 22, 2024

Ok. I updated the library and uploaded the ESP32 test. I connected for a moment but couldn't send AT commands. I will have more time later so I will check again.

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on July 22, 2024

Can you post a picture of the serial monitor after you input the commands (ensure the serial monitor is in newline and carriage return mode)?

from elmduino.

tomek8308 avatar tomek8308 commented on July 22, 2024

I connected ESP32 but does not accept AT commands and no response.
1
After entering pin 1234 on another device, I get the correct automatic response "rpm"
2
I also used to check the code:

#include "BluetoothSerial.h"


BluetoothSerial SerialBT;


#define DEBUG_PORT Serial
#define ELM_PORT   SerialBT


void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);

  DEBUG_PORT.begin(115200);
  ELM_PORT.begin("ESP32test", true);

  DEBUG_PORT.println("Attempting to connect to ELM327...");

  if (!ELM_PORT.connect("OBDII"))
  {
    DEBUG_PORT.println("Couldn't connect to OBD scanner");
    while(1);
  }

  DEBUG_PORT.println("Connected to ELM327");
  DEBUG_PORT.println("Ensure your serial monitor line ending is set to 'Carriage Return'");
  DEBUG_PORT.println("Type and send commands/queries to your ELM327 through the serial monitor");
  DEBUG_PORT.println();
}


void loop()
{
  if(DEBUG_PORT.available())
  {
    char c = DEBUG_PORT.read();

    DEBUG_PORT.write(c);
    ELM_PORT.write(c);
  }

  if(ELM_PORT.available())
  {
    char c = ELM_PORT.read();

    if(c == '>')
      DEBUG_PORT.println();

    DEBUG_PORT.write(c);
  }
} 

And no shoulder to answer AT commands
4

And after entering the pairing code "1234" on another device, the connection is stable and the correct responses to AT commands follow.
3
The connection is always stable but only until ESP32 is restarted. ELM327 will not reconnect if it is not paired with the "1234" code on the external device
It seems to me that the problem lies in the connection of ELM327 with ESP32. ELM327 necessarily wants to pair with the "1234" pin and does not receive a response from ESP32 - is it possible?

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on July 22, 2024

Ok, I think what's happening is that once the ESP32 restarts, one of your other devices (i.e. phone or laptop) automatically connects to the ELM327. Since the ELM327 can only be connected to one bluetooth device at a time, the ESP32 can't reconnect to it. Try turning off bluetooth and/or unpairing the ELM327 on all devices other than your ESP32. Once you do this, the ESP32 should be able to regain connection to the ELM327 after restarting.

Unfortunately, there is no way to send a security authentication pin via an ESP32's built-in bluetooth serial. (BLE is a different story, but we're not using BLE here)

from elmduino.

maksumon avatar maksumon commented on July 22, 2024

@tomek8308 Would you please let me know the steps and files needed to flash the memory and upload bootloader on ESP32?

from elmduino.

nomidaepapi avatar nomidaepapi commented on July 22, 2024

Unfortunately, no device blocked the bluetooth connection. However, I was able to solve the problem. ESP32 worked properly for the first few days so I decided that ESP32 has a problem.

  1. I have cleaned the Flash memory
  2. I uploaded the bootloader again
  3. I have uploaded the ESP32 test
    Connection problem has resolved ESP connects correctly with ELM327 all data is transferred.
    Thank you for your help.

Could you pleaase explain what you have done to get it working?

from elmduino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.