Download presentation
Published byChristina Jackson Modified over 8 years ago
1
Final Presentation Smart-Home Smart-Switch using Arduino
Department of Electrical Engineering Students: Edan Shunem, Itzik Cohen Supervisor: Mony Orbach Semester: Winter, 2016 Date: 09/03/2016 הצגה עצמית
2
Presentation Outline Motivation Project Goal Block Diagram: Hardware
Physical Diagram Block Diagram: Communication Problems Encountered Software Server, GUI, App, Controllers, DB Arduino Software UML Controllers Flowchart Tests Live Demonstration
3
Motivation Home automation makes our lives easier, more convenient and can allow lower energy consumption. Turn on devices remotely (water boiler, heaters, etc.) Schedule devices to work in specific times (lights, AC, coffee machine, radio, etc.) Monitor your energy consumption
4
Motivation But unfortunately, today, smart homes technology is very expensive. Controlling devices and installation are expensive. Requires 3rd party installations. Often needs to be implemented in the house’s infrastructure.
5
Project Goal Design a remotely controlled Multifunction Outlet Power Strip. The power strip will be controlled with an Arduino Processor using WIFI via a designated server. The power strip will have local functionality and automatic fail-safes.
6
Block Diagram: Hardware
Digital 5V DC Converter 220V Source Arduino Nano Processor WIFI LED TCP LED 220V Relay 220V Relay 220V Relay 220V Outlet 220V Outlet 220V Outlet 3.3V DC Converter ESP8266 WIFI RTC Sensor Sensor Sensor Analog Server Heat sensors – detect outlet heat level and stops functionality when overheating (safety) Hall effect sensors – detect electromagnetic fields to determine current (energy monitoring) 220V relays – switching the voltage to the outlets on and off (via aeduino control( ESP8266 WIFI Arduino Nano Controller Heat Sensors 220V Relay x3 220V Outlets x3 x3 Hall effect Sensors
7
Physical Diagram 220V Source PC Relay Module x3 RTC 5V DC Converter
GND 5V PC Mini USB D11<->TX D12<->RX 220V Source 5V DC Converter 3.3V DC Converter 220V 3.3V Relay Module x3 Hall Sensors x3 RTC
8
Block Diagram: Communication
User Via PC or Smartphone JAVA Application ESP8266 WIFI Router mySql Database Server Socket Handler Arduino Controller Strip
9
Problems Encountered Arduino Environment.
Integration of ESP with Arduino Nano: ESP was a new component, required library implementation. Reliable Communication. Server platform: Attempts with Wampserver (PHP, Apachi, MySQL), problematic blackbox. Considered implementing server in C++ but was time consuming. Solution: Implemented a JAVA server. Pros: Cross-Platform, dedicated libraries for socket handling, GUI(!), OOP, Interface with SQL. Cons: required learning JAVA.
10
Problems Encountered Embedded programming limitations: RTC:
Limited Arduino (Nano) memory, communication via UART, Small buffer. RTC: Arduino Nano has no inner timer, required for independent functionality. Handle clock skew. Identify communication loss. Solution: save last message time from server, compare to RTC time.
11
Block Diagram: SW Server
GUI Thread Scheduler Thread (Sensors) Client Listener Main Thread Client Thread Controller Client: JAVA App Android App Arduino1 Arduino2
12
Server GUI Server GUI for communication monitoring.
Connect/Disconnect button, choose port. Events logging (retries, messages, exceptions).
13
Client Thread Controller
Wait for a message from the Arduino\Application and handle as a controller. Parses messages: <SRC>#<DEST>#<SW>#<OP>#<VAL> When changing status, Update the SQL. Database Handler: Wrapper for DB, handles communication with DB, has SET/GET methods.
14
Client Thread Controller
Perform requested commands: Send Open\Close request from the Application to Arduino. Get Ack from Arduino and update the Database. Handle Timer Request from Application and Ack Timer from Arduino and update the Database. Send Request for Temperature and Hall Effect values from Arduino and update the Database upon response. In case of a high temperature send a stop command to Arduino.
15
MySQL Database A free web database, always online, can be customized.
Defines tables and fields, set default values. Handles communication between Server and Application. Has methods for updating fields on the Server.
16
JAVA Application Scheduler updates Arduino status in real time.
GUI for tables and fields. Open / Close Switches. Read switch status and sensors data. Enable/Disable timer for open/close. Set time to open and close. Optional: Create graphs, show statistics.
17
Arduino Controller Flowchart
Setup Server Online? Connect Timeout MSG RCV Yes No Check Timeout Close All Handle MSG High Temp? Timer expired? Open/ Close
18
Software UML: Arduino
19
Initialize System Start server using an opened port.
The Server will start a Socket on the selected port and wait for a new clients. Power On the Arduino: The Arduino will start a connection. Connect to Wi-Fi. Connect to the Server using Socket. Repeat connections upon failure When connected, Arduino sends name. The server saves name and add to the List of Clients. The Server sends timestamp to Arduino to setup the RTC Time. Connection established, Arduino listens to incoming messages and performs commands. After 90 seconds timeout (lost connection) Arduino switches to a self controller.
20
Initialize System Start Application:
The Application opens a socket on the selected port number. Upon success, the Application registers as a client on the server. The Application gets information, displays it to the user form the DB. Send a command to the server and update the status information.
21
Tests Test manual turning on and off of switches.
Test Scheduled turning on and off of switches. Test Failsafe in high Temperature or current according to sensors. Test local functionality when communication is down. Restart after power lost (server re-Init) Sync with RTC.
22
Live Demonstration
23
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.