[D32] VBAT adc clarification
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- arduino
- Domain
- documentation, embedded-iot
Research direction
Locate the D32 documentation and the schematics referenced in the issue, then compare the documented GPIO and charging connections with the hardware. Update the text with the VBAT divider, GPIO35 reading method, current, and CHRG connection; clarify whether the listed hardware improvements are in scope.
Written by the indexing model from the issue text.
Description
this is missing in the text and needs to be read out from the schematics.
the VBAT is connected over a voltage divider (100k/100k) to GPIO35. (maximum current of 21.5µA)
the CHRG pin is not connected to a gpio (but a vbus powered led)
following a sample sketch to get the VBAT:
#include <sys/time.h>
#include <Arduino.h>
//#define LOG(fmt, ...)
#define LOG(fmt, ...) (Serial.printf("%09llu: " fmt "\r\n", GetTimestamp(), ##__VA_ARGS__)); Serial.flush();
//#define DEBUGLOG(fmt, ...)
#define DEBUGLOG(fmt, ...) (Serial.printf("%09llu: [DEBUG]" fmt "\r\n", GetTimestamp(), ##__VA_ARGS__)); Serial.flush();
int64_t GetTimestamp() {
struct timeval tv;
gettimeofday(&tv, NULL);
return (tv.tv_sec * 1000LL + (tv.tv_usec / 1000LL));
}
void setup() {
Serial.begin(115200);
Serial.flush();
if (adcAttachPin(35)) {
LOG("[SYSTEM]ADC attached!");
}
}
void loop() {
unsigned int millivoltage = analogReadMilliVolts(35);
int VDRatio = 2;
LOG("[SYSTEM] VBAT: %.2f V", (millivoltage * VDRatio/1000.0));
delay(5000);
}
and the serial output:
001415884: [SYSTEM] VBAT: 4.22 V
001420887: [SYSTEM] VBAT: 4.22 V
Improvements:
- make the CHRG pin available
- make the CHRG led optional
- disconnect the VBAT voltage divider with a p-mosfet
- connect the PROG over a p-mosfet to ground for disabling the charge circuit
- Dominant language
- No language data
- Stars
- 38
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wemos/docs
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·