How to disable ESP32 Dev Kit C V2 ADC completely to reduce current draw

I am using an ESP32 to connect my old (1996) Accenta 8 burglar alarm panel to HA. The panel has 8 pairs of terminals with one of each pair at a nominal 5 volts (~4.6V). The terminals are connected to PIRs in each room which keep the pair normally closed and break the connection on detection. I am connecting the return terminal of each pair to a GPIO pin on the ESP32 via a voltage divider to reduce the voltage from 5V to 3.3V. I am connecting a ground terminal from the panel to GND on the ESP32. I am defining each of the connected GPIO pins as a binary sensor which will show off normally and on if the PIR detects motion.

This works perfectly on the bench with every binary sensor showing on when 5V is applied to the GPIO via the voltage divider and off when the voltage is removed. When I connect it to the alarm panel only 3 of the 8 channels work as expected:

Pins 14,16 and 26 work and pins 32,33,34,35 don’t work. Investigation shows that when connected to 5 volts (via voltage divider) pins 14,16 and 26 are drawing 6.6µA but pins 32,33,34,35 are drawing 6.6mA. The measured current between each pair of alarm panel terminals with nothing connected is ~3µA so I think it can’t handle a higher current draw. With an alarm panel PIR terminal connected to any of pins 32 - 35 the measured voltage between the PIR terminal and ground drops to millivolts.

Pins 32-35 are pins of ADC1 so my assumption is that is why they are drawing significantly more current than the other GPIO pins and my hope is that switching off the ADC in configuration will reduce this current draw. (Space constraints and the need for the voltage dividers make it more convenient to use these 8 pins on the same side of the ESP32).

Does anyone know if this is a correct assumption and if so how to do this?

A max current of 26mA for your alarm panel does seem low.

Note that GPIO’s 34-36 & 39 do not have pull-up/down resistors. So when the PIR opens the circuit the ESP input pins will be floating. This will pick up noise on long cabling runs. You could use physical 10k Ohm pulldown resistors. You can use software pulldown for the other inputs. You may even need 0.1uF caps from each input to GND if the noise is really bad.

Be careful of using GPIO 14. It outputs PWM at boot.

GPIO4, 13 and 16 to 33 should be ok to use.

There is a handy reference table here for the best ones to use:

If it really is the ADC loading down your alarm panel I guess all you can do is avoid those GPIOs.

Thank you for your helpful suggestions and you may well be right that my only option will be to use other GPIO pins.

I have found references to turning off the ADC such as this from Arduino Stack Exchange:

// disable ADC
  ADCSRA = 0;  

or this from an Espressif FAQ:

  • When disabling the ADC interface mode, please use [adc_digi_stop()]

I was hoping that there is a way to include a command to turn off the ADC in my ESPHome configuration file.