OLIMEX / ESP32-C3-DevKit-Lipo

ESP32-C3-DevKit-Lipo RISC-V development board with USB, JTAG, WIFI, BT5, LiPo battery charger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPIO 3 and GPIO 4

elpiel opened this issue · comments

I see that GPIO 3 has a voltage divider connected to the battery and GPIO 4 is for power sensing of the 5v.

Could you explain how these pins can be used for reading out the battery measurement and the external power?

Especially what are BAT_PWR_E1, BAT_SENS_E1 and PWR_SENS_E1? And how they can be used.
I tried reading them with ADC but I believe that I'm missing out something because I always get 2000 (with 11db atten. set up).

Edit: I saw in the schematic that it's a jumper and it's on the backside of the board.
What jumper should I put there?

By default both external power sense and battery measurement functions are not enabled. To enable external power sense you need to close jumper PWR-SENS_E1 (solder its pads together), then use GPIO4 for monitoring.

Same for battery measurement but you need to close two other SMT jumpers, BAT_PWR_E1 and BAT_SENS_E1. After closing the jumpers use GPIO3 for measurement.

We have code for another board, just put the proper GPIOs:

https://github.com/OLIMEX/ESP32-POE/blob/master/SOFTWARE/ARDUINO/ESP32_PoE_PowerReading/ESP32_PoE_PowerReading.ino

ADC power sense & battery measurement

Great! I did solder them but now I always get a value of 4095 on the ADC reading with 11db attenuation.

3.3V_E1

There's another enable jumper, would you mind telling me when should I use it? It's connected to the debug

PS: It's good to mention that I have the Rev A.

Did you try the code I linked with:

#define POWER_SENSE 4
#define BATTERY 3

Usually you would never need to close 3.3V_E1. It is used when you want to power your ESP32-C3-DevKit-Lipo board from the ESP-PROG1 connector, but you usually power the board from the USB. ESP-PROG1 connector fits ESP-PROG tool:

https://www.olimex.com/Products/IoT/Programmer/ESP-PROG/open-source-hardware

Yes, I did check it, however, I'm using Rust and I also asked in the esp-rs matrix, it appears that they currently don't do calibration in the HAL (hardware abstraction layer) crate and documentation on this is very scares to implement it.
This is the cause of the issue.

Would be nice to mention GPIO3 & GPIO4 in the docs as well (and how to enable them - with soldering the jumpers).
It's a very useful feature to have battery measurement and power sense the way you've added it on the board.