Wemos A0 does not read voltage

srozemuller:
I've just tried the VCC mode. But that show's the internal voltage and is not the same as the powerlevel of the battery. The battery supplies 3.7 volt, the internal volt now is 2.89.

That sounds quite reasonable: there's a voltage regulator on board. I did a quick search on what regulator the WeMOS mini uses, it seems older boards use the AMS1117-3.3 which has a 1.1V minimum dropout; the newer boards have a RT9013 which has a much lower dropout of just 250 mV.

The values you give are consistent with the AMS1117-3.3 regulator of the older boards, which would give a 4V battery output, which is very reasonable for a near-fully charged LiPo.

By the way, are you sure about that 3.7V? That's the nominal value of a LiPo battery but the real output is usually somewhere between 3.2V and 4.2V depending on the charge. Did you measure that with your multimeter?

wvmarle:
By the way, are you sure about that 3.7V? That's the nominal value of a LiPo battery but the real output is usually somewhere between 3.2V and 4.2V depending on the charge. Did you measure that with your multimeter?

I did a measure with the multimeter on the + of the battery and tells me the battery is providing 3.7 volts, this could be fine because the battery isn't fully charged.

westfw:
Not ALL microcontroller ADCs have high input impedence, and they CAN be affected by using a series resistor with too high a value. IIRC, some of the 8bit PICs have an input impedence of ~10k - using a 100k series resistor would be a very bad idea on one of those.

So the situation where im in now is not ok? Using a 100k resistor between the + and the A0.

6v6gt:
Here is an example which includes a battery voltage monitor. Interestingly, it includes a pinMode() statement for A0.

pinMode(A0, INPUT);

Usually, this would not be necessary but maybe worth a try.
Certainly, based on your attempts to use the VCC mode, the ADC is still working.

I also tried the INPUT way but doesn't make sense. As PaulRB said, the most sketches i saw doesn't have a Pinmode either.

BTW nice to hear the ADC is not broken, so there is something else why the output is always the same.

Another thing i was wondering:
Does a connected USB to the laptop affect the reads?

I also thought I remembered seeing rt9013 regulators on Wemos mini schematics. But if you check their website now, all current and previous versions of the mini and mini Pro use me6211.

I don't think they ever used ams1117, unless that was the D1 or D1R2 (the Uno size boards).

Maybe you were thinking of the nodeMcu boards?

I also thought I remembered seeing rt9013 regulators on Wemos mini schematics.

Aren't the WeMos boards about as heavily cloned as Arduino Nanos ? The official schematics could easily say one thing, while random clones have some other regulator that the vendor just happened to have on hand...

So the situation where im in now is not ok? Using a 100k resistor between the + and the A0.

100K is good. I use 180K which gives a slightly higher range of voltages that can be read. But 100K should work well. If the ADC on the chip is working, perhaps the voltage divider or the PCB tracks are faulty on the Wemos board.

Did you try that pot yet?

westfw:
Aren't the WeMos boards about as heavily cloned as Arduino Nanos ?

True. Certainly for the Mini. I've not heard reports of clones of the Mini Pro, but I guess there probably are.

@srozemuller, can you post the link where you purchased the mini Pro? The only place I know for sure you can get genuine Wemos is the Wemos shop on AliExpress. There is a link to that on the Wemos site.

Hello Paul, no i dont have a pot to test with.
I've purchased the Wemos at Ali indeed.

link to wemos

Correctly posted link.

PaulRB:
I don't think they ever used ams1117, unless that was the D1 or D1R2 (the Uno size boards).

Maybe you were thinking of the nodeMcu boards?

No, had a quick look at some forums, maybe mixed up the different types of WeMOS boards.
NodeMCU indeed also uses the AMS1117, great advantage being that you can supply it with 12V. The RT9013 can't handle that voltage.

So i have to calculate +1.1 v at the vcc?

srozemuller:
Hello Paul, no i dont have a pot to test with.

Then just use two resistors of the same value. One from A0 to GND and the other from A0 to 3.3V. You should get a reading of around 500 from analogRead().

srozemuller:
I've purchased the Wemos at Ali indeed.

Ali is a market place, like eBay or Amazon. Many vendors sell similar items and many of them are clones. Your link is to an item that is not in the Wemos shop, so it could be a clone. To find the genuine Wemos parts, you should go to the page for the Pro Mini on Wemos' website and click the "Buy" button. The Wemos shop is called "LO_LIN". Your link has a different vendor name.

wvmarle:
AMS1117, great advantage being that you can supply it with 12V. The RT9013 can't handle that voltage.

True, but the ams1117 has a droput voltage of 1.1V and quiescent current of 5mA, making it a lousy choice for small battery powered circuits. By comparison, the Wemos' me6211 regulator had a dropout of only 0.25V and a quiescent of only 40uA.

srozemuller:
So i have to calculate +1.1 v at the vcc?

What do you mean?

Well, because of the different regulators on the wemos and the droputs. Can i make the conclusion my Wemos is using the old ams1117 with a droput of 1.1V?

The built-in measurement will measure Vcc, not the actual battery voltage. The two are not necessarily the same - and generally are not when there's a regulator in play.

After some investigation on the forum this thread came on the radar.

there i found this part

You are measuring the output of the 3.3V regulator on the Wemos, so you get answer of 3.3V. Use the A0 pin with a 180K resistor connected to the 5V pin. The Wemos has a voltage divider on the board which allows voltages up to around 3.3V to be measured. The 180K will extend this to around 4.7V.

it seems i have a mistake in the wiring. Instead of connecting the 100k resistor directly to the battery it have to be connected on the 5v on the Wemos. For now i did some quick test and voila there where some 1024 results. So it seems the A0 is working properly.

Now doing some solder work, will keep you posted.

Instead of connecting the 100k resistor directly to the battery it have to be connected on the 5v on the Wemos. For now i did some quick test and voila there where some 1024 results. So it seems the A0 is working properly.

I can't understand what you mean, and it doesn't sound like the reason for the problem to me. Can you post a schematic showing how you had the 100K connected before, and a schematic showing how you have it connected now?

To get a reading of 1023 (you shouldn't see 1024 at all) you can also connect the A0 directly to the 3.3V.

Sorry for the typo. 1023 it is.

Ive uploaded 2 pics, before and after. Hope this will make it clear.

Image 503.png

Neither is a complete circuit.