ESP32 Based Web Interface & Data Logger

Discussion about various user interfaces such as web interface, displays and apps
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

It's in the share https://drive.google.com/drive/folders/ ... sp=sharing same card. Other cards wont mount on it for some reason though they will on my laptop. Luckily I bought 2 sd card readers so will solder the pins on and try the other too.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Not had any issues with the cards here at all, they mount no trouble and read and write reliably.

Wondering if there might be something on your ESP32 board that is loading one of the lines and making the pullups on the SDIO lines a bit marginal (I think the ones on my SD breakout board are 50K which is a bit high according to the Espressif specs)? If you have the bits there it might be worth trying to add some extra 10k pull ups on the lines?

Edit - one other thought, if it works ok on the bench but not in the car could it be noise pickup? How long are the connections between the esp and card? The shorter the better really.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

Fairly long, they reach out of the inverter. Done a fair bit of driving today and failed to log all. Need further debugging. I did find one bug, if rolling backwards a little trying to go forward causes juddering, so want to get a log of that.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

As long as the lines between the OpenInverter board and the ESP32 are reasonably well routed and preferably screened I would have though they would be OK. Corruption on those would just affect comms and not the data not SD card mounting.

It was more the wires between the ESP32 board and the SD breakout board that I was thinking off. They are the ones that will affect the SD card mounting or reading and also run at much higher speeds so could be prone to noise pickup too.

Do the SD cards mount OK when the boards are not in car?

Is the juddering while rolling back new? If so it might be worth doing a diff of the logging code against whatever you were previously using to see if anything else has changed.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

Might adjust the code to every 10 seconds try remount the SDCard and reset the startLogAttempt to 0, if it's not already mounted, maybe that'll improve the reliability of getting data. BTW added a couple more logs from today. Higher speed does have issues with the power coming on and off.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Trouble is that if it is a noise problem then retries will probably get it to mount but may then produce files full of corrupted data. If the problem is only in the car then noise (or possibly power supply issues?) seem fairly likely.

Have you got a pic of the install?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

I'll get a pic later when I go out to car, it's not pretty :D I've added calculating i3 to the converter. Can pulse view overlay signals
Screenshot 2022-10-26 at 9.41.41 am.png
Try as a might, I cannot understand what a 'good' id iq plot should look like, also with ud uq :D
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Bigpie wrote: Wed Oct 26, 2022 8:59 am I'll get a pic later when I go out to car, it's not pretty :D I've added calculating i3 to the converter. Can pulse view overlay signals
Looking good :)
Dont think so (have had a good look in the docs and google but can't find any mention of it). It would be nice though. It should be possible to modify the Pulseview source to add it but not something ill be looking at any time soon!

Still think you have something marginal in the card electronics (pull ups?), noticed your earlier post where you mentioned other cards wouldn't mount, that would back this up
Bigpie wrote: Wed Oct 26, 2022 8:59 am Try as a might, I cannot understand what a 'good' id iq plot should look like, also with ud uq :D
You and me both ;)

TBH the ideal iq, id, uq and ud vary massively with motor inductance so giving guidelines is difficult. Ill try to get some more plots up from the simulator later which might help. Most of the traces are there more for diagnosing control/trip problems rather than for setting up to the inverter.

For checking the setup is ok the main things to check are:
For tuning the q and d controllers is that iq and id follow iqref and idref closely and without ringing and overshoot.
For setting up the FW controller look to avoid oscillations on idref.
For the throttle limit controller (when it is implemented) check there are no simultaneous oscillations on both iqref and idref.
The last thing to watch for is ud and uq hitting the limits for long periods (I need to work out the actual limit values for this, there is one where the fw and throttle loops are still doing their jobs and one where they have given up, its the last one that matters)

Edit - sorry not managed to look at your newer data yet but will do. If there is anything you could do with a second opinion on let me know otherwise it will likely be a couple of days before I get to it.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

No problem, just looking to get a plot containing the judder at the moment and a cut out. Nothing jumps out at me, but then I wouldn't know :D

I've not looked at applying the fix you found in the sim thread yet either.

I'll get some 10k smd resistors to change the the pullups. I've got an LCR on the way to measure the motor.
20221026_110306.jpg
20221026_110259.jpg
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

That should be fine, can't see anything there that's likely to cause a problem. Hopefully the 10k resistors will help.

Wouldn't worry about the mod for now unless the trips have come back.

Great news on the bridge. If we can get measurements on your motor and a decent log then it gives me the data needed to see if we can use the motor model out of the simulator to calculate motor parameters from logged data.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

Managed to capture a desat in the latest log I've just upped. If I put it in 2nd and just stamp on it will do it, if I press progressively it'll accelerate, slowly, away but I can have my foot planted.
Screenshot 2022-10-26 at 3.01.06 pm.png
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Now that's interesting!

Just got a few more plots to put up on the simulator thread then I'll download it and have a look.
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

OK, downloaded and processed the file, no errors at all on that one :)

The only desat I can see is while moving rather than starting of (looks like you slowed and then put your foot down and then about a second later it tripped), is that the one?

Apart from the funny spikes on i1, i2 and pwm1 (can't decide what they are, real, comms corruption (but then no csum errors are reported), sd probs??) everything looks good.

Your voltages are staying within sensible limits (you must have a low inductance motor, will be interesting to see the measurements to see if they confirm that)

The Iq and Id currents are following the references pretty well (couple of areas where they don't which I need to have another look at).

The pwm values all look sensible.

You were pushing 400A onto i1 though so is it possible that it is a real desat trip? Although you did manage to maintain those currents for longer periods later on in the log which would suggest it wasn't.

The only thing that is a little odd is that there is a strange distortion on the current plots (visible in your plot above on the trailing edge of the flat top on i1) that is building up on each cycle just before the trip. It's pretty small but it is also visible in the PWM plots (I assume the control loops are trying to compensate for the distortion). It's almost like the IGBTs are turning off more slowly than normal. If that was the case then you might start getting shoot through which would definitely trip the desat. IGBT turnoff slows down with increasing temperature, could they be getting too hot?

Be interested to see one of the trips when starting off in 2nd if you have a log?
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Just had a slightly nasty though about low inductance motors which might explain the odd current waveforms on your plots, it might also explain the trips.

Say it is a low inductance motor with say Ld of 160uH, now that means for a 50% on pwm pulse at 4k4Hz would give:

ton = 0.25 x (1/4400) = 57us
i = Vt/L = 350 x 57e-6 / 160e-6 = 124A

This means that ripple currents of 100A are not unlikely on the motor. Not sure what the measurement bandwidth of the current sensors and signal conditioning circuits is but say it is high enough to let the ripple currents through. Now the ADC sample point is not locked to the PWM, it just free runs; this means that over time the two could drift relative to each other (either over ms, sec or 10s of sec depending on what the different timer reloads are) which means that the ADC could end up sampling at a current high point for a while, a current low point for a while or a bit of both.

This is all speculation but if it is then it would cause some really weird behaviour (and could give exactly the kind of current plots you have captured). It would mean that the car would feel like it sometimes pulls a lot better than others - does it do this?

The fix would be to use the newly discovered second ADC (if it really is there!) to do pwm synchonised sampling of i1 and i2. If the car behaves better and the plots suddenly make sense then that's what it was.

@johu - do you fancy trying this?

I may well be talking rubbish here but it's the only explanation I can come up with that fits at the moment.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

Don't think 400A would cause desat, I've been able to maintain more than that as you say, seems more to do with the speed on the throttle press. I shall aim to go somewhere to be able to take short start stop then off logs at the weekend. Either way, the improvements are fantastic, so much so, I might not bother with the leaf motor swap now, so thank you for the effort.

EDIT, funny you should say that, on occasions I have thought it seemed to perform better than others, pre your MTPA changes, or at least it was more easily noticeable. I'd just assumed I was imaging it.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

No problem, great to hear it's working well. Think there's still more performance to be had though :D

Thanks for trying the logger, seeing the data really helps with working out what's going on and I'm keen to import some of the data into the simulator to see how close i can get them to match.

The more I think about it the more I think we need current sampling synchronised to the PWM, especially if motor inductances can be as low as it is looking at the moment. Hoping Johannes will have some thoughts on this :)
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: ESP32 Based Web Interface & Data Logger

Post by johu »

Because of my own silliness I pulled the inverter from Touran so now I'd have the chance to fit one of my new ESP32 boards and maybe bodge in an SD card. If only it weren't for that stupid TE connector that I'd need to pull from the adapter board. Will see how my motivation is tomorrow.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Sorry to hear about your problems :(

It would be a good opportunity to fit it and more data would be great!

If you do embed the ESP32 make sure you test the bootloader functionality though. The code has both the UART and swd code in but the former had a lot of changes to work with the different UART api and the swd hasn't been touched (despite the platform change). I haven't tested either, don't know whether @Bigpie has?

Probably sensible to check the ESP OTA update too as that hasn't been tested either!
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: ESP32 Based Web Interface & Data Logger

Post by johu »

Yes if I make the swap I'll surely test all OTA features before dropping it back in
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

Any specific conditions for data recordings do you think would be useful?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Bigpie wrote: Tue Nov 01, 2022 9:51 pm Any specific conditions for data recordings do you think would be useful?
For use with simulator development just fairly smooth driving, range of steady accellerations, decelerations and coasting (ideally with each lasting for a few seconds to allow the control loops to stabilise. Preferable on flat roads (no hills) so that motor load can be inferred from acceleration data.

For debug whatever displays the problem you need to investigate.

Have you tried the resistors, if so has it helped at all?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

haven't got round to it yet :D Need to dig out the board and see what size the resistors are on there to get replacements
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

Wouldn't bother trying to replace them, if it's like mine they are tiny little SIL arrays which would be a right pain to swap.

I'd leave the existing resistors in place and just bodge some extra 10kish resistors on at the header (one end to the header pin with a common wire along the other ends connected to 3V3), much easier to do and should work just as well.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: ESP32 Based Web Interface & Data Logger

Post by Bigpie »

Ahh, will do that. Is it just the D0, D1, D2, D3 pins?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: ESP32 Based Web Interface & Data Logger

Post by Pete9008 »

I'd do all of them (CLK and CMD as well).
Post Reply