mstrens / oXs_on_RP2040

version of openXsensor to be used on raspberry pi pico RP2040 (more protocols, more functionalities)
87 stars 22 forks source link

Hobbywing Capacity Problem #124

Closed Klippeneck closed 7 months ago

Klippeneck commented 7 months ago

Hello Mstrens, I think I have found another problem with the OXS RP2040 sensor with SW 2.10.11. The sensor is configured as Vario, GPS and Hobbywing telemetry for Jeti, The telemetry values from the Vario, GPS and ESC voltage and current and temperatures are ok, only the calculation of the removed capacity still seems to be faulty. For example, on the first flight with the electric glider, the 120mAh capacity taken for the start after 45 minutes of sailing (without motor) jumped to 1600mAh the next time the motor was switched on. Attached is a snapshot of the log file. Juergen

Screenshot 2024-02-23 16 45 58

mstrens commented 7 months ago

I made some changes in 2.11.41 (test branch). I hope it helps.

Current (and so consumption) was discarded when throttle was less than 1/4. I removed this check (was in some code I reused).

Klippeneck commented 7 months ago

Hello Mstrens, Thank you very much for your quick response. If the weather permits tomorrow, I'll test it and get back to you. Jürgen

Klippeneck commented 7 months ago

Good morning Mstrens, Tests with SW2.11.41 show the same result, including jumps in the capacity curve after pauses in engine operation. See screenshot. Jürgen Screenshot 2024-02-24 09 58 52

mstrens commented 7 months ago

That is strange. I do not see directly the bug. Could you provide me the full log (e.g. in csv file) I would e.g. see if volt1 and current changes when the motor is off.

mstrens commented 7 months ago

It looks like oXs does not get valid data from the esc when throttle is off. oXs remembers the last time it got a valid frame. When it get a new valid frame, oXs calculates the elapse time and multiply it with the new current. This could explain the graph that you show.

In the code I initially reused, there was a test to discard the ESC current when throttle % was less than 25%.

It seems that the hobbywing esc sent different frames and there are checks to discard some of them.

I could make a version that print a message on the usb/serial with the raw content of all frames received from esc. This would help to see what happens. Could you then make a test with the oXs connected to the PC and to the ESC? I so, I will make such a version.

mstrens commented 7 months ago

I put version 2.11.42 on github. There are more debug messages sent to usb/serial. This could be useful if you can make a test when connected to the PC and copy/paste the messages.

I also reset the elapse time after an invalid frame. This will perhaps help.

Klippeneck commented 7 months ago

Test_RP2040_ESC.csv With Version 2.11.41

mstrens commented 7 months ago

Your test with 2.11.41 confirms that:

In version 2.11.42, you should not have anymore this sudden increase. Still it would be good to look at the raw data in the frames sent by the ESC to understand why frames where discarded.

mstrens commented 7 months ago

To get the raw frame data on the usb/serial, I should make a version for you or you could use 2.11.42 and change a few lines in esc.cpp and compile your self. The lines to change are: //for (uint8_t i=0; i< escMaxFrameLen ; i++){ // printf("%2X ",escRxBuffer[i] );
//} //printf("\n");

Just remove the // in front of the lines to activate them.

Klippeneck commented 7 months ago

Hello Mstrens, I have the following data on the USB interface with SW 2.11.42 without any changes received. I am not able to change 2.11.42 myself at the moment with my knowledge. I would have to familiarise myself first. ESC_Test2.odt

mstrens commented 7 months ago

I have an issue when I try to open the file in Word. I get a message saying the file is corrupted. In Wordpad, I can read the beginning up to 17:32:43.999 Is this the end of the file?

This first part seems ok.

Klippeneck commented 7 months ago

From 17;31:58.361 i conect the Accu. From 17:32:04.797 to 17:32:10.140 I Schwitch Motor On. From 17:32:04.140 to 17:32:39.291 i Motor Stop From 17:32:39.291 to 17:32:43.999 sekond Run Jürgen

mstrens commented 7 months ago

With 2.11.42 the messages where printed when esc data could be processed (after some checks). When motor is swith off, there is no "valid" messages.

I made version 2.11.43 (now on github) with more debug messages (all raw data's). I hope we can see more.

Klippeneck commented 7 months ago

Test with 2.11.43 ( Run-Pause-Run) ESC_Test2.11.43.odt Jürgen

mstrens commented 7 months ago

Thanks. This confirms that when throttle is low, then ESC does not send frames. It means that oXs can calculate consumption only when motor is on.

I put version 2.11.44 where:

This should avoid the big jump your noticed. This gives only the consumption when motor is on.

Klippeneck commented 7 months ago

Hello Mstrens, In-house tests with SW 2.11.44 are successful. No more jumps in capacity. Thank you very much. Juergen

mstrens commented 7 months ago

Thanks for the feedback. I can also make one more change:

mstrens commented 7 months ago

Sorry, sending a telemetry field with current=0 when ESC does not provide a frame withing 0.8sec would be to difficult because the logic is currently to react on incoming frame only.

Klippeneck commented 7 months ago

Hello Mstrens, No problem, as the BEC consumption is not measured anyway and is not included in the capacity calculation. With my model, this is approx. 200mAh/hour, which I add manually depending on the flight time. Then the recharged capacity corresponds well with the capacity displayed in the transmitter. Jürgen