dgatf / msrc

Multi Sensor for RC with RP2040 - FrSky D, SmartPort, XBUS, SRXL, IBUS, SBUS, Multiplex Sensor Bus, Jeti Ex Bus, Hitec
GNU General Public License v3.0
165 stars 39 forks source link

Hobbywing 120A Current Values are wrong #123

Closed floflolapin closed 3 weeks ago

floflolapin commented 3 months ago

Hi, I use this msrc with a platinum 120A esc. Voltage and rpm seems ok but the current values are completely off It basically only reads between 120A and140A as soon as throttle is above 25%.

Do you have an idea what could be the problem? Thanks Florian

dgatf commented 3 months ago

You can change the throttle value from where the current is transmitted with Throttle current threshold. Default value is 25% Low throttle values for current are not accurate. You can set to 0% if desired. See attached picture.

Captura desde 2024-04-13 18-55-59

Current raw values in hobbywing escs comes with an offset. You have to wait 15s with zero throttle to let msrc auto offset the current raw value. You can see this in debug mode.

Though, there was a bug in this feature (current auto level). This is fixed with commit 0897e29

Please flash updated binary

floflolapin commented 3 months ago

Hi, I played with it a lot more, updated the binary and was able to match the current at full throttle. A current multiplier of 18 gives me around 140A which matches my current meter and the data logged by the esc that I can read with the porgram box. I set the max current at 150A.

The problem is that I don't see anything below 70A from the MSRC, even at half throttle, when the current is around 30A, correctly given by my current meter and the program box...

Thanks for your help Florian

dgatf commented 2 months ago

Ok. That means that the current output raw values are not lineal (thats weird, thanks hw...). I guess you can do this measurement only with the model flying, so you can't see msrc debug output as is not connected to usb, do you?

If you cant measure current while connected to usb to see msrc debug, I can change the sensor output or add a new sensor with the current raw values. Then, with your log file, we can make a non linear approximation.

One question, after 15 seconds, current is 0 at 0 throttle? Please set threshold at 0% and check if after current auto level, then push throttle abd back to 0%, current goes back to zero. In some hw esc, bellow a throttle value, current values, just don't change and are left to whatever value current has before going below that throttle level. Current for hw is a nightmare. I guess they should have a good reason for that...;(

Are values over 50% throttle in line with your current measurements?

Which system are you using, frsky?

dgatf commented 2 months ago

Also could you post some msrc debug output (if its an heli or plane without blades, please)

dgatf commented 2 months ago

Please, make another test. Just push throttle over 50% for a second and then push back to 0%, before 15 seconds for auto level. Then check if you are getting better values.

dgatf commented 2 months ago

It could be that you push some throttle before waiting 15 seconds (for current auto level feature in msrc). I'll add some light/led signal to visualize that.

floflolapin commented 2 months ago

Hi I'll do the tests tomorrow. I'm using frsky. Last flight I had a lot of "sensor lost" warnings and I checked that it's losing the data from the esc... Should I change the refresh rates in the configurator, or maybe reflash the rp2040?

I can have usb debug when testing with the plane secured. (That's what I did)

Also I think I have a telemetry current sensor and I may be able to hook it at the same time to have both raw values and actual current in the logs. I guess it could be a good way to estimate the formula? Thanks for your help

dgatf commented 2 months ago

Yes, but i need to add a telemery sensor with raw current values and throttle so you can log it together with your current sensor. Now raw values and throttle are only visible in the debug of msrc

dgatf commented 2 months ago

Do you have sensor lost for all msrc sensors or only for msrc current sensor or for all msrc esc sensors (voltage, rpm, current)? If it is for all sensors msrc, replace the resistor to tx with a diode. If it is for all esc sensors add a10k pullup to esc dataline. I cant test now, but i believe thats the correct orientation for the diode(frsky is inverted serial) if you have sensor lost for all msrc sensors. If no sensor is shown in your transmitter, change the diode orientation An external pulldown on receiver frsky dataline shouldn't be needed if sensor lost doesnt affectc all msrc sensors. You can enable voltage sensor only (not esc) and check if sensor lost still appears. No need to connect anything on analog pin of msrc for voltage for this test. Screenshot_20240430_004707_Chrome

Most probably not, but debug could produce sensor lost. Try also sensor lost tests without debug enabled, in case it still happens.

It may look a bit complicated. Ask if any doubt

floflolapin commented 2 months ago

Hi, I tried a few things... I have 2 rp2040 board, and I tried the second one to see if it also had the sensor lost problem. It didn't until I tried plugging usb and smartport at the same time. Although I made sure not to power the board from USB and the bec at the same time, trying to conncet usb and smartport seems to mess something and now both board give the "sensor lost" warnings...

I also hook the frsky telemetry current sensor and msrc to get logs with both current values. You'll see Log1 is when I waited 15 seconds before powering the motor, and log2 is when I applied around half throttle before the 15 seconds. I'm not entirely sure if this board has the updated firmware though, because I don't see the "current offset" in the debug attached... I'll try re uploading the firmware

Thanks for your help Debug.txt Log 2.csv Log 1.csv

floflolapin commented 2 months ago

Hi, here are the logs of my 2 last flights. This is with the board I know has the updated binary. For the first one I waited before applying power, on the second one I applied quickly about half throttle. I also removed the data we don't need flight log 2.xlsx flight log1..xlsx

I hope it can help. Thanks

floflolapin commented 2 months ago

Hi. I received the new rp2040 boards and am ready to do more test. Thanks for your help. Florian

Timo-72 commented 1 month ago

For me it look likes that multiplicator needs to be 100 instead of 10. But I have to check that

dgatf commented 1 month ago

Enabling debug may overload the rp2040, causing sensor lost issue. Before checking for sensor lost, disable debug mode (or restart rp2040).

Also note that I've updated the formula for current in esc hw v4. Please use this to convert to actual formula:

Current multiplier = 1 / (ampgain* 0.25/1000) = 4000 / ampgain

Falcon-58 commented 1 month ago

Hello, how are you?

I'm using the hobywing ESC / Frsky Radio and the telemetry regarding battery consumption/amperage doesn't show the correct values. I downloaded the new binary file and copied it to the rp2040 board. We made several attempts with multiplier values. For example, 10, 20, 25, 40, up to 100. The results were not proportional, i.e. the multiplier 10 indicated 60 ah while the 25 indicated 11 ah. What would be the correct multiplier? Grateful

dgatf commented 1 month ago

The results were not proportional.

If so, current auto offset is not working properly. Please enable debug and post output. Be sure you download latest binary.

Note current auto offset happens 15 seconds after boot. Before auto offset , current value is set to 0.

Falcon-58 commented 3 weeks ago

Dear, good afternoon.

Thanks for the feedback. I downloaded the indicated file and the data collected matches the true measurement. Congratulations on the project and support. grateful

floflolapin commented 3 weeks ago

Hi, Thanks for your help but I sadly still have the same issue eve"n with the updated binary...

Here are 2 logs of static runs, with a frsky current sensor logging simultaneously. "offset" is when I waited for the auto offset and "no offset" is when I applied about 10% throttle before the 15 seconds.

Without waiting the values are much more in check, although they depends on how much throttle I added before the auto offset...

I feel like if I was able to set a manual offset, values could be pretty close to reality. Hope this could help. Thanks OFFSET 1.csv NO OFFSET 2.csv

dgatf commented 3 weeks ago

I feel like if I was able to set a manual offset, values could be pretty close to reality.

Added an option to set current offset manually with commit.

Binaries updated.

Timo-72 commented 2 weeks ago

Before I started my 2nd "msrc" project I checked if I can use Telemetry with my Microbeast flybarless system. In the meanteam Microbeast added telemetry functions. But with Frysky and smartport and my Microbeast plus it is not possible. But I could remember that I have seen currenct measurement issues on hobbywing. I just searched the information again:

https://wiki.beastx.com/index.php?title=Manuals:MBPlusFblV52:Receiver_M/en

On this page you find the following information: "Some ESC do not calculate the current consumption (Hobbywing®, Kontronik® Jive). Here MICROBEAST PLUS will do the work and calculate the current consumption using the instant current values. Anyhow, results may vary as speed controllers usually measure the motor current but not the battery current. So we added the parameter Capacity correction which allows to compensate the offset. I.e. when telemetry shows 3600mAh of current consumption, but in reality you did charge 4000mAh back into your battery after the flight, you can increase the Current correction by 10% to 110 in order to get proper reading the next time. Please note this very special value can only be set by using StudioX!" , StudioX is the PC software to setup the Microbeast

I think if you Daniel add a correction factor and everybody need to make the adjustment is the right way!

I have in my Trex 500x the Teeny Version of the Msrc program since ca. 2 to 3 years. The current information is perfect in the helicopter. 6S 3300mAh to 4000mAh batteries with Hobbywing 120A V4.

floflolapin commented 2 weeks ago

Hi. I tried the new firmwares and I'm really happy with them. I could spend some more time tuning the values perfectly but as of now, currents are already within a few amps from each other! Here are the values I put in. Thanks a lot for your help Florian MANUAL OFFSET.csv 20240707_201750

dgatf commented 2 weeks ago

Great!