uhi22 / wifican

Bridge between Wifi and CAN. Minimal variant of the ESP32RET. Using ESP32s3
17 stars 5 forks source link

Bluetooth for phone apps in future? #2

Open clowrey opened 3 months ago

clowrey commented 3 months ago

Loving the idea of this! I will try to install shortly.

Was wondering if its possible eventually to emulate one of the elm327 or some other bluetooth OBD dongle in the future to read car CAN data streams? Or am I missing some critical part of the picture here?

Thanks for the work here I love the simplicity!

uhi22 commented 3 months ago

The elm327 emulation was (or is) supported by the original project (https://github.com/collin80/ESP32RET) which uses the ESP32 (not the ESP32S3). This problem with the ESP32S3 controller is, that it does not support classical bluetooth, but only bluetooth low energy (BLE). This is discussed here: https://github.com/espressif/arduino-esp32/issues/8023

I see two ways which could be investigated:

clowrey commented 3 months ago

Thanks! I just tried your code with these parts:

docs: https://docs.m5stack.com/en/atom/atom_can docs" https://docs.m5stack.com/en/core/AtomS3%20Lite purchase(also on Mouser and Digikey): https://shop.m5stack.com/products/atomic-canbus-base-ca-is3050g purchase(also on Mouser and Digikey): https://shop.m5stack.com/products/atoms3-lite-esp32s3-dev-kit

Together they make a really compact package for ~$20 and no soldering - I know you can do it much cheaper by soldering modules and I personally don't mind soldering at all but the ease of use and having case already etc. is worth the price to me.

I use the built in button to control mode, it can be pushed during bootup to change the Wi-Fi mode. I haven't adapted the LED to use the RGB one built in but that should work too.

I think I need to get an oscilloscope out to my rare old BYD car to check if there is even any data on these pins... Nothing yet but that's the same for all OBD adapters I have tried so far..

I did get the debugging logs into Savvycan with this code base :) its really seamless with the IP auto detection working, I have mine connecting to my phone hotspot as "home" so I still have internet on my laptop via cell phone when connected to the wifican out in car.

** EDIT ** I just found where the CAN pins are actually set in the main .ino file 😆 So that could be why I was getting no data from my car.. will try later 😄

CAN0.setCANPins(GPIO_NUM_4, GPIO_NUM_5);

Changed to:

CAN0.setCANPins(GPIO_NUM_5, GPIO_NUM_6); //  GPIO for M5 stack ATOMIC CANBus Base (CA-IS3050G) with AtomS3 Lite ESP32S3