Posted on
• By default if call analogRead();
i get

=0.00391006842

=0.14662756598

Question how from this data i can restore 0.49v

• I suggest that you provide 0.00, 0.25, 0.50, 0.75 and 1.00 Volts and analog read each of them. You should get something linearly related to the voltage applied. If not, analog read is not doing anything for you... (anymore? ...may it is already be 'gone' due to having given it > 1 or 3.3V?)

How to create these voltages?

3.3V ------+------------------+--------------­-------
|    ^             |
.-.   |             |
R1 | |   |             |
100 Ohm | |   |             |
'-'   |2.3V         |
|    |             |
.-.   |             |
R2 | |   |             |
2.2K Ohm | |   |             |
'-'   V             |    NodeMCU
|  -------       .-O------------------.
|    ^           | 3.3V               |
.-.   |1.0V       |                    |
R3 | |   |           |                    |
Potentio- | |   | ^         |                    |
meter '-'   | |variable | GND                |
|    | |0..1.0 V '-O------------------'
|    V V           |
GND -------+------------------+-------------­--------

I assume you have a multi-meter to measure the voltage produced by the voltage divider established by the resistors R1, R2 and R3. If not - but with decent tolerances of the resistors (2..5%) - you can guess by the position of the wiper about what voltage between 0 and 1 Volt to expect.

• Yes i have to LitiON battarey, have to input to my (DC-DC get 8.0V => Ouput 5.0V), i create from input with 2 resitors 0.49 volt. (10kOm and 1kOm) i need getting lition battarey voltage...

• I specified 3.3V to look at... not 8.0V. Grab 3.3V output from NodeMCU board, then you are safe. A single value is not good enough... use multiples. If you have only 10k and 1k resistors, play around with multiple combinations always making sure that A0 input is never above 1.00 V. Since the input impedance of A0 is so high compared to your resistors, the voltage is proportional to the resistance from GND to A0 over total resistance from GND to 3.3V. For example, with 10 K and 2 x 1 K: 3.3V x 2k / 12k = 0.55V; with 1 x 1 K: 3.3V * 1 K / 11 K = 0.3V; with 3 x 1 K: 3.3V x 3K / 13K = 0.76V; and with 2 x 1K parallel:

3.3V * (1 / ( 1/1K + 1/1K)) / (10K +   (1 / ( 1/1K + 1/1K)))
= 3.3V * 0.5K / 10.5K
= 0.16V

• From my voltage divider i get not more that 1V.. every time 0.45-0.80

A input to 5 Volt input

4 Attachments

• • • • • What are the analog read values for 0, .45 and .67 Volts? (0 volts: connect A0 to GND).

• Thanks all i found answer for my question

1 Attachment

• • Great work...

• Post a reply