<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ESP32-C3 T-OI Plus. Reading battery level]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I'm working on a project where I need to know the charge level of the battery mounted in the ESP32-C3 T-OI Plus (Ver 1.3).<br />
From what I see on the schematic, Vbat is connected to the ADC input through a resistive divider made up of two 100K resistors that cut the voltage in half.</p>
<p dir="auto">Building on that assumption, I'm using the following Micropython code:</p>
<p dir="auto">...<br />
#adc<br />
a0 = 2</p>
<p dir="auto">conversorAD = ADC (Pin(a0))<br />
conversorAD.width (ADC.WIDTH_12BIT)<br />
conversorAD.atten(ADC.ATTN_11DB)<br />
...<br />
def leerBateria ():<br />
#Reads the battery charge percentage<br />
batVolt = 2*(conversorAD.read_uv ()/1000000)<br />
if (batVolt &gt; 4.2):<br />
batVolt=4.2<br />
return (100*(batVolt/4.2))</p>
<p dir="auto">I think it is correct because it reads values ​​consistent with the battery voltage measured with a multimeter.<br />
What catches my attention is the variability of the values ​​read, for example if I read every 20 seconds I can have (with USB connected)</p>
<p dir="auto">Bat =  99.57<br />
Bat =  98.67<br />
Bat =  99.57<br />
Bat =  100.00</p>
<p dir="auto">What could this variation be due to?</p>
<p dir="auto">Thankfully,<br />
Ernesto.</p>
]]></description><link>https://www.community.lilygo.cc/topic/198/esp32-c3-t-oi-plus-reading-battery-level</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 01:19:59 GMT</lastBuildDate><atom:link href="https://www.community.lilygo.cc/topic/198.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 24 Mar 2023 14:48:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ESP32-C3 T-OI Plus. Reading battery level on Fri, 24 Mar 2023 22:33:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/617">@etolocka</a> Well, Ernesto, if the returned value is saying that the battery is 100% of 4.2 volts...I think you are THERE!<br />
I do not use Python, have a board like yours or ever monitored battery voltage, so I am no expert, it looks like you are OK!<br />
-Terry</p>
]]></description><link>https://www.community.lilygo.cc/post/473</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/473</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Fri, 24 Mar 2023 22:33:42 GMT</pubDate></item><item><title><![CDATA[Reply to ESP32-C3 T-OI Plus. Reading battery level on Fri, 24 Mar 2023 19:26:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> Thank you!</p>
<p dir="auto">Am I interpreting the schematic correctly and is the voltage calculation also correct?</p>
<p dir="auto">Thankfully,<br />
Ernesto.</p>
]]></description><link>https://www.community.lilygo.cc/post/472</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/472</guid><dc:creator><![CDATA[etolocka]]></dc:creator><pubDate>Fri, 24 Mar 2023 19:26:28 GMT</pubDate></item><item><title><![CDATA[Reply to ESP32-C3 T-OI Plus. Reading battery level on Fri, 24 Mar 2023 17:34:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/617">@etolocka</a> The ESP32 is notoriously bad at ADC function, so...this is just a rough estimate of your battery life, 'for your information'</p>
]]></description><link>https://www.community.lilygo.cc/post/471</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/471</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Fri, 24 Mar 2023 17:34:32 GMT</pubDate></item></channel></rss>