How to measure 1.4 - 4.8V on NodeMCU

I want to use a NodeMCU together with 4 analog sensors which report readings between 1.4V and 4.8V. I want to use an ADS1115 to connect all 4 sensors via I2C to the NodeMCU.

However, the NodeMCU can only handle 3.3V. After googling a bit, the recommendation seems to be to use a logic level shifter. Will this one work: https://www.amazon.de/dp/B07HB4MLZY?psc=1&ref=ppx_yo2ov_dt_b_product_details

And can someone tell me how to wire it correctly? I am not sure how/where to connect the 5V power supply from the NodeMCU VIN pin and how to connect the HV pin from the logic level shifter.

This is what I came up with:

Connect Vdd to HV.

So the NodeMCU just connects to I2C - it never sees the analogue input voltage.

Why not run the ADC at 3.3V, and just use potential dividers to tap the 4.8V down to 3.3V ?

1 Like

Do you have the V3 or V2 version of the NodeMCU?

I think v2

Connect the translator board HV to nodeMCU Vin

And then done, rest of the wiring is okay?

Yes, OK

Thanks!

If you can run the A/D at 3V3 and use a resistor divider to get the voltage to the range of the analog input. You can use the MAP function to adjust your range. If you want more accuracy you can add some external electronics to offset the output voltage you are measuring.

See post #3! :nerd_face:

How will that give any more accuracy ?

Maybe @gilshultz meant precision?

1 Like

Your sensors appear to be this type

They have input voltage 3.3 to 5V, so you can run the whole circuit off 3.3V and no logic level shifter or voltage dividers will be needed.

1 Like

In the linked tutorial from that page, it suggests that they have a digital output:

So not even any ADCs required!

@s710 - please provide a link to the sensor(s) you are actually using!

1 Like

Do you mean any voltage between 1.4V and 4.8V depending on the object in front of the sensor, or did you mean either 1.4V or 4.8V depending on whether an object is in front of the sensor or not?

1 Like

Removing the offset but keeping the swing to full A/D range will give more bits available from the A/D ie. less voltage per step.

Yeah, more precision. Not necessarily more accuracy.

Anyway, it's completely unclear what sensors @s710 is using. Analog inputs may not even be appropriate!

1 Like

No, I'm sorry. This is just a placeholder in the graphics, as I didn't have the fritzing part of the actual sensor at hand. I had it once, but didn't find it again, so I just used some 3 pin sensor.
In reality I am using the capacitive soil moisture sensor which reports 1.4V when completely under water and 4.8 when completely dry.
I had measured the sensor when powered at 3.3V, and it does not provide any meaningful readings.

Sorry should have mentioned that in the first post.

I have now completed the circuit as adviced by jim-p, and everything works now. I get good readings for all 4 sensors on the NodeMCU.

Thanks all!

It should. Most of the ones available on eBay, Amazon etc. say they run on 3.3-5V.

Thanks for that apology, it shows maturity, and is appreciated.

@s710 so how about giving details of the sensors you are actually using?
Give a link.