squeezelite-esp32
squeezelite-esp32 copied to clipboard
Feature Request: Show battery voltage level on screen during boot
I see in the serial log an entry "battery: Voltage = ...." Is that something that you could show i.e. during boot on an attached display? (i.e while "SqueezeAmp" is showing on the display) That would help to get an idea of the current battery charging level
The battery level is available on LMS, in the player's information
Thanks, for the hint, philippe44. I use that as well - but still think to have this information right on the attatched screen during boot up would be beneficial. At least in my usecase: Go to the player, switch it on and check battery voltage ( -> charge level) . One stop shopping; no additional buttons to press, apps to check etc. As the batteries are good for several hours music streaming at moderate volume setting, checking battery level once at boot up would be sufficient. As always: Thanks to both you guys fordoing this project! Such a great firmware - such a great player (SqueezeAmp)
FYI, I have a working modification of MusicInfoSCR with wifi and battery icons. I've asked @mherger if he is willing to add the changes to his original, or if I need create a separate branch.
That's a lot of information around that artwork 😀!
MusicInfoSCR 4.5 is now released (Thank you @mherger).
For those that are not aware, Michaels' excellent Music Information Screen LMS plugin allows for customization of the Now Playing screen with extra information. The latest version adds icons for Hardware Status to display the Wifi signal strength and battery voltage.
There are two battery scales that are selected automatically; A standard single cell Lipo (3.3-3.9), and a 3-cell NiCad (11.4-12.6) tested on my SqueezeAmp +3*18650 with @philippe44 pre-configured configuration settings. NOTE: The latter is set to show empty at 11.4V, which is a long way from processor failure, but at the point when the amplifier quality is affected. You can use the NVS parameter "bat_config' scale parameter to tweak the reported voltage if required.
@heinerolli et-al. Please give it a go and provide feedback where necessary.
P.S. @sle118 do you think we should add something to the README?
Thanks! I am currently away from home for a couple of weeks, but when I am back, I will try it Thanks again, Heiner
Am 04.09.2023 um 14:22 schrieb wizmo2 @.***>:
MusicInfoSCR 4.5 is now released (Thank you @mhergerhttps://github.com/mherger).
For those that are not aware, Michaels' excellent Music Information Screen LMS plugin allows for customization of the Now Playing screen with extra information. The latest version adds icons for Hardware Status to display the Wifi signal strength and battery voltage.
There are two battery scales that are selected automatically; A standard single cell Lipo (3.3-3.9), and a 3-cell NiCad (11.4-12.6) tested on my SqueezeAmp +3*18650. NOTE: The latter is configured to show empty at 11.4V with @philippe44https://github.com/philippe44 standard settings, which is a long way from processor failure, but at the point when the amplifier quality is affected. You can use the NVS parameter "bat_config' scale parameter to tweak the reported voltage if required.
@heinerollihttps://github.com/heinerolli et-al. Please give it a go and provide feedback where necessary.
P.S. @sle118https://github.com/sle118 do you think we should add something to the README?
— Reply to this email directly, view it on GitHubhttps://github.com/sle118/squeezelite-esp32/issues/208#issuecomment-1705176412, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI5C4EULFA3UBWOSTIIPMTDXYXBZZANCNFSM6AAAAAASMQ36BU. You are receiving this because you were mentioned.Message ID: @.***>
I don't see the battery level... What am I missing?
You need to use music info scr plugin and enable it in player's settings (basic or display o don't remember)
It is not in "Basic" and apparently the squeezeesp32 does not have "Display".
When I issue a "status" via the CLI it doesn't seem to report the battery status. Maybe I need some settings on the board itself but I can't find any info.
oh, that only works if you have a display so I guess this is not what you want
Do you have your battery configured in the NVS settings? (https://github.com/sle118/squeezelite-esp32#battery--adc)
as @philippe44 mentions, you then need to have the plugin installed and configured in the Basic settings
Of course, you do need a Display installed and configured to see it!
I've seen that link but I have no clue what to enter in the bat_config. It needs a channel (no idea), a scale (?) and the choice between two and three cells. I have a single-cell LiPo..
You need to check your hardware schematic and see if there is a battery voltage sensor input.
EDIT: Analogue GPIO inputs have an ADC channel number. The attenuation is an esp32 ADC input scale. The scale is just a tweak/tuning value. Most of this is trial an error unless your using one of known platforms
the README https://github.com/sle118/squeezelite-esp32#battery--adc is your friend
@wizmo2 I have an ESP32 Audio Kit
You maybe out of luck. I was using one of these and I don't think VBAT is connected to any inputs. You could double check on the forum and see if anyone else has figured it out. There are few different versions of these boards too.
Yeah that board is a mess. Look at schematics but if in the example of the README I've not included the battery information it's probably because there is no connection. You'd have to jump one
When I set bat_config to channel=2,scale=1,cells=1 I get readings in the log file of around 0.10V. It's a start ☺.
(https://docs.ai-thinker.com/_media/esp32-audio-kit_v2.2_sch.pdf)
have a look at the schematic above. IO34/Channel 6 may be a good start.
Why we call these DIY projects ;) Good luck
Thanks for the suggestions. This is really not my field of expertise...
With channel 6 I only get 1.
BTW: I'm surprised to find out it is still running after 12 hours. I would have expected just a couple of hours on such a small battery.
After studying the schemata et al a couple of conclusions (so far).
- Squeezelite-ESP32 can monitor battery on ADC1 only.
- The chip on the board seems to have three channels on ADC1: Channel 0 (GPIO36), 3 (GPIO39) and 6 (GPIO34). GPIO39 (SEN_VN) is used for headphone detection, GPIO36 and GPIO34 are not connected according to the schema but they are connected on the board. I can't trace the connection since it disappears under the chip. And, unfortunately, neither of them is exposed on a header.
I have on intentions to solder wires directly to the chip so unless anyone comes up with new ideas it stops here.
The ADC channel limitation isn't specific to our project; it is a limitation of the ESP32 itself, which requires one of the ADC channel to be allocated to the wifi circuitry when in use. As for the Audio Kit, you are out of luck unless you are willing to solder 2 resistor in a voltage divider arrangement since the design of the board doesn't include one for measuring voltage. Setting up the battery nvs option here will result in measuring from a floating pin or from a pin that is pulled up/down on the circuit board itself.
Thanks for the clear explanation.
I've added a voltage divider ( 2 x 100K ) to BAT+ and BAT-, and connected the mid point to pin5 GPIO34. After configuring bat_config to channel=6 I get solid 1 reading.
I tried pin4 GPIO36 and channel 0, same result - a solid 1 reading.
According to the specs the input for ADC1 should be between 0 and 3.3V. Dividing the battery voltage by two should be safe.
Do you know what I have to enter for cells?
It is used to convert voltage in % (roughly). So it's the number of LiIon cells in serie this board has, which is one I assume.
It's a small battery so I assume 1 cell (3.7V). But the docs say the mandatory and the only choices are 2 and 3.
channel=0..7,scale=<scale>,cells=<2|3>[,atten=<0|1|2|3>]
Indeed, it could be 1. I'll correct that. Bear in mind that battery % evaluation is not great, to say the least
Indeed, it could be 1. I'll correct that. Bear in mind that battery % evaluation is not great, to say the least
and this is mainly due to the voltage discharge curve, which isn't constant from battery to battery.
The only precise way to measure battery percentage is to have a coulomb counter that measures the charge in and charge out. Measuring voltage is a "good enough" proxy but far from being ideal.
Reminds me of my old Psion 3a. It did not measure the batteries voltage, but kept track of the amount of energy used.
Currently I would already be glad if I had any reading... It stays solid 1 (same as if not connected). Strange.
How much do you have on that input using a voltmeter? Reading a 1 would seem to indicate that it is still configured a a binary gpio.