One ESP32 pin goes high - the rest go low

This maybe be more appropriate for an ESP32 forum, but since it includes my YAML config file, I thought I should start here.

The short version is I have a series of 8 sensors (some labelled switches, but they’re actually sensors like the rest) that connect to GPIO pins. In testing, I started with only 1 or 2 actually connected to switches or external pull-down resistors. When my chip is active (with ESPHome on it), I do have one sensor showing ON while all the others show OFF. Here’s a screenshot of the ESPHome webpage for the devcie:

Sensor 3, the one showing ON, is on GPIO03. From what have found, I see nothing that indicates this pin is handled differently than the other GPIO pins. I have the internal pulldown set to true, so I would expect it to be off. At this point, that pin and most of the others are floating. Again, I would expect the internal pulldown to keep it low.

My configuration for the sensors is at the bottom of this post. Is it just random and, if I use external pulldown resistors, will this be fixed? Do I need external pulldowns because there are issues with the internal ones?

What’s going on with this and what do I need to do to fix it?

Here’s my configuration info on this (the substitution for ${Sensor3Pin} is, as I mentioned, GPIO03`.

binary_sensor:
  - platform: gpio
    id: "Sensor01"
    name: "Sensor 1"
    web_server:
      sorting_group_id: sorting_group_sensor1
      sorting_weight: 1
    pin:
      number: ${Sensor1Pin}
      mode:
        input: true
        pulldown: true
    filters:
      delayed_on: 10ms
    device_class: power

As mentioned, I have 4 of thes, which I made by copying and pasting and the only parts I changed were changing the ‘1’ in the id, name, sorting_group_id, and number fields to the appropriate number for each individual sensor.

What board?

For basic Esp32 it’s default RX pin, so it is handled differently from some other pins.

If you plan to use esp boards, you need to make friends with pinout sheets. These are available for every esp board or esp breakout board so, always make sure your looking at the correct one.

These pinout sheets are an excellent reference to look and see which pins do what, which pins to avoid, or which may be High/Low at boot which can cause a massive pain in your a$$ if your using one of those and trying to troubleshoot a misbehaving gpio.

I really cant stress more strongly how important these are to use and it will save you from making many avoidable mistakes.

Ah - I didn’t realize there were various different boards. I’m using DevKitC WROOM-32D. I had found what I thought was an acceptable pinout diagram, but it was not the one I should have been using.

Thanks for the link. That helps clear it all up. So this pin will go high at boot.

I have a copy of “Andreas Spiess’s priority one pin list” in my ESPHome working directory and I go for them first.

Has radically reduced my pin related issues.

1 Like

I looked over my notes. I did screw up, but not in the way I thought.

In my schematic, I listed the pins to use for the 9 sensors I needed. I had come pretty close to the priorities in the video from checking pinouts on another source. (I picked them based on what looked available and pin positioning based on my schematic. Since I’m still learning how to use Kicad and design the circuit and PCB, that could change quite a bit as I do the PCB.)

I had specified to use GPIO4 in my schematic notes and used 4 in my actual schematic. When I copied the pins to use over to my YAML file, I conflated several numbers. Pin 13 was listed by Pin 04 and Sensor 03 was using Pin 04 - so it was easy, with my reading issues, to mix that up and end up writing 03 instead of 04 for that pin. (Usually I catch things like this by triple-checking them.)

So I goofed, but I’m also glad to know that I was looking over the GPIO pins and had prioritized, for simple binary sensors, the ones listed in the video. (Or most of 'em, anyway!)