Measuring Battery Life

AgentSmithers
Posts: 123
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Measuring Battery Life

Postby AgentSmithers » Mon Jul 23, 2018 8:44 am

Hi everyone, I am using the Wemos D1 Mini Pro. I just want to reach out and make sure I'm going down the correct path by setting my 107th byte in my init.bin and also I call system_get_vdd33 to get an arbitrary value depending on my battery correct?
The batter will be connected to pin 3v3 and gnd.
https://wiki.wemos.cc/products:retired: ... pro_v1.1.0
Thanks!
-Agent

AgentSmithers
Posts: 123
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Re: Measuring Battery Life

Postby AgentSmithers » Tue Jul 31, 2018 12:06 am

Anyone?
Thank you!

blubb
Posts: 109
Joined: Mon Jun 22, 2015 5:35 am

Re: Measuring Battery Life

Postby blubb » Wed Aug 01, 2018 8:37 pm

Why not just try it?

The 107th (0x6B) byte has to be 0xFF.
system_get_vdd33() returns the voltage in 1/1024 Volt.

So calculate system_get_vdd33() * 1000L >> 10 to get the battery voltage in mV.

It works here... (ESP-01)

AgentSmithers
Posts: 123
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Re: Measuring Battery Life

Postby AgentSmithers » Thu Aug 02, 2018 12:18 am

blubb wrote:Why not just try it?

The 107th (0x6B) byte has to be 0xFF.
system_get_vdd33() returns the voltage in 1/1024 Volt.

So calculate system_get_vdd33() * 1000L >> 10 to get the battery voltage in mV.

It works here... (ESP-01)


That's interesting. Do I need to put a voltage divider for this example? After reviewing the command it seems it pulls from
Pin 3/4 aka VDD3P3
https://wiki.wemos.cc/_media/products:d ... v1.1.0.pdf

This here above shows those are Pins GPIO 16 (D0) and 14(D5) . Do both these pins detect a voltage somehow or do I have to add a Voltage + to one and GND to another?

blubb
Posts: 109
Joined: Mon Jun 22, 2015 5:35 am

Re: Measuring Battery Life

Postby blubb » Thu Aug 02, 2018 12:26 am

system_get_vdd33() directly measures the supply voltage. No other pins are required for this. The SDK manual also says that TOUT pin needs to be suspended. I am using the very simple ESP-01 modules. I have no idea what they did to that pin, but it works just fine.

AgentSmithers
Posts: 123
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Re: Measuring Battery Life

Postby AgentSmithers » Thu Aug 02, 2018 12:46 am

blubb wrote:system_get_vdd33() directly measures the supply voltage. No other pins are required for this. The SDK manual also says that TOUT pin needs to be suspended. I am using the very simple ESP-01 modules. I have no idea what they did to that pin, but it works just fine.


Gotcha, So TOUT for me I think is A0 on my board. Can't tell from the Schematic directly but I think that's the pin it is talking about. I just need to leave it floating.
So Basically I need to hook up my device via battery to 3.3 and GND then make sure my default.bin offset 107 is set to FF then run the command and see what I get.
Correct?

AgentSmithers
Posts: 123
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Re: Measuring Battery Life

Postby AgentSmithers » Wed Aug 08, 2018 2:52 am

blubb wrote:Why not just try it?

The 107th (0x6B) byte has to be 0xFF.
system_get_vdd33() returns the voltage in 1/1024 Volt.

So calculate system_get_vdd33() * 1000L >> 10 to get the battery voltage in mV.

It works here... (ESP-01)



Blubb,
How does your logic work
Do you take the value returned by vdd multiply it by 1000 then bitshift it over 10 bits?
I am unsure on how that will return the mV, Can you enlighten?
Thank you!! =)

blubb
Posts: 109
Joined: Mon Jun 22, 2015 5:35 am

Re: Measuring Battery Life

Postby blubb » Wed Aug 08, 2018 6:51 pm

Then just write

system_get_vdd33() * 1000L / 1024

Same result (because 1 << 10 == 2 ^ 10 == 1024)

Who is online

Users browsing this forum: Baidu [Spider] and 14 guests