hamishcunningham / pi-tronics

Source code for Raspberry Pi GATE projects.
http://pi.gate.ac.uk/
42 stars 15 forks source link

battery config error with 14.4V NiCad #65

Open hamishcunningham opened 8 years ago

hamishcunningham commented 8 years ago

Philip Ingram says:

I'm trying to use my kickstarter Pi on a version 2 old Pi B (not a Pi 2B). After trying it as delivered with 8*AA cells [which is fine] I'm now trying to run it from a 14.4V NiCd drill battery. I run sudo mopi, specify 12 cells NiCd and get the response: "The good charge level (14.45V) is greater than the full level (14.4V). Please try again." I guess I can fix this by using the low level commands but it looks as though a minor correction is needed to the mopi software. Clearly 14.4 NiCd has not proved a popular power source 8-}


The problem is a logical error in the simbamon.default code: the final two elements of

BAT_CUTOFF_A=( # n=====Vhigh===Vlow 1 9.0 $OPERATING_FLOOR 2 1.4 1.0 3 1.6 0.8 4 2.0 1.58 5 3.7 3.0 6 4.2 3.0 7 1.2 1.1 )

and

BAT_LOW=$( echo "${BAT_FLOOR}*1.1" |bc )

conflict as

1.1(volts) * 1.1(magic number) is 1.21

hence exceeding the high point. Ouch!

The assumption of the same magic number for all classes of cell is clearly inappropriate. Clearly you have no other customers using NiCd so it's not a serious support issue but it's rather unsatisfying.

I suggest that the simplest and clearest resolution would be to make BAT_CUTOFF_A a three column array from which BAT_LOW is read directly rather than calculated.