I am designing a monitoring circuit for a battery powered device that is charged from a solar panel. The circuit uses an LM339 to indicate the input voltages via two dual colour LEDs, one for the battery voltage and one for the solar panel voltage. The LEDs will be red to indicate low voltage, orange (both LEDs on) to represent a mid range voltage, and green to show a high voltage. Each comparator input contains a potentiometer to allow for calibration and adjustment of the transition points as desired. See the schematic below.
After building and testing the circuit I have observed some very strange behaviour from the LM339. The two comparator elements being used for the solar panel monitoring (A & B) work fine and the transitions on the outputs occur at the correct points for the input voltages, however the comparators being used for the battery (C & D) do not change their outputs at the correct voltage.
The solar panel and battery resistor dividers are adjusted to produce 2.048V at their maximum expected voltage and the other trimpots are set arbitrarily for now. The input conditions for the output transition points for each comparator are summarised below. These are only rough measurements but it's pretty obvious that U1C and U1D aren't even close to being correct.
U1A U1B U1C U1D
V+ 1.499 1.506 2.071 1.64
V- 1.506 1.501 1.909 1.775
I have tried powering the LM339 from 5V instead to get all of the inputs within the common mode range (Vcc - 1.5) but this made no significant difference. I also tried using an LMV339 which has a wider common mode voltage range (Vcc - 0.7V) and this is also exhibiting the same behaviour.
Why would two of the comparators in the LM339 exhibit this incorrect behaviour while the other two work fine, when all of them have identical input topologies?
Any help would be appreciated.
Edit: As per the suggestions I have improved the ground connection and bypassing, decreased the resistors by about a factor of 10, and added 1µF caps on each of the taps. This has made no significant difference.
Here are my new test results for the point at which each comparator transitions.
U1A U1B U1C U1D
V+ 1.163 1.159 2.084 1.646
V- 1.154 1.168 1.918 1.790