collin80 / TeslaBMS-ESP32

ESP32 port of the existing TeslaBMS program
7 stars 1 forks source link

USB serial port #1

Open Maxim-7777 opened 7 months ago

Maxim-7777 commented 7 months ago

Hello Collin, would this run on ESP-32 Dev Kit C V4? Does anything else need to be changed? The data comes via 'USB serial port' ?? Nice greetings from Germany Screenshot 2024-04-25 at 21-50-49 ESP-32 Dev Kit C V4

collin80 commented 7 months ago

I believe it would probably work. There are two defines that may need to be changed:

define SERIALCONSOLE Serial

define SERIAL Serial2

If this board you're using has native USB then I still think that Serial is the correct name for the USB connection but you should double check. Then, you may need to set up which pins Serial2 uses (or look up the default) and be sure that you use those pins. Comm to the Tesla modules is normal serial so as long as you're using the proper RX/TX pins for serial then it should work fine.

Maxim-7777 commented 6 months ago

Hello Collin, thanks for the quick reply, where should I make the changes? In “config.h” or in “TeslaBMS-ESP32.ino”? I've tried a lot of things, unfortunately I can't get the data. It's not as easy as the Arduino Due! Can I make you a small donation? Maybe you can buy and test an ESP32 Dev Kit? Is this possible? Greetings Maxim.

collin80 commented 6 months ago

Hmmm, I think I do have an ESP32 dev kit somewhere around here. It should have been possible to switch which COM port you're using by setting it in config.h

I know that ESP32 boards work for talking to the TeslaBMS boards because I routinely do it. But, not with that particular board yet. Were you sure to power the BMS chain at the same voltage as the ESP32? My own board has level shifters from 5v to 3.3v but I'm told this is not necessary and that it should work fine at 3.3v

Do you have a logic analyzer or oscilloscope to make sure that traffic is on the pins you think it is? TTL serial is pulled high by default when nothing is flowing so you should also be able to confirm that RX and TX are pulled high. If either doesn't seem to be pulled high then something is misconfigured.

Maxim-7777 commented 6 months ago

Hey Colin, that's awesome! You're the best! It works! Thank you very much.

Maxim-7777 commented 2 months ago

Hey Colin, is it possible to display the voltages in 3 digits after a decimal point? At the moment it shows 4.12V, is it possible to display it as 4.123V?

collin80 commented 2 months ago

When you see %f in the source code, try %4.3f instead. That should force it to try to use 3 digits after the decimal point. I do think the output code defaults to 2 decimal places otherwise.

Maxim-7777 commented 2 months ago

in which source code? in "SerialConsole.cpp" or in all source code? Thanks for your answer!