Wemos d,onboard voltage converter, check if reduce?

Hello everyone

In the last few days i read a lot of the Analog input voltage converter.

So I know, that the wemos d1 has a onviard voltage converter.

If Andy device is connected to A0 and GND, the wemos can read the voltage from the external device, BUT not in voltage. The ADC gives a binar code.

1V input gives the value 1023
500mv gives 512 ADC

If the device use more than 1V, the voltage converter change the ratio
Before 1V = 1023 ADC
So 1mV = 1,23 ADC

If more than 1v input

3.3v is 1023 ADC
So 1mV = 0.31 ADC

Okay. Now my problem:

My anemometer (weather station) produce mV, if the wind spin it.

If the wind is not so fast, it produce only a few mV... like 500mV
But if the wind is very strong, it can be produce more than 1V (max 2)

My script detect the ADC and calculate it to Voltage. The voltage can be calculate to the wind speed and so I know the speed of the wind.

Rhat wirks great.
But i found a little mistake in my idea.

When the wind blow and the anemometer spin and produce 416mV it will be show 512ADC

But
When the wind blow strong, and it will be produce 1.65V, the ADC is 511.
:exploding_head:
Thats the same ADC..... you understand...
Know i need to know, if the voltage reducer set 3.3v to 1023, or 1c to 1023

I am assuming you have a voltage divider in the analog section of the circuit. You need to change the divider ratio as the voltage increases. Basically you are making an automatic voltmeter. The Arduino has control of the division ratio and can change its conversion formula accordingly. Post an annotated schematic and we can check it for you.

There is a built-in voltage divider. A 3V input is scaled to 1V (the ADC's limit).
image
Also, note that the ADC isn't linear (esp. near Vmin and Vmax).
You can add another resistor in series with the "A0" input (another 220k) to make it a "5V" input.

how can i detect, when the wemos change the ratio??
i use it as voltmeter.
i don't want to use a second voltmeter to check if the volts are more than 1V

my idea is not so good.....
i think it would be work with two extra resistors
if i add a 200ohm and 100ohm resistor to the anemometer cable, i will reduce the vltage to 1.
so it would be always: 1V = 1023

for example:
i use 2V in:
the resistors reduce it to 0,6666666666666666V

if i use 1V in:
the resstor reduce it to 0.333333V

the final value is to re-calculate it with the two resistor value. they are static.....

image

Did you mean i should only use 1 extra resistor in the cable? and put it in the plus side? the minus cable only direct to ground?

do i understand it correct?
you put a second resistor behind.
So the calculating is like this:

Vin = (Vout x R2 ) / (R1 + R2)
Vin = (3.3V x 100)/ (440 + 100)

440 is the sum from the wemox resistor(220ohm) + the extra resistor on the plus side

Parallel R2 with a second resistor that goes to the drain of the MOSFET, reason for the MOSFET is to protect the Analog input. When the MOSFET is off you would be in your sensitive range, with it on you will have less sensitivity but you can take more volts. The attached circuit is a programmable gain amplifier. Remove OA1 and R3 for your circuit. Then you would size R1 for your low voltage and R2 in parallel with R1 for your high voltage. The mosfet can be driven by one of the digital pins.

image

that looks great, but i think it's to dfficult for me.....
the option with a second resistor in the plus cable looks easier for me(newbie), but i think your idea is really great, cause i can control it with a digital output. but that is to much for me.

@anon85221860
Is that correct?
I would try this. Can I use a 1/2w resistor? Ist that enough ???
Thank you

Yes.

Yes.

thank you!
how can i calculate the minimal watt of the resistor?

Power is voltage X current.
With 5V applied (as previously mentioned). there will be about 2V across the 220k (each) and 1V across the 100k.
That results about 10 microAmps.
2V * 10 microAmps = 20 microWatts.

1/8W resistors will be fine, 1/4W resistors will be fine, 1/2W resistors will be fine.

thank you !!

5v cause i run the wemos d1 with 5v, correct?

No.

i tried this

it is really strange...

if i connect a 1.2V battery directly to the wemos, i get 397 ADC
if i use a extra resistor with 220ohm, i also get 397 ADC.

I thought the extra resistor should reduce the voltage from 1.2 to 0.2V

3.3V will give 1023
You don't need any resistors!

I thought there was a concern about inputs greater than 3V (4V ).

And the resistance values involved are kohms -- kilohms

i know it!

i need to recalculate the ADC from the wemos to voltage.

for example:
when i get 2.2V input i will get 682 ADC.

so i can recalculate it with 682ADC * 0,31 = 2.2V perfect.

BUT:
if i get less than 1V, the calculating factor is 1.23.

Because, if the input is less than 1V: --> 1V = 1023 ADC

so, if i get 0.8V input i will be get 984 ADC.
To recalculate the ADC i need to multiplicate it with 1.23

What can i do, when i don't know if the input is more or less then 1V.
how can i know the multiplicator factor, to recalculate the voltage????