a ESP01 has only 4 usable pins and normally you only have to pay attention that GPIO 0 is high on boot up. but with ESPHome GPIO 0, 1(TX) and 2 needs to be high on boot up. this is in case of an ESP01 useless in my opinion. so are there some config options to disable those requirements so it doesn’t matter if the pins are high or low at boot up?
Well not exactly useless, given the number of projects that use them.
But there is no way to avoid those restrictions.
Just don’t pull them low.
no way to avoid with ESPHome then… with my own FW it is possible but i really like the programming from within home assistant and the native communication so we don’t need MQTT.
so let’s try to solve it on the hardware side:
i found some examples on the internet with optocouplers and (NPN) transistors with a pullup resistor on the base, but i did not get that to work because the internal diode (wich are the basic components of both devices) pulls it to ground. a PNP transistor could work if the voltages wich controls the transistor and the controlled voltage are the same, wich in my case aren’t.
i did had another thought, i need something with a high input impedance so the trick with the pullup resistor will work (high input impedance = no current flowing = same voltage on pullup resistor on both sides = high GPIO)
i had some IRFZ44N N-Channel mosfet’s laying around and tested this idea, and it worked. so although i would have liked a software solution, i do have a backup plan now. just need to order some small TO-92 mosfet’s instead of those big chunky TO-220’s
for anyone who want to try this i just used a 2K2 resistor from 3,3v to the Gate as pullup.
for anyone who afterall does have a software solution… i’m all ears!..
So how do you solve it with your own firmware?
My experience with ESP01S is that ESPHome is problematic, but Tasmota works flawlessly.
I use these:
Every esp pin virtually become multiple pins.
Only downside is the 230xx broke 2 times in 2 years but that might be coincidence.
just declare the pins as an output/input in the setup. only GPIO 0 has to be high on boot up.
it looks like ESPHome has some extra functions buid in or something.
yeah looks like ESPHome build in some extra functions or something.
interesting, thx!
let’s look into that too…
but if you break them, maybe there is something wrong with your schematic?
are you switching inductive loads or something?
good suggestion! thx.
i tested it but sadly it does not remove the input high restriction…
i programmed it like this:
switch:
- platform: gpio
pin:
number: 1
inverted: true
mode:
output: true
name: "CV Sturing"
- platform: gpio
pin:
number: 3
inverted: true
mode:
output: true
name: "Vloerverwarming pomp"
and also disabled the logging over the UART pins (tx, rx / pins 1 and 3) bij setting baud rate to 0
logger:
baud_rate: 0
i’m not sure if i can add anything else that will help.
for the ones interested in the MOSFET solution i ordered 2N7000 N-channel MOSFET’s. i think they will work too like the IRFZ44N ones. i’ll let you know…
the 2N7000 N-channel MOSFET’s with a 2200 Ohm pullup resistor on the gate works great.
Hey!
I took a gamble and made a board that uses the TX pin as an output, and it worked!
The device flashes a few times when the device boots up as transmits some data on the UART. But once it starts up, it works just fine.
esphome:
name: staircase-rgb
friendly_name: staircase-rgb
esp8266:
board: esp01_1m
api:
encryption:
key: "#####"
ota:
password: "####"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "Rgb-Test Fallback Hotspot"
password: "####"
logger:
level: NONE
web_server:
port: 80
captive_portal:
light:
- platform: rgb
name: "Staircase Lights"
red: output_component1
green: output_component2
blue: output_component3
output:
- platform: esp8266_pwm
id: output_component1
pin: GPIO2
- platform: esp8266_pwm
id: output_component2
pin: GPIO0
- platform: esp8266_pwm
id: output_component3
pin: GPIO1