I’m going to tag along to see how you make out. I struggled with trying to do it, as mentioned in the thread you linked too. I did eventually get it to work but it wasn’t easy. @hel Hel Gibbons may be able to help?
Do you just have the LiPo Amigo connected up via the battery connector? If you want to read the vsys of the Unicorn to estimate the battery voltage I’d expect something like this to work:
Note that as this method measures the system voltage, it won’t report the true voltage of the battery whilst the LiPo Amigo has USB power.
@bablokb I tested the code and also charged the battery for a while, and the battery does not get passed over 70% (if we use the example code from Hel). I suspect that we can never get the correct voltage for this purpose. What a shame! :(
What voltages do you see after a few hours of loading? The AmigoPro is a slow loading device, so it takes some time to load your LiPo.
With my LiPos, I can see up to 4.2V, which is in line what a full LiPo can provide. If you don’t see this voltage, you either have many peripherals that draw a lot of current, or your LiPo is defunct. You should then test with peripherals turned off during measurement.
I’ve left it on charge for over two days and the voltage only fluctuates at 3.84V max as you can see on my here. I only connect it to the cosmic unicorn and even underclock to reduce power consumption.
You should also measure your LiPo without load, i.e. take it out of the system and measure it. This should be about 4.2V. It could be that the voltage you see is from the load that is put on the system by the RGB matrix.
Doing this measurement at different stages of discharge, you can create a curve that will tell you the charge percentage based on your realistic load szenario. In your example the curve would start with 3.83V so this is 100% full. But this is only valid if your LiPo is ok, that is why you should check the “no-load” voltage as well.