ESP32 Based Web Interface & Data Logger

Discussion about various user interfaces such as web interface, displays and apps
PoloLbricolo
Posts: 98
Joined: Wed Apr 10, 2019 2:32 pm
Location: France
Has thanked: 2 times
Been thanked: 7 times

Re: ESP32 Based Web Interface & Data Logger

Post by PoloLbricolo »

With platormio i did an upload but then i couldn't connect to the wifi anymore.
I updated the firmware via the arduino ui, then with platformio i did a uploadfs.

here is what i get when i change the node ID or the can speed.
image.png
with arduino ui (1.8.19) i can't use the esp8266 upload data as it says it's incompatible with esp32.
I was able to compile/upload the arduino sketch when i selected nano32 as target.

EDIT : got the ESP32 sketch data uploader and used it, but still the same error when chaning the can speed or node id.

EDIT2 : It now works, I hooked up my candapter and it now worked. I guess it needed the candapter to do the ack of the messages.
as i don't have anything else connected on the bus yet.
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1318 times
Contact:

Re: ESP32 Based Web Interface & Data Logger

Post by johu »

seems more like it used a cached ui.js

2 participants is enough because both ESP and STM will ACK
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Bigpie
Posts: 1719
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 377 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

I've been using the ESP32 based web interface, over can for last day or 2. It keeps getting into a state where the ESP32 cannot communicate with the Zombie MCU.
I've added a button to the UI to restart the ESP32 and communication resumes. I'm thinking maybe it's triggering the ESP32 can buffer overflow bug?
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: ESP32 Based Web Interface & Data Logger

Post by uhi22 »

Maybe add another button which just re-initializes the CAN controller, to confirm or refuse the assumption. And add two counters for debugging, one for "CAN transmit attempt" and one for "received a message from CAN", and show them in the web interface. To get an idea where it is stuck.

Edit: There seems to be error counters which we could also show. Mentioned here https://www.esp32.com/viewtopic.php?t=5010

Edit2: The link points also to an example code which contains
CAN_bus_off_recovery()
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1318 times
Contact:

Re: ESP32 Based Web Interface & Data Logger

Post by johu »

During a recent debug session we found that the invalid json check triggered after 5 minutes. This is odd as it should just load the same json as before but instead it detects an error and deletes the json file. Apparently the re-download doesn't work until you restart or change the node id to something else and back.

I think it is worthwhile commenting it out https://github.com/jsphuebner/esp32-web ... n.cpp#L340
Attachments
4589566782286157857.jpg
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Bigpie
Posts: 1719
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 377 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

I've just commented out like this
if (result != DeserializationError::Ok) {
// SPIFFS.remove(jsonFileName); //if json file is invalid, remove it and trigger re-download
// updstate == REQUEST_JSON;
// retries = 50;
// DBG_OUTPUT_PORT.println("JSON file invalid, re-downloading");

return false;
}
Seems to no longer have the issue, I've not noticed any strange behaviour so far.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
PoloLbricolo
Posts: 98
Joined: Wed Apr 10, 2019 2:32 pm
Location: France
Has thanked: 2 times
Been thanked: 7 times

Re: ESP32 Based Web Interface & Data Logger

Post by PoloLbricolo »

Just got a new thing while remaking my can man
image.png
i haven't done the comments to remove the json issue, could this be linked ?

Edit : I've commented the lines, reuploaded the code to the ESP the wired way, but still no luck. same behaviour, i can't add can messages to the can map. I'm very lost on the workings of this, any help ?
davefiddes
Posts: 267
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 46 times
Been thanked: 80 times

Re: ESP32 Based Web Interface & Data Logger

Post by davefiddes »

Bigpie wrote: Fri Jun 28, 2024 9:23 am I've just commented out like this
if (result != DeserializationError::Ok) {
// SPIFFS.remove(jsonFileName); //if json file is invalid, remove it and trigger re-download
// updstate == REQUEST_JSON;
// retries = 50;
// DBG_OUTPUT_PORT.println("JSON file invalid, re-downloading");

return false;
}
Seems to no longer have the issue, I've not noticed any strange behaviour so far.
If you look closely you can see the problem: The line that updates the "updstate" should be "updstate = REQUEST_JSON" rather than doing an == comparison and then discarding the result.

I turned on -Wall to try and fix the Arduino IDE build which was breaking for me and it highlighted this amongst a bundle of other less serious problems. I'm putting together a PR.
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1318 times
Contact:

Re: ESP32 Based Web Interface & Data Logger

Post by johu »

Cross posting here: a problem with recovering from a failed firmware update hast been fixed: viewtopic.php?t=5223
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Bigpie
Posts: 1719
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 77 times
Been thanked: 377 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

https://github.com/jsphuebner/esp32-web ... ace/pull/9 I've done a PR for configurable can pins.
BMW E91 2006
ZombieVerter
GS450h
Outlander Charger DC/DC
Renault Kangoo 36kWh battery
Zieg
Posts: 248
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 115 times
Been thanked: 102 times

Re: ESP32 Based Web Interface & Data Logger

Post by Zieg »

Not sure where to ask this, maybe here makes sense. I've flashed my esp32 per the instructions on the github but the web interface seems a bit flaky. 'settings' and 'wifi settings' are both blank when I click them (except one time it showed up after waiting 5 minutes or so). Is that normal or does it indicate something went wrong? The same interface on my Wemos D1 seems pretty fast and smooth by comparison. Should I try re-uploading the SPIFFS?

Also, trying to enter a node/speed doesn't seem to work and I can't get parameters or spot values from my Foccci (though it's freshly flashed, I cant be certain it's working right either, but I am thinking since the web UI is acting strange I should start there).
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: ESP32 Based Web Interface & Data Logger

Post by uhi22 »

This sounds like an instable ESP32. My first point to check would be to have a strong 5V power supply for it. Had bad experiences using crappy USB cables. The ESP needs some current for wifi, and tends to crash if the power drops.
Zieg
Posts: 248
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 115 times
Been thanked: 102 times

Re: ESP32 Based Web Interface & Data Logger

Post by Zieg »

Ah, interesting. I'm using a 12v benchtop power supply though, so I don't think it would be that.

Does this all seem correct? Wondering if maybe one of 'events' or 'arduino' should be on core 0? These are all what came up by default. (Edit: actually from another forum it looks like that would be a bad idea, apparently it runs the wifi stuff on core 0.)
Screenshot 2024-10-10 152722.png
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: ESP32 Based Web Interface & Data Logger

Post by uhi22 »

Is it possible to view the ESPs serial? It should give hints how far it comes and what is the reason for crashing.
Zieg
Posts: 248
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 115 times
Been thanked: 102 times

Re: ESP32 Based Web Interface & Data Logger

Post by Zieg »

Well I had the monitor running but didn't get anything out of it after the initial bootup. I even tried a full wipe of the ESP and re-flashed it via the arduino IDE (and the web interface CAN-Backend fork which I just downloaded as a zip and extracted to my workspace). Basically I've discovered it will load all the pages except Settings and Wifi Settings on the first try. And if i refresh the page then click settings, it's about 50-50 whether it will load or give me a blank screen. And of course no parameters or spot values are coming through from Foccci when I enter node 22/500k.

Not sure if this tells us anything useful or not.
Screenshot from 2024-10-11 01-49-18.png
User avatar
uhi22
Posts: 950
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 143 times
Been thanked: 535 times

Re: ESP32 Based Web Interface & Data Logger

Post by uhi22 »

I'm using an older version (not really sure, something from December 2023 I assume), but can confirm, that the error with the missing subscription.js is also present here. If I try to open http://inverter.local/subscription.js I get a HTTP 404 (file not found). So this seems to be "normal".
When just opening the main page, I get some errors, but they seem not to block the functionality:
image.png
No idea what could be the issue on your side. Maybe try an other version, and different browsers. I'm using Chrome and Edge, no problems here with the "December 2023?" version.
Zieg
Posts: 248
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 115 times
Been thanked: 102 times

Re: ESP32 Based Web Interface & Data Logger

Post by Zieg »

Ah, good idea, thank you.

So I tried the commits from December and can't get any on the can fork to compile. I assume it's an issue with one of the libraries since I can't find the offending line anywhere in the repository, but I'm not sure how to figure out what library it is.

Code: Select all

Compilation error: call of overloaded 'setValueSdo(int, int, unsigned int)' is ambiguous
The good news is that I was able to flash something from the UART fork from that time period, and with the older UI everything was nice and smooth. No ability to check CAN obviously, but, progress! Next step will be to start rolling back the libraries I can find and see what happens.

edit: Actually my search wasn't picking it up and after looking through the verbose output it's something to do with oi_can.cpp. Trying newer versions to see if it will compile or if I can figure out how to fix it.

Code: Select all

  318 |   setValueSdo(SDO_INDEX_COMMANDS, SDO_CMD_RESET, 1U);
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Aha, it's referenced in the July 14 commit, which might be too recent but apparently it has to do with the compiler:

Code: Select all

* Fix ambigous overload of OICan::setValueSdo()

The newer gcc 12.2 compiler in the Arduino platform for the ESP32
objects to the overload of OICan::setValueSdo(). As the floating
point conversion is used in only one place it is probably
easiest to move the conversion to the call site.
Unfortunately that version has the new UI so back to square 1 unless I can figure out how to roll back the compiler.
User avatar
johu
Site Admin
Posts: 6323
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 250 times
Been thanked: 1318 times
Contact:

Re: ESP32 Based Web Interface & Data Logger

Post by johu »

subscription.js only exists if you subscribed to a parameter set which I think hardly anyone does. So it's "normal" that it doesn't exist.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Zieg
Posts: 248
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 115 times
Been thanked: 102 times

Re: ESP32 Based Web Interface & Data Logger

Post by Zieg »

Progress!(?)

Went back the latest everything. Not able to get settings or wifi settings to show anything even when I reload now, but I did enter the node id, left it alone for a bit and I still have nothing in parameters or spot values, but it DOES have a json that appears valid when checked online. I hope that's a good thing?

Code: Select all

{ 
   "UdcDivider": {"unit":"dig/V","id":1,"value":10.00,"isparam":true,"minimum":0.00,"maximum":100.00,"default":10.00,"category":"Hardware Config","i":0},
   "EconomizerDuty": {"unit":"%","id":7,"value":100.00,"isparam":true,"minimum":0.00,"maximum":100.00,"default":100.00,"category":"Hardware Config","i":1},
   "InletVtgSrc": {"unit":"0=ChargerOutput, 1=AnalogInput, 2=CAN","id":8,"value":0.00,"isparam":true,"minimum":0.00,"maximum":2.00,"default":0.00,"category":"Hardware Config","i":2},
   "LockDuty": {"unit":"%","id":14,"value":30.00,"isparam":true,"minimum":-100.00,"maximum":100.00,"default":30.00,"category":"Hardware Config","i":3},
   "LockRunTime": {"unit":"ms","id":13,"value":1500.00,"isparam":true,"minimum":0.00,"maximum":10000.00,"default":1500.00,"category":"Hardware Config","i":4},
   "LockClosedThresh": {"unit":"dig","id":11,"value":0.00,"isparam":true,"minimum":0.00,"maximum":4095.00,"default":0.00,"category":"Hardware Config","i":5},
   "LockOpenThresh": {"unit":"dig","id":12,"value":0.00,"isparam":true,"minimum":0.00,"maximum":4095.00,"default":0.00,"category":"Hardware Config","i":6},
   "TempSensorNomRes": {"unit":"Ohm","id":26,"value":10000.00,"isparam":true,"minimum":1.00,"maximum":1000000.00,"default":10000.00,"category":"Hardware Config","i":7},
   "TempSensorBeta": {"unit":"","id":27,"value":3900.00,"isparam":true,"minimum":1.00,"maximum":100000.00,"default":3900.00,"category":"Hardware Config","i":8},
   "ppvariant": {"unit":"","id":28,"value":0.00,"isparam":true,"minimum":0.00,"maximum":9.00,"default":0.00,"category":"Hardware Config","i":9},
   "WakeupPinFunc": {"unit":"0=Level, 1=Pulse, 2=LevelOnValidCp, 3=PulseOnValidCp, 4=LevelOnValidPP","id":30,"value":0.00,"isparam":true,"minimum":0.00,"maximum":4.00,"default":0.00,"category":"Hardware Config","i":10},
   "NodeId": {"unit":"","id":21,"value":22.00,"isparam":true,"minimum":1.00,"maximum":63.00,"default":22.00,"category":"Communication","i":11},
   "CanSpeed": {"unit":"0=125k, 1=250k, 2=500k, 3=800k, 4=1M","id":22,"value":2.00,"isparam":true,"minimum":0.00,"maximum":4.00,"default":2.00,"category":"Communication","i":12},
   "MaxPower": {"unit":"kW","id":17,"value":100.00,"isparam":true,"minimum":0.00,"maximum":1000.00,"default":100.00,"category":"Charge parameters","i":13},
   "MaxVoltage": {"unit":"V","id":18,"value":410.00,"isparam":true,"minimum":0.00,"maximum":1000.00,"default":410.00,"category":"Charge parameters","i":14},
   "MaxCurrent": {"unit":"A","id":19,"value":125.00,"isparam":true,"minimum":0.00,"maximum":500.00,"default":125.00,"category":"Charge parameters","i":15},
   "TargetVoltage": {"unit":"V","id":3,"value":0.00,"isparam":true,"minimum":0.00,"maximum":1000.00,"default":0.00,"category":"Charge parameters","i":16},
   "ChargeCurrent": {"unit":"A","id":4,"value":0.00,"isparam":true,"minimum":0.00,"maximum":500.00,"default":0.00,"category":"Charge parameters","i":17},
   "soc": {"unit":"%","id":5,"value":0.00,"isparam":true,"minimum":0.00,"maximum":100.00,"default":0.00,"category":"Charge parameters","i":18},
   "BatteryVoltage": {"unit":"V","id":6,"value":0.00,"isparam":true,"minimum":0.00,"maximum":1000.00,"default":0.00,"category":"Charge parameters","i":19},
   "enable": {"unit":"0=Off, 1=On","id":23,"value":1.00,"isparam":true,"minimum":0.00,"maximum":1.00,"default":1.00,"category":"Charge parameters","i":20},
   "AcObcState": {"unit":"","id":29,"value":0.00,"isparam":true,"minimum":0.00,"maximum":15.00,"default":0.00,"category":"Charge parameters","i":21},
   "DemoVoltage": {"unit":"V","id":20,"value":0.00,"isparam":true,"minimum":0.00,"maximum":500.00,"default":0.00,"category":"Testing","i":22},
   "DemoControl": {"unit":"0=CAN, 234=StandAlone","id":25,"value":0.00,"isparam":true,"minimum":0.00,"maximum":511.00,"default":0.00,"category":"Testing","i":23},
   "ActuatorTest": {"unit":"0=None, 1=OpenLock, 2=CloseLock, 3=Contactor, 4=LedRed, 5=LedGreen, 6=LedBlue, 7=StateC","id":9,"value":0.00,"isparam":true,"minimum":0.00,"maximum":7.00,"default":0.00,"category":"Testing","i":24},
   "logging": {"unit":"0=None, 1=ConnMgr, 2=HwInterface, 4=Homeplug, 8=StateMachine, 16=QCA, 32=Tcp, 64=TcpTraffic, 128=IPV6, 256=ModemFinder, 512=SDP, 1024=EthTraffic, 2047=All, 959=AllButTraffic","id":15,"value":1645.00,"isparam":true,"minimum":0.00,"maximum":2047.00,"default":1645.00,"category":"Testing","i":25},
   "opmode": {"unit":"0=Off, 1=Connecting, 2=Connected, 3=NegotiateProtocol, 4=SessionSetup, 5=ServiceDiscovery, 6=PaymentSelection, 7=ContractAuthentication, 8=ChargeParameterDiscovery, 9=ConnectorLock, 10=CableCheck, 11=PreCharge, 12=ContactorsClosed, 13=PowerDelivery, 14=CurrentDemand, 15=WaitCurrentDown, 16=WeldingDetection, 17=SessionStop, 18=Error, 19=Timeout, 20=WaitForChargerShutdown, 21=WaitForContactorsOpen, 22=End,","id":2000,"value":0.00,"isparam":false},
   "version": {"unit":"4=0.38.B","id":2001,"value":4.00,"isparam":false},
   "githubRunNumber": {"unit":"","id":2026,"value":14.00,"isparam":false},
   "lasterr": {"unit":"0=NONE, 1=CANTIMEOUT, 2=PLCTIMEOUT, 3=PRECTIMEOUT, 4=LOCKTIMEOUT, 5=EVSEFAULT, 6=RELAYWELDED,","id":2002,"value":1.00,"isparam":false},
   "EvseVoltage": {"unit":"V","id":2006,"value":0.00,"isparam":false},
   "EvseCurrent": {"unit":"A","id":2010,"value":0.00,"isparam":false},
   "InletVoltage": {"unit":"V","id":2007,"value":0.00,"isparam":false},
   "EvseMaxCurrent": {"unit":"A","id":2008,"value":0.00,"isparam":false},
   "EvseMaxVoltage": {"unit":"V","id":2009,"value":0.00,"isparam":false},
   "ControlPilotDuty": {"unit":"%","id":2012,"value":0.00,"isparam":false},
   "temp1": {"unit":"°C","id":2003,"value":-45.87,"isparam":false},
   "temp2": {"unit":"°C","id":2004,"value":-52.18,"isparam":false},
   "temp3": {"unit":"°C","id":2005,"value":-51.87,"isparam":false},
   "MaxTemp": {"unit":"°C","id":2024,"value":-45.87,"isparam":false},
   "ContactorDuty": {"unit":"%","id":2013,"value":0.00,"isparam":false},
   "AdcLockFeedback": {"unit":"dig","id":2011,"value":4033.00,"isparam":false},
   "AdcProximityPilot": {"unit":"dig","id":2018,"value":3023.00,"isparam":false},
   "ResistanceProxPilot": {"unit":"ohm","id":2019,"value":2819.93,"isparam":false},
   "CableCurrentLimit": {"unit":"A","id":2020,"value":0.00,"isparam":false},
   "EvseAcCurrentLimit": {"unit":"A","id":2021,"value":0.00,"isparam":false},
   "AdcHwVariant": {"unit":"","id":2022,"value":1137.00,"isparam":false},
   "HardwareVariant": {"unit":"","id":2025,"value":4005.00,"isparam":false},
   "AdcIpropi": {"unit":"","id":2023,"value":73.00,"isparam":false},
   "LockState": {"unit":"0=None, 1=Open, 2=Closed, 3=Opening, 4=Closing","id":2014,"value":0.00,"isparam":false},
   "StopReason": {"unit":"0=None, 1=Button, 2=MissingEnable, 3=CANTimeout, 4=ChargerShutdown, 5=AccuFull, 6=ChargerEmergency","id":2017,"value":0.00,"isparam":false},
   "checkpoint": {"unit":"dig","id":2015,"value":6.00,"isparam":false},
   "CanWatchdog": {"unit":"dig","id":2016,"value":30.00,"isparam":false},
   "cpuload": {"unit":"%","id":2094,"value":0.28,"isparam":false},
   "serial": {"unit":"","value":"57197004","isparam":false}
}
So far same behavior in chrome, firefox and edge
Screenshot 2024-10-11 124502.png
Zieg
Posts: 248
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 115 times
Been thanked: 102 times

Re: ESP32 Based Web Interface & Data Logger

Post by Zieg »

Got an old version working! I had to roll back the esp32 version in the board manager to 2.0.17 in the Arduino IDE to avoid the compile error (but not until after flashing the OTA sketch to upload the spiffs). Seems like all is good with this version, so I'm happy with that. Appreciate the help guys.

If anyone else experiences something similar, this is the commit that I used: https://github.com/jsphuebner/esp32-web ... e87c7acc8d

And don't forget to fully wipe the board before changing versions. I used a command in powershell to accomplish that.

Code: Select all

python -m esptool --chip esp32 erase_flash
Screenshot 2024-10-11 141343.png
Edit: Also, I just did a github pull request on the hardware, noticed the tx/rx pin labels were reversed on the silkscreen. That's my very first time doing something like that so hopefully it works...
modellfan
Posts: 70
Joined: Tue Jul 12, 2022 11:20 am
Has thanked: 13 times
Been thanked: 5 times

Re: ESP32 Based Web Interface & Data Logger

Post by modellfan »

I just found a bug today after losing my mind about the connection problems. Had always the message „can’t establish connection between esp an stm „ the one in red. When I just hint in settings the button to apply changes of the can pins even without changing the pin it works like a charm.

Without having reviewed the code I would suggest to have baking of watchdog being triggered by the connection error that triggers the apply changes (properly some connection reset).
Post Reply