MQTT on ESP32 | Controlling Appliances and Monitoring Sensor on Ubidots | ESP32 Projects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] hello everyone now in this video I will let you know how you can control appliances as well as monitor sensors data over Internet on your laptop as well as mobile food via mkdd protocol on the ESP 3/2 board so let's get started so for making this project you will need one ESP 3 2 board one PCB and went 5 volt relay module and the connections of all the components is something like this so one by one I shouldered all the components on this prep board I know it's difficult to shoulder all the connections on a press board but not to worry at all you can order your own custom design PCB for this project from GL to PCB calm I have already designed the PC before this project in which I have used the ESP 3-2 board and a 5 volt relay you can download the gerber file of the PCB and straightaway upload it on GL c PCB comm choose the color masking if you want and place your order you'll be receiving the PCB in a well-protected packaging at your doorstep and trust me the quality which you get from GL z PCB is truly amazing so try out jlc PCB wants to make your projects look neat and more professional after holding the component it looks something like this so this is it about the hardware let's jump to the MV DT portion recently I found a new platform for our IOT projects called UV dots configuring and Guti tianyu B dots is just a work of two minutes so let's start first search for you bid on education on Google and click on the first link now here click on the sign up fill up all your details and click on the sign up button give you proof that you are not a robot so yeah you successfully created your account now click on this next next next and then click on set up my first device so now you are in your account first rename the device with the name ESP 3 2 just for our convenience ok then click on the device and you'll be observing with temperature variable does rename it as hall censored as we are going to monitor hall sensor when you and will add another variable as we are going to control a relay also so we'll name this variable as really then we'll go inside the hall sensor variable now as it was previously a temperature variable so the API label was also temperature so we will just rename it as a hall - sensor this is also just for our convenience and as the relay variable was newly created its API label will be the same now we will go to the dashboard and click on this plus icon to add widget so for Hall sensor will select the indicator inside will send like gods and then we'll select our device which is ESP 3 - and inside that will select a false and salvageable then we need to add minimum and maximum value will keep it as it is now click on finish so here is a gorge which will show the data of all sensor now for the relay will again click on this plus button and this time we'll select control then switch and the device is again USB 3 - and variable name this time is really now defining the data to be sent when on and off which is 1 and 0 respectively then click on finish so yeah we successfully configured you would not subside for our project in just 2 minutes so let's jump on to the coding so this is the code for sending and receiving data on ESP 3 - why I am - tt so here you need to provide the SSID name and password of your router and then after that here is the token now token is different for different accounts to get your own token go to the Nuba doors account click here click on the API credentials so here is the token simply copy it and paste it inside the code now empty data client name is a random name which you need to provide the name should be 8 to 12 alphanumeric character so after that the variable label one is for publishing and other is for subscribing now as you want to publish data in the hall sensor gosh so first we will go to the device then we'll go inside the ESP three to now click on the hall sensor and copy this API label now you need to paste this label into the core now for the subscriber value will go inside the real a variable and copy this API label paste it inside the core and the device label you need to copy from here which is small ESP three two so this is all you need to do according to your account then I have defined the relay pin as 26 then comes the MT DT brokered which you don't need to change at all so yeah rest of the core will remain as it is let me show you how I am controlling the relay and publishing the value so for the relay I'm monitoring the response from the server and if the value is zero I'll turn off the relay and if the value is anything else I'm turning on the relay and now for publishing the data first of all I'm saving the sensor data into the sensor variable and then printing that value on the serial monitor and then we are publishing the same value to the server by using this particular functions and this task is performed with a delay of every one second okay so this is the code we'll just select our board and the port and click on this upload button ok so I will press and hold this put pattern as soon as it shows connecting okay so the code is successfully uploaded now we'll open the serial monitor okay as you can see the value of the sensor is twenty four five three and all the values are uploaded onto the ub dots cloud and this zero here denotes the state test of our relay now let's observe the real-time data on the server so we'll go to the website and click on this dashboard okay so as you can see the value of all sensor is shown into this quad let's bring the magnet close to it and see the values so I have used speaker which has already a magnet built-in so as you can see the values are changing okay so this is how the hall sends the data is shown now let's talk about the relay switch so as soon as I toggle the switch the LED on the relay also toggles so let's see it in action so now let's just connect an easy appliance with the relay and see the project in action and this time I will be controlling this project using my smartphone what you need to do you just need to open the browser login to the UB doors account and go to the same dashboard and from that dashboard you can easily control the relay and monitor the sensors so let's see [Music] [Music] so yeah this isn't about the project I hope you got the idea on how to use mqtt code on the ESP 3/2 board I'll be uploading this sample code onto my github account who's laying is our label in the description of this video subscribe my channel if you haven't to learn more interesting projects regarding IOT automation and electronics so wait for my next video and Ellen explored and shared with me a key SMS you [Music]
Info
Channel: techiesms
Views: 146,779
Rating: undefined out of 5
Keywords: internet of things, iot projects, esp32 tutorial, esp32 projects, ubidots mqtt, ubidots projects, ubidots tutorial, esp32 home automation, mqtt esp32, esp32 mqtt, ubidots
Id: LvzCeBce2mU
Channel Id: undefined
Length: 8min 47sec (527 seconds)
Published: Sat Dec 15 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.