Can download my code for the speedo here, if anyone wants it. All you need to do is connect the TX/RX pins, make sure your protocol is correct, maybe adjust it if you need kph instead of mph, and it should work: download
Posts made by bst857
-
RE: AT Commands for classic bluetooth
-
RE: AT Commands for classic bluetooth
In the end I took the TX/RX pins inside the OBD reader and connected them with wires to the RX/TX pins on the M5Stack. I wrote a program for it and it works really well.
There is one problem I have with it though, I've set it up like this:
I have a relay which is activated by the ACC wire on the stereo, this joins a positive cable, for a USB connector which is powered from the fuse box in the car. The M5Stack is plugged into this USB connector, with its battery removed, so that it turns on and off with the car (otherwise, it won't be able to do its start up routine, lets say I turn the engine on and then off, the M5Stack will stay on, but the OBD will have reset, so it'll need its start up codes, but the M5stack doesn't know it has to send them). The OBD is also turned on and off by the ACC wire too.
So the problem I have is that the M5Stack doesn't always want to turn back on after I've started the engine. I have to unplug and plug the USB cable back in, and then it turns on.
The process is:
- Ignition on, M5stack turns on
- Engine cranks, M5stack turns off (which should happen, because ACC is cut when the engine cranks)
- Engine is on, M5stack remains off - it should turn back on again, but it doesn't.
It seems that if I start the engine fast enough, it doesn't have this problem. If I put the key in and just instantly turn it all the way to start the engine, it doesn't get the chance to turn on until the engine has started.
So it doesn't seem to like being turned on, and then being turned off, then back on again. I think what I need to find is something that is only powered when the engine is on, rather than using ACC. But I'm not sure if that exists or not.
If anyone else knows, or can think of a solution I'd be grateful, its the only problem I have left to solve with it now :)
Little pic of my OBD speedo (not great quality): https://imgur.com/a/DQu6hwr -
AT Commands for classic bluetooth
Hi,
I have bought an M5 Stack grey because I think it could work nice for a project I want to make.
First I should say I am new to Arduino, although I have used a teensy to make a gaming mouse in C before, but this project is quite different.I'm using this guide:
https://sites.google.com/site/grcbyte/electronica/arduino/obdii-bluetooth
(sorry its not in English, but google translate works well).Basically I want to communicate with an OBD2 (ELM327) scanner over classic bluetooth, say for example, get the current engine RPM from it and display it on the M5Stack screen. The OBD2 scanner needs to have a pin sent to it to connect (eg "1234"). So the idea is, the M5Stack and OBD2 scanner sit in my car, when I turn on the ignition, the M5Stack will request data from the OBD2 reader, and display whatever is requested on the screen and constantly update it. It can potentially get quite a lot of information and display it in all sorts of ways, but I just want something simple, and also something I can share with my friends who also want something like this (I am aware you can get these kinds of thing on ebay, but my car is old and most don't support it).
I understand how to do pretty much everything in the guide with the M5 Stack, but the one thing that I'm having trouble with is the AT Commands at the start.
I have set up ESP-IDF, and there is a AT application for it here: https://github.com/espressif/esp32-at
It just seems so complicated and there's a lot of things I don't know. On the HC-05, it looks very easy, so I have ordered one of those just to have as a fallback, and to get the project started (since its hard to begin anything without being able to connect to the OBD2 scanner).
So on the HC-05, I can just use some firmware to communicate with it over serial, after pressing the AT button on the HC-05, I can send AT Commands. But with the M5Stack/ESP32, there is no button, and I don't know if the firmware supports all the commands. It seems it's not so simple as pressing a button, loading some firmware, and sending the commands.
Of course I would rather use the bluetooth on the M5Stack in the end, since it seems a shame to attach a HC-05 to it when it has perfectly functional bluetooth capability built in.
I found these two videos, I was following it for a while, until he started using one USB port for flash and one for AT commands, I don't know what's going on there.
https://www.youtube.com/watch?v=HBrEMIzm_uY
https://www.youtube.com/watch?v=j6lNyjQ4x0YI'm really surprised how difficult it is, I don't have anything against it being difficult, its just surprising to me, I thought it was going to be easy ;) I guess it IS easy but I'm just not able to find the information I need, theres so much you can do, and if you want to do one little thing, its hidden in the vast amounts of information.
So my question is, am I going in the right direction? Can I use esp32-at to do what I need to do? Or is there some much more simple way to do it, that I've missed?
Thanks for any help you can give me.