Voice controlled home automation using bluetooth is a very common project. Here, I have added an extra feature to it, that of a mechanical switch.
If you turn ON the appliance from your app, you can turn it OFF by toggling the switch. Hence, the switch acts as a switch directly placed in your switch-board.
This feature has been added very thoughtfully because if we think practically, we wouldn't always use the app to turn ON/OFF the appliance. If you are nearby to the switch board, or you are not in possession of your phone, you can just toggle the switch to turn ON/OFF the appliance.
Since we use a mechanical switch, the Arduino does not know whether presently, the appliance is ON or OFF. This is why a feedback has been added. A 5V adapter is connected in parallel to the load whose output is given between analog input A5 and GND of the Arduino.
Use common ground for the circuit, otherwise the relay and other components behave erratically.
Transistor - BC547
The control signal from Arduino pin 13 is connected to base via 1K resistor and GND is connected to emitter. This transistor - resistor circuit is the Relay Driver Circuit and it controls the relay switch position.
For the 12V to 5V adapter, you may use an IC7805 circuit which you can easily find on Google Images.
Relay - 250V 10A SPDT
Be careful with the relay connections. Lookout for the pin configuration of SPDT relay. Its coil is connected to the driver circuit and the 'C', 'NC', 'NO' are connected to LIVE line as shown in circuit diagram.
be very careful as you are using the mains line. If you are not confident enough, take someone's help who knows about these things. As a precautionary measure, you may connect a lower DC voltage from a regulated power supply to ensure everything works fine, and then connect the LIVE wire.
If you have any queries, comment below and I will definitely get back to you.
Sources - Electronics For You, Google, Youtube, etc.
Made by - Nikhil Shah, Rahul Fatnani, Manasi Bhavsar, Nipun Bhirud.
Note:- In the circuit diagram, it is shown that the lamp-parallel 5V adapter is connected to analog input A5. That is an error. It is to be connected to analog input A0 pin. Apologies for inconvenience!