Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5582

Automation, sensing and robotics • Re: Can't measure resistors

$
0
0
Have you physically disconnect the two superfluous pins?

As I said earlier it needs to use a different equation, I thought it had been changed. You haven't stated how you are measuring voltages now but it looks very much like there is an offset problem.

Going back to your original program ....

Currently if there is an offset it is not cancelled

Demonstrating using x as offsets

Code:

MaxVoltage1 + x = chan3.voltageloadVoltage1 + x = chan.voltageshuntVoltage1 = {MaxVoltage1 + x) - (loadVoltage1 + x) = MaxVoltage1 - LoadVoltage1// offset is cancelled loadRes1 = shunt * ((loadVoltage1 + x) / shuntVoltage1)// loadVoltage1 offset has nothing to cancel with

Note that chan2 voltage is not even being used for the calculation so there is an additional offset problem, not just a reading offset.


Using the modified equation with offsets and chan2

Code:

MaxVoltage1 + x = chan3.voltageloadVoltage1 + x= chan.voltagelowVoltage1 + x = chan2.voltageshuntVoltage1 = {MaxVoltage1 + x) - (loadVoltage1 + x)// = MaxVoltage1 - LoadVoltage1// offset is cancelled LoadV = (loadVoltage1 + x) - (lowVoltage1 + x)// = loadVoltage1 lowVolatge1//offset is cancelledloadRes1 = shunt * LoadV/shuntVoltage1// both loadV and shuntVoltage1 have no offsets so answer doesn't either.

So the program should be

Code:

MaxVoltage1 = chan3.voltageloadVoltage1= chan.voltagelowVoltage1 = chan2.voltageshuntVoltage1 = MaxVoltage1 - loadVoltage1LoadV = loadVoltage1 - lowVoltage1loadRes1 = shunt * LoadV/shuntVoltage1
It would be much easier to read using the form

Code:

//shunt resistor is at top of chainADC3 = chan3.voltage //top of chainADC2 = chan.voltage //junction pointADC1 = chan1.voltage //bottom of chainRtest = Rshunt * (ADC2 - ADC1) / (ADC3 - ADC2)
or better still

Code:

//shunt resistor is at top of chainTopV = chan3.voltage //top of chainMidV = chan.voltage //junction pointBottomV = chan1.voltage //bottom of chainRtest = Rshunt * (MidV - BottomV) / (TopV - MidV)
I will say again that there is no need to use two sets of equations, if the resistors stay in the same place only one equation is needed which works for "forward" and "reverse"

Apologies for any typos, eyesight is a bit dodgy tonight. Also I have no idea what a comment is in python - or did I hit lucky?

Statistics: Posted by pidd — Fri May 10, 2024 1:17 am



Viewing all articles
Browse latest Browse all 5582

Trending Articles