i have my esp32 module in deep sleep and i use it with a couple of buttons using a wake up that detect the button pressed now i'd like to have a battery level to send to a server right before going back to deep sleep. How can i do it? and what cheap rgb led do you suggest using?
Using "battery level" (voltage) is poor way to monitor its useful life. Battery discharge characteristic varies with its technology. On the other hand many electronics devices are very tolerable as far as "supply level " AKA voltage.
RGB LED light intensity can be made to monitor different voltage, however, I fail to see how you propose to send the LED intensity level /state to other device.
As I pointed out - the battery useful life depends on technology. You mentioned AAA , hence I assume alkaline battery. Then I would suggest software solution. Let the server monitor the actual running time of your device.Then measure or calculate the load your device is drawing from the battery. Then determine or calculate the discharge curve of your battery and let the server "output" the battery life / discharged level in relation to time. Perhaps I misunderstood and you actually wanted the RGB LED to be connected to the server. Then you can display green LED up to 80% of battery life and so on ...Keep in mind that the discharge curve is pretty abrupt at the end of battery useful life,