Question on usable NodeMCU pins

I’m new to ESPHome and this sort of hardware so I was hoping someone could help me out.

I have a NodeMCU board with two RGB LEDs and one PIR attached as follows:

The config I have uploaded to it:

esphome:
  name: kitchen_multisensor
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "redacted"
  password: redacted

  ap:
    ssid: "redacted"
    password: redacted

captive_portal:

logger:

api:
  password: redacted

ota:
  password: redacted

binary_sensor:
  - platform: gpio
    pin: D8
    name: "kitchen_pir"
    device_class: motion

output:
  - platform: esp8266_pwm
    id: kitchen_multisensor_red1
    pin: D2
    inverted: true
  - platform: esp8266_pwm
    id: kitchen_multisensor_green1
    pin: D3
    inverted: true
  - platform: esp8266_pwm
    id: kitchen_multisensor_blue1
    pin: D4
    inverted: true
  - platform: esp8266_pwm
    id: kitchen_multisensor_red2
    pin: D5
    inverted: true
  - platform: esp8266_pwm
    id: kitchen_multisensor_green2
    pin: D6
    inverted: true
  - platform: esp8266_pwm
    id: kitchen_multisensor_blue2
    pin: D7
    inverted: true

light:
  - platform: rgb
    name: "Kitchen Multisensor RGB1"
    red: kitchen_multisensor_red1
    green: kitchen_multisensor_green1
    blue: kitchen_multisensor_blue1
  - platform: rgb
    name: "Kitchen Multisensor RGB2"
    red: kitchen_multisensor_red2
    green: kitchen_multisensor_green2
    blue: kitchen_multisensor_blue2

It works as expected when I upload the config via USB, but when I unplug the board and boot it up again it doesn’t boot. I suspect I may be running into an issue of using the incorrect data ports somewhere but not sure how to figure it out.

As far as I know some pins can’t be pulled up/down at boot, but I’m not sure how to determine what the pin state will be on boot.

Can someone please tell me what I’m doing wrong?

1 Like

There is an excellent resource on ESP8266 GPIO selection here:

And for the ESP32:

Looking at your wiring diagram I don’t see any problems. D1 would be a better choice than D8 but as long as your PIR is not outputting a high signal on boot (possible if you are moving near it when powering up) it should be ok. I’d change it to D1 just to be on the safe side.

Also are you sure your RGB LEDS are common Anode (+)?

2 Likes

That’s awesome. Thank you.

How would I know whether a pin is pulled HIGH or LOW on boot?

By what you have physically connected to it.

The PIR connected to D8 may output a high signal while initialising or when you move near it to connect power to the board.

The LEDs all have enough voltage drop through them that they should not be pulling the pins high.

The red LED has the lowest forward voltage of about 1.8V.

3.3V - 1.8V = 1.5V.

For 3.3V logic you need at least 2.0V for the pin to be pulled high. So you’re good. Also the red LEDs are connected to pins that don’t mind being pulled either way on boot.

logic-family-voltage-table

3 Likes