• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Get battery level

Q&A Forum › Category: ESP8266 › Get battery level
0 Vote Up Vote Down
Hugo Articardi Calabrese asked 6 years ago

Hi Roi, hope you are fine.
Do you know haow to get battery level measure  ???
Thanks in advance… best regards. Hugo.

4 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi Hugo.
We have a project with LoRa in the ESP32 course that gets battery level.
You can take a look at that project here: https://rntlab.com/module-11/esp32-lora-sender-solar-powered-part-4/
You can also see our resources about that project here: https://github.com/RuiSantosdotme/ESP32-Course/tree/master/code/LoRa_Project/LoRa_Sender
I hope this helps with your project.
Regards,
Sara 🙂

0 Vote Up Vote Down
Hugo Articardi Calabrese answered 6 years ago

Thank you Sara for your help.
Best Regards. Hugo.

0 Vote Up Vote Down
Brian Webb answered 6 years ago

If we wanted to get the battery leval as a voltage value rather than a % what should we do?

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

In line 133 of the code https://github.com/RuiSantosdotme/ESP32-Course/blob/master/code/LoRa_Project/LoRa_Sender/LoRa_Sender.ino you should use something as follows:

batteryLevel = map(analogRead(batteryPin), 0.0f, 4095.0f, 0, 3.3);

Instead of mapping to a range of 0 to 100, you use a range of 0 to 3.3V
I haven’t tested this, but I think it should work. However, I don’t know if it will be very accurate.

Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.