Smart Home:
The idea for this project came from the source KROW - One Platform for Workforce Management. On this site, the projects are published to bid and then work with the concerned group. However, instead of bidding to work on this project, we decided to work on this project independently at home, as a home improvement project. So, this project involves no client OR in other words, people at our home are the clients. This project was about operating the light bulbs remotely, using WiFi over Android phone. If you see the video below, we have placed the mobile in the close proximity of the switch board. This was solely for the purpose of capturing video. Ideally, we can place the mobile in a remote place. Either in a different home, or we can operate from somewhere in the garden, or we can operate even when we go for a walk outside.
Smart Home - Circuit Diagram: Please check the circuit diagram below which shows the electrical as well as electronics connections required for the Smart Home project. These electrical and electronics components are placed inside the switch board. Since the switchboard is neatly arranged and closed in the above video, components appear "hidden" from the outside view. The components of the circuit diagram are also listed below.
- Power Supply
- ESP8266
- Four Channel Relays
- Switch Board with Three Sockets and Single Phase Supply and a Switch
The description of each of the component is given below:
Power Supply: The power supply module takes in a 6V DC supply (four 1.5V batteries) as an input and gives a 3.3V and 5V DC supply as an output. A picture of our power supply module is given below. Please remember to switch the jumpers appropriately to get a constant 3.3V and 5V supply.
The Electrical Connections: The setup shown in the Circuit Diagram Section, works on a single phase supply. The single phase supply has Red, Green and Black incoming wires. The Red wire representing the Phase, Green representing Ground and Black representing Neutral. In the three holes of the socket, the top hole represents Ground, the right hole represents Phase and the left hole represents Neutral. The circuit diagram shown above, is the inside picture of the Switch Board. So, you can imagine the Left Hole of the socket will fall on right hand side and Right Hole of the socket will fall on left hand side. The view turns reverse. So we made connections from Phase-Phase, Ground-Ground and Neutral-Neutral accordingly. When the relay is switched ON, the circuit closes and the current finds a return path and the light bulb glows. When the relay is switched OFF, the circuit opens and the return path breaks and the light bulb switches off.
Below are the snapshots of our program in MIT APP INVENTOR. As you can see the Designer screen has a mobile snapshot with four buttons. They correspond to four controls of the four light bulbs (As I already mentioned, only two are operational yet). The corresponding Blocks screen is also created to operate four light bulbs. The blocks screen initializes the UrsAI2MQTT1 broker with the Broker IP, Port and Client ID, required for WiFi connection to the MQTT broker. MQTT broker is installed on a laptop. The default port which MQTT broker uses is 1883. For the setup to function, the MQTT publisher (Android Phone), MQTT broker (The laptop) and the MQTT subscriber (The ESP8266), should be on the same WiFi network. Also, there are a couple of configurations to be done on the windows machine, for the Firewall to allow these connections. Also, there are few configurations to be done in the broker configuration files. I have not listed those configurations here, because they change, based on the operating system type and the broker type. However they can be easily found on the internet. Each of the four buttons on the android phone toggles the state of the bulb. They switch the bulb OFF, if it is previously ON. And switches ON, if it is previously OFF. They achieve this by connecting to the MQTT broker and publishing JSON messages led_on and led_off to the broker on the topic NodeMCU/inTopic. The subscriber client ESP8266, subscribes to the same topic, and receives the messages. The ESP8266 identifies the messages to check whether they belong to port 0, 4, 5 AND 16 (RELAY-1, RELAY-2, RELAY-3 AND RELAY-4 respectively to toggle the four light bulbs).
The ESP8266 sketch is given below































