Introduction: Home Automation With Siri | NodeMCU
We have seen controlling the light bulbs, fan using a relay, microcontroller and mobile phone. In this project lets integrate Siri to turn ON/OFF the lights. I shall first cover how to control a led bulb with relay and node mcu following with integration of siri to it.
- 1-channel relay
- Node MCU Microcontroller
- Some Jumper wires
- Mobile Application: Siri Shortcuts(Only iOS)
- PC Software: Arduino IDE
Step 1: Connections
- Connect the GND, VCC pin of the relay module to the GND, 3V3 pin of NodeMCU
- “IN” of relay module to D4 of NodeMCU
- Cut one of the wires of the LED bulbs and screw it to NO(Normally open) pin of the relay module, and the other detached wire is to be connected from COM(COMMON) of the relay module to the switch, check out the above image for proper connections and make sure to turn off the power while connecting them.
Be Careful while Connecting
Step 2: Code
- Download the code from here make necessary changes.
- Firstly enter your wi-fi network name and specify the password. Make sure the relay pin is specified right with respect to NodeMCU, in this case we have used D4.
- Now connect the Node MCU to the PC/Lap, from tools select board as NodeMCU(If not present add the library from "Add Library: option) then compile the code in Arduino IDE, and upload it to Node MCU.
- Make sure you have the appropriate libraries installed in your IDE
Step 3: Controling Manually
Lets now make sure that the connections are made write.
- Connect your Node MCU and the phone to the same network
- To get the ip address of Node MCU, install and open Fing application from the App store. Scan for devices under your network, identify the new one and note it down.[Fing app: Scans and displays the ip address of devices under your network]
- Now open the browser and enter the ip address, following with which a page displaying ON/OFF is displayed.
- Click the ON to switch the relay which in turns the lights ON, and vice versa for OFF.
Step 4: Hey Siri! Turn the Lights ON
Lets set up siri to control the lights in this step:
- Install and open Siri shortcuts from the app store.
- Click on "+" on top right corner to create new shortcut. Go to search and search select 'siri suggestions', scroll and search for the safari's added page(which looks something like 192.168.0.x) the select to add it.
- Go to its settings and name it as "turn on lights'. Also select 'Add siri' button to add the phrase "Turn the lights on". Do the same thing for turning off the lights.
- If you have any difficulty in setting up "siri shortcut" check the above video or message me and I'll help you.
Step 5: Final
Its showtime, Hey Siri! Turn the Lights on
References: Code Link: https://github.com/Ikarthikmb/Hardware-Programmin...