Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BT simple connection failed #258

Open
gonzob opened this issue Aug 4, 2024 · 3 comments
Open

BT simple connection failed #258

gonzob opened this issue Aug 4, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@gonzob
Copy link

gonzob commented Aug 4, 2024

I've had a ESP32 device monitoring my MG ZS EV for over six months. Here's what I built:

#202

Then yesterday it stopped working. I tested various aspects of the system trying to find the problem and I eventually discovered that the simple call to connect wasn't working anymore. It was this statement:

if (!ELM_PORT.connect(bt_name))

I tried connecting using this simple command but with the mac address instead of the device name, but that failed also.

I then checked with the Arduino BluetoothSerial examples and was able to get the board to connect using the DiscoverConnect program.
I then used the same method as that program used - it is a more complex connection command:

if (!ELM_PORT.connect(bt_mac, channel, sec_mask, role))

This worked. I'm thinking that for some reason the channel number changed in the bluetooth dongle???

The device is working now. Has anyone experienced this before?

Gonzo

@gonzob gonzob added the question Further information is requested label Aug 4, 2024
@wcjxixi
Copy link

wcjxixi commented Aug 9, 2024

You might try to remove paired devices using this sketch.

@gonzob
Copy link
Author

gonzob commented Aug 9, 2024

Tried that, and it had no effect.

@Turksat46
Copy link

There is more to that.
First of all, connecting with device name does take longer and does make more errors.
Try connecting to your device with the mac address like the following:
//save mac address as uint8_t uint8_t address[6] = {0xDC, 0x0D, 0x30, 0xC8, 0x4F, 0x0A}; //connect with mac address if (!ELM_PORT.connect(address)) { DEBUG_PORT.println("Couldn't connect to Bluetooth OBD scanner"); //while(1); }

Also, use an older version of the esp32 library, I use 2.0.14 in which the usePin() method still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants