NodeMCU ESP8266 - Ir led Wiring

Hi,

I have created a small home automation Arduino sketch to control an AC from Daikin. Everything is going very well. The only thing that is blocking me right now is that when the Arduino is booting and the IR LED is connected it always boot wrong.

It is printing this junk in the console :

⸮$c$⸮{"$bl⸮s{dbl⸮r⸮⸮⸮#⸮c⸮⸮r⸮l`⸮⸮⸮pd⸮{⸮⸮⸮2NNnBlc>

But, if I unplug the cable of the pin D2 for the boot and replug it after, everything is working fine.

This is my Wiring Diagram:

I really don't think that this issue is code related. But here is my repository on github :

Someone has an idea why I have this problem?

Certain pins must be HIGH or LOW at boot time.
Best to leave those pins alone, unless you run out of pins for your project.

100 ohm and a green LED is probably too much for the <=7mA I/O of a 3.3volt processor.
Better make that 220 ohm (or higher).

NO resistor for the IR LED is BAD design practice.
That could kill the IR LED, the transistor, or the NodeMCU supply.
Powering the IR LED from the 5volt (V-in) pin, with a 22 ohm resistor in series with the LED should be safer.
Leo..

GPIO2 is one of the pins that determines the boot mode. See this page.. Use a different pin.