1

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?

  • 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. – Code Gorilla Jul 26 '17 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 Jul 27 '17 at 3:23
2

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).

  • I would also recommend using an external ADC for example: link – Denis Vitez Jul 26 '17 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 Jul 26 '17 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? – Javier Guerrero Jul 26 '17 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 Jul 27 '17 at 10:24
3

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.

1

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

  • Tested here with a voltmeter and indeed VU gives 5V. Good one! – brasofilo Jun 9 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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