Measure unknow resistor wemos d1 mini

I just started my first real use arduino project. I want to measure a (unknow) resistance. With the arduino uno and the following simple code it is working great. Showing 10Ω when i put a 10Ω resistor in.
However when i try to do de same on the wemos d1 mini it doesn't work: Serial is just showing R2=0

Wires and pins connected the same way for both boards ():
5V to unknow (10Ω) resistor
unknow (10Ω) resistor to A0
and a 100Ω resistor between A0 and GND


int analogPin = 0;
int raw = 0;
int Vin = 5;
float Vout = 0;
float R1 = 100;
float R2 = 0;
float buffer = 0;

void setup(){

void loop(){
  raw = analogRead(analogPin);
    buffer = raw * Vin;
    Vout = (buffer)/1024.0;
    buffer = (Vin/Vout) - 1;
    R2= R1 * buffer;
    Serial.print("Vout: ");
    Serial.print("R2: ");


Can't do that, because the WeMos has a 3.3volt processor. All logic/connections should be to 3.3volt.

The WeMos has an absolute/voltage A/D (vs. a ratiometric A/D of an Uno).
Resistance measurements won't be reliable/accurate/stable.
And the WeMos has a 100k:220k voltage divider on the analogue input, which complicates things more.

Stick to the Uno for resistance measurements,
or connect an external ratiometric A/D to the WeMos.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.