Alexa controlled Ceiling lights.
I made this back in Feb of 2021. It really bugged me out how in my room everything was Alexa controlled apart from my ceiling lights. I remember studying about how Relays work but it was just then that struck my mind how I could remove the actual switch in my room and fit a relay in the wall along with Node MCU to wirelessly control my lights. I quickly made a circuit on my desk and coded the node MCU to work with Alexa controlling the lights.





Insights and Coding
The coding is fairly simple. It just switches on and off pin number 5 on the Node MCU which is connected to the signal pin on the relay. A micro USB cable goes into Node MCU to power both itself and the relay.
The relay's common, closed and open are connected to the 3 wires coming from the wall. These 3 wires are typical in most homes that have a 2 way light switch.
​
I use a website known as Sinric pro. When I tell Alexa to switch on the lights, it first tells Sinric pro which in turn tells my code to turn on the lights. This next screenshot is only a part of my code.
