Wemos D1 Mini won't connect to WiFi

I have two Wemos D1 Mini’s controlling a watering system for plants on my patio. They have near identical ESPhome code. They are 12 feet apart from each other and 20 feet direct line of site from an access point (Unifi). The left plant Wemos D1 Mini connects all the time with no issues. The right one will not stay connected to WiFi. I even swapped out the Wemos D1 Mini to a new board, same issue. I’m powering both of them using a single12V 2A power supply with a separate step down converter for each D1 Mini that brings the voltage down to 5V (checked with mutli-meter) and hooked to the 5V pin.

When I power it using the USB it works. When I power it using the 12V power adaptor through the step converter (measured at the D1 Mini at 4.95V hooked to the 5V pin) it doesn’t work and the blue LED flashes on the D1 Mini.

Here’s my code:
Left D1 Mini (works all the time)

esphome:
  name: patio-flower-pot-waterer-left
  friendly_name: Patio flower pot waterer-left
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxx"

ota:
 - platform: esphome
   password: "xxxxxxxxxxxxxxxx"

wifi:
  ssid: "Phillips_IoT"
  password: "xxxxxxxx"
  #Static IP
  manual_ip:
    static_ip: 192.168.1.76
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  #Turn Off Power Save Mode
  power_save_mode: none
  fast_connect: on

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Patio-Flower-Pot-Waterer"
    password: "xxxxxxxxx"

captive_portal:
    

sensor:
  - platform: adc
    pin: A0
    name: "Patio Plant Soil Moisture-Left"
    device_class: moisture
    accuracy_decimals: 2
    update_interval: 1s
    unit_of_measurement: "%"
    icon: "mdi:water-percent"
    filters:
    - calibrate_linear:
        - 0.62402 -> 0.0
        - 0.27311 -> 100.0
    - sliding_window_moving_average:
        window_size: 3
        send_every: 5
    - clamp:
       min_value: 0
       max_value: 100
    on_value_range: 
      - above: 40
        then:
          - switch.turn_off: pump
#      - below: 20
#        then:
#          - switch.turn_on: pump

switch:
  - platform: gpio
    pin: D1
    name: "Patio Planter Pump-Left"
    restore_mode: RESTORE_DEFAULT_OFF
    id: pump
#ESPhome restart
  - platform: restart
    name: "Patio Flower Pot Waterer Restart-Left"

binary_sensor:
#Lower Water Level
  - platform: gpio
    pin: 
      number: D5
      mode: INPUT_PULLUP
    name: "Bucket Empty-Left"
    filters:
      - delayed_on_off: 2s
    on_press:
      then:
        - switch.turn_off: pump
#    device_class: none
#Upper Water Level
  - platform: gpio
    pin: 
      number: D6
      mode: INPUT_PULLUP
      inverted: true
    name: "Bucket Full-Left"
#    device_class: none

Right D1 Mini (Doesn’t work)

esphome:
  name: patio-flower-pot-waterer-right
  friendly_name: Patio flower pot waterer-right
  platform: ESP8266
  board: d1_mini

#esp8266:
# board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxx"

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxxxxxx"

wifi:
  ssid: "Phillips_IoT"
  password: "xxxxxxxxxxx"
  #Static IP
  manual_ip:
    static_ip: 192.168.1.78
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  #Turn Off Power Save Mode
  power_save_mode: none
  fast_connect: on

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Patio-Flower-Pot-Waterer-Right"
    password: "xxxxxxx"

captive_portal:

sensor:
  - platform: adc
    pin: A0
    name: "Patio Plant Soil Moisture-Right"
    device_class: moisture
    accuracy_decimals: 2
    update_interval: 1s
    unit_of_measurement: "%"
    icon: "mdi:water-percent"
    filters:
    - calibrate_linear:
        - 0.7184 -> 0.0
        - 0.4225 -> 100.0
    - sliding_window_moving_average:
        window_size: 3
        send_every: 5
    - clamp:
       min_value: 0
       max_value: 100
    on_value_range: 
      - above: 40
        then:
          - switch.turn_off: pump
#      - below: 20
#        then:
#          - if:
#              condition:
#                - binary_sensor.is_off: empty
#              then:
#                - switch.turn_on: pump

switch:
  - platform: gpio
    pin: D1
    name: "Patio Planter Pump-Right"
    restore_mode: RESTORE_DEFAULT_OFF
    id: pump
#ESPhome restart
  - platform: restart
    name: "Patio Flower Pot Waterer Restart-Right"

binary_sensor:
#Lower Water Level
  - platform: gpio
    id: empty
    pin: 
      number: D5
      mode: INPUT_PULLUP
    name: "Bucket Empty-Right"
    filters:
      - delayed_on_off: 2s
    on_press:
      then:
        - switch.turn_off: pump
#    device_class: none
#Upper Water Level
  - platform: gpio
    pin: 
      number: D6
      mode: INPUT_PULLUP
      inverted: true
    name: "Bucket Full-Right"
#    device_class: none

I’m pulling my hair out trying to figure it out. Any help would be appreciated.

Maybe it’s just a faulty D1 mini… Have you tried swapping them over, flashing each with the others code? I’ve had a D1 mini that would often drop off the wifi and ended up throwing it in the bin. A new one with the identical code has since worked flawlessly for years.

Yep, I tried swapping D1 Minis. I’m on my 2nd one.

I may have figured it out.

I have a moisture sensor hooked to pin AO. I was powering that sensor using 5V. It looks like the AO pin can only take 3.3V. I hooked the moisture sensor to my 3.3V output on the D1 mini and it now seems to be working. That would make sense because when I’d bring the D1 inside to test it would always work but I had the moisture sensor unplugged when I was testing.

Esp8266 is 3.3V MCU, any gpio pin can only take VCC+10%.
But that really doesn’t explain why it was working while connected to USB…