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
168 stars 41 forks source link

current scale #36

Closed twistedwings closed 3 years ago

twistedwings commented 3 years ago

I want to connect a current sensor to A6. The current scale of the sensor is 19.1A/V. I have entered a scale of 19.1 in OpenTX. Then I tested msrc by applying voltage to pin A6.

These were the measurements: 1V 0.7A (expected 19.1A) 2V 1.4A (expected 38.2A)

I had to enter a scale of 484 to get the correct current displayed.

Arduino Pro Mini 3,3V/8MHz Sensors HW3, current Radiomaster TX16S OpenTX 2.3.11

dgatf commented 3 years ago

Code is ok. There was an error in the formula for analog current in the readme. The way is managed the ratio in opentx sensors is a bit counterintuitive for other sensors than voltage dividers (ratio = max sensor voltage x voltage divider ratio). I still need to understand why multiplier 25.5 is needed to get multiplier = 1

In your case: 19.1* 25.5 = 487.05

twistedwings commented 3 years ago

thanks. An explanation for the 25.5 magic is here https://openrcforums.com/forum/viewtopic.php?f=86&t=12483&p=148399#p148399

dgatf commented 3 years ago

Interesting. Thanks