2020-09-16 09:20 PM
I have been working on a battery powered application and am experiencing some strange behavior when the batteries are dying. The LED array is being driven by a PWM signal on PD4 through a FET. When the +4V power line goes down to 2.6xx V, all of the LEDs are turning on. The voltage measured at PD4 (Q1 gate) is measured as 0.003V, but I am seeing around 1.3xx V on the drain of Q1. I thought perhaps the pull-up resistors were driving the low battery led and the transistor, but I shouldn't be seeing 0.003 V on the gate of the transistor if that is the case and the FET should not be on.
Anyone have any insight as to what is going on.
2020-09-20 01:04 PM
I don't know your setup or how your software works, but if what you are describing is right, then the only explanation I see from far is the following:
when the battery is depleted the voltage starts dropping faster and the internal equivalent resistance of teh battery is higher than normal, the BOR resets the MCU because the supply voltage reaches the lower limit. When the MCU is in reset, the LEDs turn off, and so, with no current being drawn from the battery anymore, the battery voltage goes up again with no consumer on it. Now the battery voltage being higher the BOR releases the reset on the MCU and the MCU starts working again, turning on the LEDs again, and this leads to a new cycle.
So I guess what you are seing is start-stop oscillations, that's why you measure those voltages. If you could use an oscilloscope to see what happens, you would probably understand better the phenomena.
2020-09-20 04:28 PM
Cristian, you are spot on! I was able to get an oscilloscope and was able to see the oscillation.
Now to decide what to do about it. I guess I could choose a different device that operates at a lower voltage and run the system from 3.6V instead of 4V. I'm not seeing a low power version of this device unfortunately, and the next closest one with an ADC is double the price. I tried adding a delay as the first instruction in my main loop, and that seems to cause the LEDs to flash instead of be on solid. I suppose if I read the battery before the switcher I can do a few flashes at start-up if the battery is below a certain voltage, then once that starts to occur, it will do it automatically until the battery dies to the point where the LEDs can no longer be driven at all.
2020-09-20 04:35 PM
The LEDs have a minimum forward voltage of 1.9V, so I would think one of the 1.65-3.6V devices would stay on during the dip (might need a reservoir capacitor).
2020-09-20 11:49 PM
Using a STM8L version would help, even the STM8L050 with 8 pins would do if you don't have other circuitry around, but don't you want to save the battery? With 4 V, I imagine it is a Li-Ion/Po rechargeable.
2020-09-21 05:28 AM
No, from a single AA battery. There is the possibility of a white LED (often have very high Vf - some up to 3.6V) with no budget for a separate LED driver.
The 8 pin device is nice, but I may need up to 8 or 9 I/O lines. Size wise, I think I am limited to the 3x3 package. The only other device that looks like a possibility is the STM8L151F2.