LAB (EI) 3


Lab 3 ESP32 Wireless control and Light sensor

Objective:

- To learn how to connect a ESP32 microcontroller to the local network
- Able to use Blynk app to view and control ESP32 status on phone
-Troubleshoot connection of ESP32 to the network by using a correct token key

 Introduction:

ESP32 is a low-cost, low-power system on a chip microcontroller with integrated Wi-Fi and dual-mode Bluetooth. In this lab, I will learn how to connect the microcontroller Arduino ESP32 to the local 2.4GHz wireless network and configure the authenticate token to build a link from an Android device to the chip. Aside from that, in this lab I will create a light intensity and temperature graph on the Blynk app that will allow users to observe changes on the breadboard without actually viewing the circuit.


Equipment & Components


• ESP32 DOIT DEVKIT V1 Board

• 3x 5mm LED

• 10k Ohm resistor

• Light Dependent Resistor (LDR)

• Breadboard

• Jumper wires

• Potentiometer

• Android Device with Blynk app installed



                                                                                                                  Figure 1 : Circuit Connection 

Steps:

How to setup Blynk

1. First install Blynk app on the mobile device or you can use blynk from website.



2. Then Login and create a new project using ESP32 and Wi-Fi




3. Customize the dashboard on web dashboard if using website or mobile dashboard if using     mobile.




4. Then copy the authenticate token under the project setting to the Arduino Sketch.



(Make sure the Blynk library is added into the Arduino coding software. Can search on Arduino IDE library.)


5.Then paste the auth token it into Arduino under auth[]. Next, set the ssid[] same as your Wi-Fi name and pass[] as your Wi-Fi password.




Task:



1. Declare three variable for red yellow and green LED state.

This link for coding :


https://docs.google.com/document/d/1diF8G9x6y0ZfCFIsOTk0xZCrePA2fl6gQvRZsPEdnDw/edit?usp=sharing

Results: 


-The lighting of LEDs is controlled by the button on Blynk apps. 




-When button is pushed, the PB state on Blynk apps will blink.



-The potentiometer can be adjusted and observed on the mobile Blynk apps.




- We can observe the output from serial monitor on Arduino IDE.





- We also can observe the output from Blynk apps.

Conclusion:

To sum up, the ESP32 is a very intelligent and convenient microcontroller that can be easily programmed using software. The ESP32 has wireless and Bluetooth control connections, making it even more convenient to use. To link up the ESP32 to the mobile device, we need to use a programme called Blynk to establish a wireless control connection. To identify the Blynk code, the plugin Blynk file should be added to the Arduino coding software. Following that, the authenticate code is essential and must be correctly inserted into the Arduino coding to make it work.


In this laboratory, I learned how to use a light dependent resistor (LDR) to read the intensity of real-lifelight and convert it to lux values. The normal lux value is between 30 and 50, and we can display the value of lux using serial print to see it more clearly. It is possible to create an auto light detector that turns on or off when the surroundings become brighter or darker by using If Else statements.


In the task, I declare three variables for three different LEDs: Red, Yellow, and Green, in order to allow a virtual button to control these components. When different lux intensities are met, the project initially displays one colour of LEDs at a time. Using the variable, I was able to manually turn on the LED using the Blynk app. In addition, there is a graph that displays the Lux intensity and temperature inside the Blynk dashboard. Also the potentiometer reading can be monitored in Blynk apps and serial monitor. The PB state can be control using push button on the circuit.



Comments