3

I'm trying to use a pH probe with NodeMCU, the problem is that NodeMCU is 3.3V and the pH analog sensor requires 5V, at first I thought using the VIN pin but didn't work, then I used the VU pin from NodeMCU V3 (by Lolin) but it didn't give me the right values, like if it missed more power. Is there any other way? Or any esp8266 board which supports 5V into it's analog input?

2
  • Try and get a 5V ADC board that you can talk to over I2C and a 5v->3.3V logic level convertor for the I2C bus. Commented Jul 26, 2017 at 7:03
  • your divider was probably OK after all - some nodeMCU boards don't spit out 5v on VIN. There's not a ton of consistency on nodeMCU devboards but i've found the ones with CH340s to all be deficient in that regard, and all the CP2102s to be good, look for "amica" on the back, and avoid the ones that say "lolin". All the Wemos D1 minis i've tried (about 20 units in 3 variations) work and have 3.3ADCs and 5v VIN, as expected.
    – dandavis
    Commented Jul 27, 2017 at 3:23

4 Answers 4

4

Depending on your specific sensor and power supply setup you have following options:

  1. Change supply voltage
    Most resistive sensors don't have to power anything and will function just fine when supplied with less than 5V. Study the datasheet and make test measurements to find out whether this is suitable.

  2. Use a voltage divider
    Supply the sensor with 5V and use a simple voltage divider before connecting to your MCU and therefore measure 0-3.3V.

  3. Interface another IC
    Get a small external ADC that can handle 5V readings and may be interfaced by any serial protocol supported by your esp8266 (namely UART and I2C).

4
  • I would also recommend using an external ADC for example: link Commented Jul 26, 2017 at 9:33
  • The external ADC is imo the least favourable option as it needs more hardware work (maybe even different casing), MUCH more code and is generally less efficient.
    – mystery
    Commented Jul 26, 2017 at 11:54
  • @mistery Thanks for your answer! Well actually I already tried with a voltage divider, from 5V to 3.3V and worked but just in some cases; I'm using NodeMCU VU pin which supposedly gives 5V, but for example, when pH is lower, the sensor needs more power to give an accurate value, and when this happens NodeMCU stops getting those readings, let's say under 4.80 (in a scale of 0-14) it stops reading analog value changes, so I'm thinking probably NodeMCU can't really provide 5V. My voltage divider is with 1K and 2K, I'm thinking to probably use a Wemos board, it has a 5V pin, what do you think? Commented Jul 26, 2017 at 18:13
  • I still don't know what exact board you have. my idea was to power the sensor from your power supply, not through the chip. You should really study the sensor's data sheet to get an idea of it's behaviour
    – mystery
    Commented Jul 27, 2017 at 10:24
5

The simplest method is just a voltage divider - just as if you were interfacing a 5V logic signal output with a 3.3V input. However it may not work.

A voltage divider will only really be of use if the output of the pH sensor is low impedance. If it's not then you will need a very high impedance voltage divider, and the analog input of the ESP8266 isn't high enough impedance to support a very high impedance voltage divider - it will skew the results horribly.

So you may need to buffer the output of the pH sensor through an op-amp first.

If you use a unity gain non-inverting buffer you can then use a voltage divider to reduce the output voltage.

schematic

simulate this circuit – Schematic created using CircuitLab

Alternatively, as others have suggested, use an external 5V ADC chip and logic level conversion to communicate with the ESP8266.

3

Old topic, but in case it shows up in searches, like the one I was just doing ... I run a 5v ultrasonic SR04 off a Lolin nodemcu, and if you connect to "VU" on the Lolin nodemcu, you will get 5v.

enter image description here

2
  • Tested here with a voltmeter and indeed VU gives 5V. Good one!
    – brasofilo
    Commented Jun 9, 2019 at 3:03
  • 3
    Part of the problem was also reading 5v from sensor
    – Alex G
    Commented May 2, 2020 at 22:42
0

Have you guys checked the specification of the AiThinker's ESP-12s? There's a piece of description in its Chinese edition document that says if you are hooking up other devices which work in 5v, you have to use the Level converter circuit in between. enter image description here

1
  • 1
    the question is about powering, not about Serial comunication
    – Juraj
    Commented Aug 25, 2021 at 5:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.