Home Automation ****************** .. image:: Images/HomeAutomation.jpg :align: center Description ============ Home automation is a big part of “The Internet of Things"… Nowadays, all of our devices and appliances are connected to provide us with a seamless control over all aspects of our home and more. With home automation, you decide how a device should react, when it should react, and why it should react. You can automate tasks such as opening and closing a gate based off of your personal preferences thus providing convenience, control, money savings, and an overall smarter home. All of this can be easily achieved with the help of a single Raspberry Pi. Learning Objectives =================== - Coding, electronics, and physical science through a hands-on application that can be directly related to real life situations. - Motion detection using ultrasonic sensors - The use of frequency, period and duty cycle of a signal to control the movement of a servo motor - IoT: How devices communicate with each other in real life applications - The implementation of the engineering design process - Application of theoretical concepts to real life situations Materials Needed ================ - Raspberry Pi with micro SD card and Raspbian - Breadboard - Jumper wires - Ultrasonic Sensor: HC-SR04 - Servo Motor - LED lights - 4x 1.5V Batteries + Casing - Glue gun and glue sticks - Cutter blades or scissors - Thin sturdy foam board (optional: used for the home design) Setup and Functionality ======================= For our home automation project, we want to automate a few things around the house. Let’s start with the gate! When someone arrives at the gate, the ultrasonic sensor detects that someone is close. Then, the gate opens and the garden lights turn on. Few seconds later, the gate closes and the main door opens and the house lights up. Circuitry and Electronics: ================================================= - LED lights: we have 2 sets of led lights - 6 LED lights in the garden connected to GPIO pin 13 - 2 LED lights inside home connected to GPIO pin 12 - Ultrasonic sensor: we 4 wires to connect to the RPi - VCC -> 5V - Trig -> Pin 10 - Echo -> Pin 8 - GND -> GND - Servo Motors: Every motor has 3 wires - First motor: - Red wire -> (+) Battery - Brown wire -> (-) Battery - Orange/yellow wire -> Pin 11 - Second motor: - Red wire -> (+) Battery - Brown wire -> (-) Battery - Orange/yellow wire -> Pin 16 .. image:: Circuits/HomeAutomation.png :align: center .. note:: - Only 2 out of the 8 LEDs are shown in the figure. - Only 1 servo motor is shown - The other servo is connected similarly but to pin 16 Programming =========== .. literalinclude:: Code/HomeAutomation.py Science Concepts and Skills =========================== **Flex your brain!** Did you ever consider the security of the house members? This home automation project does not deal with security. Anyone can enter this house! How can you make it more secure?