Fellow Moteino enthusiasts, I've built a large weighing scale using pressure transducers that measure the oil pressure when weight is applied to four cylinders at each corner. No pressure = no weight. The transducers are Dwyer Series 628 with a 4 to 20 ma output current proportional to the 0 to 500 psi range. The first Moteino reads the four transducers, converts analog input to force to get the weight and wirelessly transmits results to the second Moteino where weight is displayed. Everything works just beautifully except the weights are too low and even negative at zero weight.
Here's the function generating the force on each cylinder.
float getForce(int pinNo)
/*
at elevated zero, let A = 1023 * 4ma * R / max. analog input voltage
at full scale, let B = 1023 * 20ma * R / max analog input voltage
let constant K = full scale transducer pressure / (B - A)
return pistonArea * ( inputValue - A)* K
using a 200 ohm resistor so that 4V is top range for 20 mA = TRANSDUCERRATING psi and .8V at 4 mA = 0 psi
thus 248 would be the analog input for the elevated zero at 4 mA =0 psi : 1023 * .8/3.3V where 3.3V is max. input to analog pin
1240 = 1023 * 4/3.3
.5040 = 500 (full scale pressure rating) / (1240 - 248)
This function returns pounds force on one of the hydraulic pistons using formula force = area x pressure
*/
{
int inputValue;
inputValue = analogRead(pinNo);
return pistonArea*(inputValue-248)*.5040;
}
Here's a graph showing the results. Top line would be expected and correct weight while bottom line through four test points is my actual result including the odd negative weight where there is no force/weight on the cylinders.
(http://s25.postimg.org/vhw47wmxn/error_graph_both_lines.jpg) (http://postimg.org/image/vhw47wmxn/)
The very simple circuit is from the manufacturer's instructions:
(http://s25.postimg.org/k49kwpcez/transducer_circuit_page_2.jpg) (http://postimg.org/image/k49kwpcez/)
I've really been beating my head against the wall trying to figure out why my formula apparently has an error giving negative pressure and weights too low. In addition to the derivation in the function above I tried it again from scratch from a slightly different angle with the same results:
0 to 500 psi transducer
4 to 20 ma
200 ohm resistor
V = IR
V = .8 to 4 volts
.8 V corresponds to 0 psi and 4 volts corresponds to 500 psi
3.3V Moteino
1023 bits resolution
So 1023 corresponds to 3.3V and 0 corresponds to 0V
psi = volts * 500/3.2 - 125
volts = analogRead * 3.3/1023
So, psi = (analogRead * 3.3/1023)*500/3.2 - 125
psi = analogRead * .5040 - 125 (same as my existing formula)
Oh, and I'm using 0.5% resistors. And this is the model Moteino I'm using: RFM69W - 433Mhz
Now, it is a very curious thing that if I used about 1000 bits of resolution in my above formula derivation instead of 1023 I get accurate weights and a zero reading when there is no force/weight on a cylinder.
Any suggestions or help are appreciated!
p.s.
If I can correct this issue I plan to publish and opensource the whole thing. It is a livestock scale. I raise cattle. To buy a scale is stupid-expensive for a small operator like me.
Very interesting project, nice of you to share. Would love to see the final outcome. I know there are other farmers (not sure if cattle) that might be interested.
Do you supply any kind of VREF?
I don't know if that would make a difference but you might try using an external precision reference... just a thought.
Is 1000 resolution a bad compromise or do you need the extra accuracy?
Hard to tell what could be out of whack, but I actually have seen similar results on a project I worked on using current transducers, over there it was a matter of calibration so a simple multiplication factor fixed it.