Analog sensor -> ESP Home -> MQTT -> Node Red

Hello!!!

Would anybody have any experience / recommendation for an I/O device that can handle analog sensors?

The setup I would like.. so far I think.. would be kind of like this:
Analog sensor -> I/O device to configured ESP Home -> MQTT -> MQTT Broker -> Node Red

^^^ I will not be using Home Assistant... I will just talk directly to Node Red.

1 Like

Most of (maybe all?) the microprocessors supported by ESPHome support analogue inputs:

  • ESP8266 : Only GPIO17 (A0) can be used for ADC input. You can also measure VCC voltage directly by setting pin: VCC , useful for low-voltage detection in battery-powered setups.
  • ESP32 : Multiple pins support ADC (e.g., GPIO32–GPIO39 for ADC1, GPIO0, GPIO2, GPIO4, etc. for ADC2). Use attenuation to measure voltages above 1.1V (e.g., 12dB for up to ~3.9V).
  • RP2040 (Raspberry Pi Pico) : GPIO26–GPIO29 are available. You can also measure VSYS via pin: VCC (GPIO29), though it may interfere with WiFi on Pico W.
  • nRF52840 : Supports AIN0–AIN7, VDD, and VDDHDIV5.

(The above from AI so double-check).

What kind of sensor do you want to use?

1 Like

Note: On an ESP32, you cannot (reliably) use ADC2 when WiFi is enabled.

:wrench: Explanation

The ESP32 has two ADC units:

  • ADC1 → works normally, even when WiFi is active
  • ADC2 → is used internally by the WiFi driver

As soon as you enable WiFi (WiFi.begin()), the WiFi subsystem takes control of ADC2, which means:

  • analogRead() on ADC2 pins will not work
  • you may get a value of 0
  • or you may receive error messages
1 Like

You also "bolt" an ADS1115 (16-bit, 4 channel ADC) on to the ESP32 using the I2C bus.
My "go to" microcontroller (at the moment) is the ESP32-S2-Mini or ESP32-C3-Super-Mini.