-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to compensate battery voltage drop with light PWM value #2510
Comments
Could be the same approach as with colored lights? With the most basic brightness, we simply walk the existing channels and apply it as a 0...100% scaling espurna/code/espurna/light.cpp Lines 732 to 736 in 02581c6
espurna/code/espurna/light.cpp Lines 713 to 730 in 02581c6
You could either replace the implementation completely and make it dependent on the battery level at that moment, or chain another object into the 'apply()` of the light channel espurna/code/espurna/light.cpp Line 875 in 02581c6
(i.e. it applies channel filtered through rgb object first, then brightness one) And some periodic timer to force-apply channel values |
ok got it, or maybe adding another module to the project called for example battery support? any idea of the approach of adjusting the PWM value according to the battery level? when for example the nominal voltage of LEDs is 3.3 volts and the battery voltage range is between 3 to 4.2 volts? which means there should be an upper limit for PWM value according to the exceeded voltage (battery voltage - 3.3) and a limited brightness value when the battery voltage is less than 3.3 to show to the user? |
I'd think about the separation when we already have a clear api. It would also depend where are you getting the battery info; is it analog pin, is it some digital interface, etc. But if there is, sure. re. values... just encode it as a 2-value table with specific voltage level <-> multiplier? for example, with 0.1v step (or, through experimentation, where voltage makes the most difference) |
I read the voltage, current, and power by a digital power meter sensor. |
Or another approach could be, as I have the current, that can be possible to store the corresponding current value when the brightness is set and then adjust the PWM value when the battery level changes but in this way, I still need to limit the MAX PWM value to prevent over current problem...! |
I made custom hardware that has 5 PWM channels to control 5 light channels, this device uses a one-cell lithium battery which when is fully charged the voltage is about 4.2 volts and when it's getting empty it can go down to 3 volts. so when the user sets the light brightness to 50% when the battery is full the PWM value should be different than when the battery voltage is 3.7 and when it's 3.2. I should mention that I measure the battery voltage, current, and power of the device with a power meter sensor. so where and how do you think is the better approach to adjust the PWM value based on brightness and battery voltage?
The text was updated successfully, but these errors were encountered: