Based on what we have learnt in this chapter and in Chapter 6, Day 4 - Building a Standalone Device previously, the following figure is a simple idea to automate the lights at your home:
As depicted in the preceding figure, the Arduino is interfaced with your room light via a Relay module in order to keep the DC circuit separate from the high voltage AC mains. Utilize what we learnt in this chapter for achieving the Relay module interfacing.
The DC part of the circuit has an HC-SR04 ultrasonic sensor and has been powered from an external battery. Use the knowledge you gathered in Chapter 6, Day 4 - Building a Standalone Device for the basic wiring and sketch for using an ultrasonic sensor with the Arduino.
Place the HC-SR04 ultrasonic sensor strategically on one side of the entrance door to a room. Let...