This shows you the differences between two versions of the page.
iothings:proiecte:2021:alexa-system [2022/01/23 17:53] adriana.ionita2404 |
iothings:proiecte:2021:alexa-system [2022/01/27 02:35] (current) adriana.ionita2404 |
||
---|---|---|---|
Line 3: | Line 3: | ||
Adriana Ionita - AAC \\ | Adriana Ionita - AAC \\ | ||
E-mail: adriana.ionita2404@stud.acs.upb.ro | E-mail: adriana.ionita2404@stud.acs.upb.ro | ||
+ | |||
+ | {{ :iothings:proiecte:2021:alexa_intro.jpg?500 |}} | ||
+ | |||
==== Description ==== | ==== Description ==== | ||
Line 13: | Line 16: | ||
* ESP32 WROOM | * ESP32 WROOM | ||
* 12V Fan | * 12V Fan | ||
- | * 12V Power Adapter | + | * 12V Power Supply |
* 12V Power Adapter Jack | * 12V Power Adapter Jack | ||
* Relay Module | * Relay Module | ||
Line 22: | Line 25: | ||
The ESP32 represents the core of the system. It controls the other components and also enables the network connectivity for the project. Because the fan requires 12V to function, I used a 12 power adapter which can be plugged intro a socket and a dedicated jack to accommodate the other end of the adapter. The relay module is needed in order to power the fan on and off. The DHT11 module is used for its temperature sensor. The idea behind this is that the fan should go on only if the temperature goes over a certain value, hence the need to read the temperature. The LEDs and the resistors are used for the lights of the system. | The ESP32 represents the core of the system. It controls the other components and also enables the network connectivity for the project. Because the fan requires 12V to function, I used a 12 power adapter which can be plugged intro a socket and a dedicated jack to accommodate the other end of the adapter. The relay module is needed in order to power the fan on and off. The DHT11 module is used for its temperature sensor. The idea behind this is that the fan should go on only if the temperature goes over a certain value, hence the need to read the temperature. The LEDs and the resistors are used for the lights of the system. | ||
- | <TODO: add schematic> | + | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_hardware_diagram.png?700}} |
It's important to note that the temperature sensor has been connected and integrated in a low-power manner. Instead of having it connected to a Vcc pin, case in which it would have provided data continuously, it has the Vcc pin connected to a digital pin. By doing this, it's possible to turn it on/off in order to save power. | It's important to note that the temperature sensor has been connected and integrated in a low-power manner. Instead of having it connected to a Vcc pin, case in which it would have provided data continuously, it has the Vcc pin connected to a digital pin. By doing this, it's possible to turn it on/off in order to save power. | ||
Line 39: | Line 41: | ||
{{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_software_diagram.png?500}} | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_software_diagram.png?500}} | ||
- | As it can bee seen above, when the system gets out of reset it tries to connect to WiFi using the credentials embedded in the code. The LED on the ESP32 board will blink fast while trying to connect and will signal the fact that the board successfully connected to WiFi with a slower blink. In the setup phase, the pins used by the components are set accordingly as input/output and high/low. | + | As it can bee seen above, when the system gets out of reset it tries to connect to WiFi using the credentials embedded in the code. The status LED on the ESP32 board will blink fast while trying to connect and will signal the fact that the board successfully connected to WiFi with a slower blink. In the setup phase, the pins used by the components are set accordingly as input/output and high/low. |
- | The main loop of the application is split in 2 phases: checking for remote updates and updating the remotes based on local changes. Checking for remote updates means that using the application or the voice commands, the end user can change the state of the LEDs or the fan. If such changes are made, the corresponding callback will be executed in order to update the hardware. Apart from this changes, the system also periodically checks the value of the temperature in order to turn the fan on/off accordingly. After checking the temperature, the new value has to be sent remote, to the application for example, in order to be displayed. This is the second phase of the loop. | + | The main loop of the application is split in 2 phases: checking for remote updates and updating the remotes based on local changes. Checking for remote updates means that using the application or the voice commands, the end user can change the state of the LEDs or the fan. If such changes are made, the corresponding callback will be executed in order to update the hardware. Apart from these changes, the system also periodically checks the value of the temperature in order to turn the fan on/off accordingly. After checking the temperature, the new value has to be sent remote, to the application for example, in order to be displayed. This is the second phase of the loop. |
==== Final result ==== | ==== Final result ==== | ||
+ | |||
+ | === Hardware setup === | ||
The project has been successfully implemented and set in position: | The project has been successfully implemented and set in position: | ||
- | <TODO: add images> | + | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_hw_1.jpg?600}} |
+ | |||
+ | Some wires were hidden to try to make it look nicer: | ||
+ | |||
+ | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_hw_2.jpg?600}} | ||
+ | |||
+ | Good thing it's all covered up :) | ||
+ | |||
+ | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_hw_3.jpg?600}} | ||
+ | |||
+ | === WiFi Light & WiFi Fan registration === | ||
+ | |||
+ | In order to get started, the devices have to be registered using the Alexa App: | ||
+ | |||
+ | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_setup_devices.png?600}} | ||
- | It has been tested and it works properly with both the Alexa App and the Echo Dot. | + | After the registration is complete, the 2 devices will be available in the "Lights" section of the application under the names "WiFi Light" and "WiFi Fan". From there they can be controlled with Alexa. |
- | <TODO: add images> | + | === WiFi Light usage === |
The Alexa library for Arduino is designed especially for lights. So using it to control the lights of this project was pretty straight forward because it implied to use this library as intended. Functionality for the lights include turning lights on/off, setting the brightness and setting the color: | The Alexa library for Arduino is designed especially for lights. So using it to control the lights of this project was pretty straight forward because it implied to use this library as intended. Functionality for the lights include turning lights on/off, setting the brightness and setting the color: | ||
Line 57: | Line 75: | ||
* using the Alexa App installed on my phone. | * using the Alexa App installed on my phone. | ||
- | <TODO: add images> | + | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_light.png?600}} |
+ | |||
+ | === WiFi Fan usage === | ||
For the fan on the other hand, I had to adapt these mechanisms available for lights to obtain the functionality I needed. Also, the fan is tightly dependent on the temperature sensor. So this is the behaviour for the fan and the sensor: | For the fan on the other hand, I had to adapt these mechanisms available for lights to obtain the functionality I needed. Also, the fan is tightly dependent on the temperature sensor. So this is the behaviour for the fan and the sensor: | ||
Line 70: | Line 90: | ||
* Any other colour: always off, regardless of the temperature | * Any other colour: always off, regardless of the temperature | ||
- | <TODO: add images> | + | {{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_fan.png?600}} |
+ | |||
+ | === Demo === | ||
The functionality of the project is also demonstrated in the video below: | The functionality of the project is also demonstrated in the video below: | ||
- | <TODO: add video> | + | [[https://youtu.be/dYg_C0Q1hfU|{{https://ocw.cs.pub.ro/courses/_media/iothings/proiecte/2021/alexa_thumbnail.jpg?600|}}]] |
==== Resources ==== | ==== Resources ==== |