NodeMCU v3 two analog sensor with 5v

Maybe someone has a solution of using 2 analog sensors witch need a 5 volts of power supply on NodeMcu?
How can i get separate values from one pin?

I tried to use D0 D1 Digital pins as 3.3v output, but when i connect voltage regulator the voltage drops from pins to 2.1 somehow. Any ideas?

The ESP8266 has only one analog input pin.
If you need more, you need an external ADC chip.
Here is an example project which uses the MCP3002 ADC chip. This may give you an idea how to proceed.

The sole analog input available on the NodeMCU / ESP8266 is 1V max.

It would help if you gave links to the 2 sensors. Also a schematic to explain how you connected voltage regulators and where you measured 2.1V.

Depending on the sensors, there might be a way to use the single adc pin for both.

Other suggestions for adding more adc pins could be to use an analog multiplexer such as 74hc4051 or an i2c adc chip such as ads1115.

runaway_pancake:
The sole analog input available on the NodeMCU / ESP8266 is 1V max.

The ESP8266 module on the NodeMCU has indeed a 0-1volt range,
but there is a 100k:220k voltage divider fitted on the NodeMCU, making it a 0-3.2volt range.
Leo…

Thank you guys for replying, ill add simple scheme.
Im thinking that the problem is that D pins supplies only 12amps and it is not enough thats why i am getting low values.
Voltage drops after i plug sensors in. Measuring on D1 and D2 pins. both sensors are from df robot. ph 1.1 meter and turbidity sensor 1.0

"These are voltage regulators."

Voltage regulators do not boost / amplify.

oh i did a mistake on writing, these are step up/down converters. 2.7-11.8V to 5V. my bad. But now i checked, and the ph sensor seems working fine. The issue is now the turbidity sensor. it doesnt measure difference only giving familiar values and low voltage.

Are you trying to power each sensor alternately with a boost converter that is powered from an output pin?

Wishful/crafty thinking, but it doesn't work that way. An ESP8266 pin can't even support the startup/idle current of the boost converter, let alone the current used by the sensors.

An analogue muxer (74HC4051) could be used to switch between sensors,
but an ADS1115 breakout board could be a better option.
Leo..

I agree this circuit cannot work. Power both sensors directly from 5V and get an ads1115 module to read the signals from the sensors. Ads1115 has 4 analog inputs which are higher quality and accuracy than the ESP's single analog input.

Thank you for help, well ads1115 i think might be a solution.

ADS1015 would also be suitable. Not as good as ADS1115 but cheaper and also better than ESP's analog input.

You can install a library for ads1015/ads1115 from the library manager in the IDE: search for "ADS1X15".

Read the library's documentation.

Assuming you will power the ADS1115 at 5V (so it can read the 0-5V output of your sensors) you will need level shifters such as this one for the I2C bus between that chip and the ESP8266.

Maybe you have a Relay (one with COM, NO, NC (spdt)) ?

wvmarle:
Assuming you will power the ADS1115 at 5V (so it can read the 0-5V output of your sensors) you will need level shifters such as this one for the I2C bus between that chip and the ESP8266.

I got the impression that analog input voltages up to +/-6V were acceptable, but the data sheet says -0.3 to Vdd+0.3V absolute max. That's a pity.

But to keep things simple, you could run the chip at 3.3V and use voltage dividers to reduce the sensor voltages down to, say, 2V max using 10K & 15K, and use the gain setting for 2.048V.

It is ok, i have level shifter so i think it would work fine

Not Fancy,
No ICs Necessary.
Since the NodeMCU has a voltage divider built in, there should be, "ideally", 180kohm between the relay and A0.
That could be a potentiometer or a combination of resistors paralleled for value (1M || 220k).

So to keep things simple i powered up ad1115 from nodemcu, used 10k resistor to create a voltage dividers which worked just fine. Now i do get the values i need.

p.s It would be good lesson for future projects :slight_smile: