Hello there, nice project!
In the circuit, when the output GPIO goes HIGH, the transistor pulls the IR pin down to GND through a 1K resistror
when the output is LOW, the transistor is in high impedance, and likely the IR pin is pushed up to 5V by an internal pullup in the AC
However, the esp can also pull the IR pin to GND directly (through a 1K resistor)
and instead of using a transistor, to go high impedence directly from the esp, we can set the output pin to "input".
So the code would change from:
Initializer:
pinMode(output_pin, INPUT); // GPIO is an output
Low output:
digitalWrite(output_pin, HIGH); // IR output pulled to 0V by transistor
High output:
digitalWrite(output_pin, LOW); // IR output pushed to 5V by pullup
To:
initializer:
digitalWrite(output_pin, LOW); // Always have a LOW output
Low output:
pinMode(output_pin, OUTPUT); // IR output pulled to 0V by pin sourcing current
Hight output:
pinMode(output_pin, INPUT); // GPIO goes high-z and IR output pushed to 5V by pullup
The circuit would change to just a 1K resistor between the GPIO to the IR output, instead of the transistor and two resistors.
(Maybe I have missed something about this circuit, tell me if I'm wrong)
Hello there, nice project! In the circuit, when the output GPIO goes HIGH, the transistor pulls the IR pin down to GND through a 1K resistror when the output is LOW, the transistor is in high impedance, and likely the IR pin is pushed up to 5V by an internal pullup in the AC
However, the esp can also pull the IR pin to GND directly (through a 1K resistor) and instead of using a transistor, to go high impedence directly from the esp, we can set the output pin to "input".
So the code would change from: Initializer:
pinMode(output_pin, INPUT); // GPIO is an output
Low output:digitalWrite(output_pin, HIGH); // IR output pulled to 0V by transistor
High output:digitalWrite(output_pin, LOW); // IR output pushed to 5V by pullup
To: initializer:
digitalWrite(output_pin, LOW); // Always have a LOW output
Low output:pinMode(output_pin, OUTPUT); // IR output pulled to 0V by pin sourcing current
Hight output:pinMode(output_pin, INPUT); // GPIO goes high-z and IR output pushed to 5V by pullup
The circuit would change to just a 1K resistor between the GPIO to the IR output, instead of the transistor and two resistors.
(Maybe I have missed something about this circuit, tell me if I'm wrong)