MQTT + Nodemcu (Controlling appliances over Internet using your Smart Phone)| IoT Projects | ESP8266
Вставка
- Опубліковано 4 жов 2024
- This video will let you know about the most used transport protocol i.e. MQTT protocol. And also how to use that protocol with your ESP8266 12e development board. I have explained this project by controlling my home appliances with my SMART phone.
This IoT project will let you think project over internet as it is too easy to make and understand.
_________________________________________________________________
Buy the components from here
ESP8266 12e development board(NodeMCU CP2102) (amzn.to/2BKS7cv)
LED Matrix Display - (amzn.to/2rRiwzv)
Female to Female connector wires - (amzn.to/2rPynOW)
Google AIY Voice Kit - (amzn.to/2r55KMD)
ESP8266 01 wifi module (amzn.to/2E7MsdP)
HiLink 220v ac to 5v dc power supply(amzn.to/2pT2xij)
5V Relays (amzn.to/2ChddQC)
MCT2e IC (amzn.to/2H3ncss)
1n4007 Diode (amzn.to/2EM4IuD)
BC547 transistors (amzn.to/2oiTbfV)
1k resistors (amzn.to/2Gri8Nl)
330ohm resistors (amzn.to/2ojg8zN)
16 channel analog multiplexer module (amzn.to/2mLwlfl)
PIR motion sensor (amzn.to/2EK1OX2)
Sound Sensor (amzn.to/2HCYO0z)
Light Sensor (amzn.to/2CcBAPr)
DHT11 Temperature and Humidity sensor(amzn.to/2sPh3fO)
7805 Regulator IC (amzn.to/2CdUvcq)
9V Power Adapter (amzn.to/2CfffAL)
2 pin PCB mount screw terminal (amzn.to/2EM5Luz)
_________________________________________________________________
if you love watching my videos and interested in learning new new projects,then donate me at PayPal so that I can do it forever and better then before.
www.paypal.me/t...
You can also send me donation through my UPI I'd from Google tez, PhonePe, BHIM etc.
sachinsms1990@okaxis
_________________________________________________________________
Facebook :- / techiesms
Twitter :- / imtechiesms
Instagram :- / techiesms
Website :- www.techiesms.com
WhatsApp number :- +91 82000 79034
_________________________________________________________________
#techiesms
explore | learn | share
In this TUTORIAL Sachin Soni (techiesms) give a clear view of how to implement this project..by which , peoples who don't have good Idea about adafruit & MQTT can understand How its work and implement the project...So it's a Wonderful Video and Wonderful works he has done...not only that , when i am having problem with my project I Got the help from him almost same day I posted my problem...So Thank you "techiesms" and keep posting wonderful project in detail....as you did..
+Deba Banerjee sure
will definitely
explore, learn and share with you all
Да, очень классное видео
Thanks a lot man, your video helped me create my first IOT project using MQTT! oh one last thing, my IDE issued error after inserting the 2 lines of your hand-typed code(the atoi part), and it was fixed later by replacing that line of code with:" int num = atoi((char *)onoffbutton.lastread); "
Dude, thanks so much for posting this, it was driving me nuts.
Hi, thanks for the video, It help me a lot. I wanto to make two friendly suggestions:
1.- Add some small links under the description of the video example:
/min7/sec20 -ESP Configuratiom
min10/sec/8 -Adafruit Config, etc.
It will make more easy for those who have some doubts about a concrete part of the process.
2.-For me the; uint16_t num = atoi((char *)LUZ2.lastread);
dont work, I have to use;
if (strcmp((char *)LUZ2.lastread, "OFF") == 0)
if (strcmp((char *)LUZ2.lastread, "ON") == 0)
instead.
Thanks a lot for the tutorial, keep up the good work.
-Alex. From Mexico.!
Thanks for such a brief tutorial . Its works with me controlling four relays !
Perfect for beginners and more importantly it works.
You should honestly go in the Microsoft Support business with how you explain son well
+Hevolution Thank you for the suggestion. I would love to go there can you give my reference at Microsoft.
Thank you ! Great tutorial. Hope you keep uploading these kind of projects.
Hi! Just a suggestion. I think you can give this video in more precise way and crush it within 5 mins.
+mediamilan I am trying to follow this concept only. Precise content and less time. Still thanks for the suggestion.
uint16_t num=atoi(onoffbutton.lastread);
invalid conversion from 'uint8_t* {aka unsigned char*}' to 'const char*' [-fpermissive]
getting this error help
we are dealing with pointers here ,so
go for-----> uint16_t num = atoi((char *)Light.lastread);
it will work for sure
In video he has not compiled the code ,else would have got error.
@Chirag Sehgal, thank you. it worked
Kalaakaar Makerspace exatly he's stuffing.
Hi Sachin, great video. Thx for sharing. One issue I have noticed is when the system is idle for some time, it stops responding to the feeds. I have to restart the module for it to start responding again. Any suggestion on what I might be missing out on?
Hi , Sachin I am very much excited to inform you that as you said my problem solved after downloading the new code(UPDATED) from techiesms. Thank you very much.
Kepp posting Wonderful projects on techiesms.
+Deba Banerjee good to hear
Share this if you like it
Great video brother. Very informative. Keep on doing the great work. We all are watching and hitting the like button as well :) I know u need boost to come up with another amazing work
+justin paul you totally understand my feelings
R u a UA-camr?
You should have done a video about publishing too, it would have really helped out.
PLEASE CAN YOU SHOW, HOW TO ADD MQTT LIBRARIES IN ARDUINO IDE.
Can you make one complete video to control sonoff devices ( ESP8266), that would be very helpful.
and can I share my devices/switch with other people with the app/account?
Please do more videos we will surely support
I already did a lot of project videos after this, kindly explore our channel.
Ok one thing came to my mind that , is it possible to enter the Variable SSID/PASSWORD of wifi router to the EEPROM of NodeMcu by user via HTTP or any app and after restarting the NodeMcu will read it from its EEPROM..?. If any Idea then please share..
Thank you so mach
and can you tell us how to connect push button
i mean turn on/off the relays via both mqtt and push button
and everything was work without any problems except the app
Dose ios have this app that you use
Could u please provide me code for this project
Hi Sachin, How can I access the code you developed for this project? I do not see any link for it.
I have been controlling appliances over internet sending commands via json how is MQTT different ?
hi Sachin, if i use Amazon web Service IOT for MQTT it gives me sdk to select 1. Embedded C 2. Node js 3. Arduino Yún
which one should i select ? i have OTA enabled my node mcu using platformio IDE.
Good video, continue like this and thanks for your work, greetings from Mexico
gracias.
Nice you can use blinky to do this too.
Nice video, I already done this
and quick question How can I connect adafruit io with alexa skill
Please help me
Thank you sir for the detailed description
i am getting a error.....my node mcu is not getting connected to MQTT server, what could be the problem? plzz help me
Can we control the nodemcu by local wifi as well as by the internet. Please explain
Is it possible to make an HTML file where directly I get the ON/OFF button for my load control? It is pretty annoying to write 0 and 1 again and again. Also, it will make a problem for multiple loads.
Please post a how to setup a Broker and how to remotely connect to it. I am stuck so please if possible then do help.
Nice to see such a video from Gujarati - Ahmedavadi Guy :D Keep it Up.
Check out my video and projects at my channel jatinkg1 :-) Gujarati - Bhavnagari Guy ;-)
pro tip: watch series at Kaldrostream. Me and my gf have been using them for watching lots of of movies lately.
@Grady Timothy Yea, have been using kaldroStream for months myself :D
Thanks for your support Sachin BUTTON Function code is working fine .....But one thing I noticed that is when I used PIN number D10(GPIO 1)(TXD0) of my node mcu as Digital_Input then Button function is not working but when I used PIN number D5(GPIO14)(HSCLK) as Digital_Input then the code working fine...do you know where was the problem? Is it not possible to use (TXD0) Pin as Digital_Input ?.....
And another thing if you have any knowledge then please share with me...
Actually I made a switch Board ( I called It SMART BOARD) by learning your wonderful tutorials which have 4 Internet operated switches and a EMERGENCY SWITCH. and it is working fine for which thanks to you...
But one problem is that if I transfer this switch board( SMART BOARD) to my sister's house or my mother's house or anywhere else then I have to reprogramme my NODEMCU with their WIFI_SSID and PASSWORD accordingly...which is not possible by my sister or any person who have no knowledge of IDE programming...
So is there any way to solve this problem .. like any apps / web portal by which we can only enter the SSID and PASSWORD to node MCU easily...
If it is possible then it will be very handy and useful ..
If you have any Idea regarding this issue then please share........
Thank you.
you can't use TXD0 pin and Serial communication simultaneously. Because this pin is reserved for serial communication.
And talking about the other problem regarding variable SSID and Password, right now I don't know the solution for this but I'll explore this problem and try to get the solution. If I haven't came back to you with the solution, than mail me after one week to remind me this
I have created a new Mqtt broker account but in account I did not get the right side corner options for I'll create a switches,what happened? Can u Plz solve my prblm?
hello i have wdt reset problem in esp8266 for another project !! any solution plz
Waw thanks. That is how to convert to integer, I always fail at that part. Can you tell me why must uint_16?
Very informative video, can we create our own MQTT server?
Hey Sachin , I am using a web application on the internet for publishing messages in the MQTT, can I in the same fashion use the Adafruit.io to recieve the message published from my WebApp ?
+Himanshu Doria yes you can, just subscribe to one of the topic on Adafruit IO and you can both transmit and receive data on your MQTT client app.
Is this possible if I design a button on mqtt app and when I turn it off it reply me or show notification that light which is set according to that button is off
Are they should be connected with the same wifi?
No. Not required
Thank You, come again.
thanks man very helpful. looking for more videos
for more videos and blogs, visit my website,
www.techiesms.com
Very helpful
Ok ..Thank you..
Sachin, May I ask whether you can use the ESP8266 alone instead connected with Arduino? Is that ESP8266 not enough port to control or other reason. Hope you can teach me!
+Ho Brian ofcourse you can use it alone. Just upload the code and give the module and separate power supply and you are ready to use it
The words doesn't help me
To describe how great you did to us all ☺️
God bless you my brother
I had made the project and it's working very well
But I have a little question...
Is adafruit free to use?!
I mean is it an open source to do what ever I want in it?!
Yes!!!, Adafruit is providing free MQTT service to everyone.
if you really want to thank me and describe how great I did, just share my work so that you can also help the community with this work.
Visit my website for more such projects, www.techiesms.com
I want to translate your work to my language (Arabic)
If you don't mind
+ali reda I would love to see this
mail me so that we can have talk further
sachinsms1990@gmail.com
I used
Mqtt dashboard for Android
It's pretty easy to use
Using the same method you did in the video
You are a very smart engineer
Many thanks to you
And
How can I talk to you in private?!
+ali reda mail me
sachinsms1990@gmail.com
hi , can esp be a mqtt broker itself?
hello i need some help if you cane
i use this code but for me not work
i see this error MQTT not authenticated
Android Source code is avaliable for this..? can i have the link for the source code
A very good intractive video you have presented... lets try it.. i will sure to inform you after sucess
+Kamal Das you will definitely succeed in making this. And do celebrate your success by sharing this video so that others also get benefitted.
Problem !! After SignUp I dashboard is not opening.
+Kamal Das may possible their is some problem while making your account. Try again by making another account
+Sachin Soni Sucess.. done
+Kamal Das grt news. Congrats...
hey I have a question would you please tell me that how will you control the brightness of a bulb
Look up single phase AC voltage controller. I guarentee there's probably smarter ways to do this but one way is to put two thyristors in parallel. Have the PWM pin from the microcontroller control the gate of the thyristors to open and close at certain intervals depending on how dim you want the bulb. The code you'll probably want to copy from someone whos done it before you or you'll be sitting there learning about a lot of new hardware, and then sitting there trying to figure out how to code it for a long time. The hardwares easier than the code to me
when i create my account in adafruit . after my login its is not redirecting me to the dashboard coud u help me out
Nice video....
Can you please explain how to develop broker instead of using a radily available broker.
+Anup C Balharpure
No.
I'm too seeking for this
we can able to install MQTT server, but still don't know how they search client
install mosquitto server, in my case i use mosquitto broker server in my rpi1
uint16_t num=atoi(onoffbutton.lastread);
invalid conversion from 'uint8_t* {aka unsigned char*}' to 'const char*' [-fpermissive]
getting this error help
uint16_t num=atoi((char *)onoffbutton.lastread);
Replace with this, the error will get solved
bro thanks a lot
we learn so many things from you keep making videos
this is exact error for my esp8266 Connecting to MQTT... Not authorized to connect
How to controll more application with nodemcu is it possible to controll atleast 20applications
For that you need to go for premium version of Adafruit io.
By paying $10 a month
Yes
Then how we can controll upto 20applications
For that we need to use 2 NodeMCU
Sir can you please explain me how to connect 2 nodemcu
sir how to create adafruit account...it is not entered in sign in page
How does MQTT compare to SMQ from realtimelogic.com ?
i am using esp8266 wifi module instead of node mcu is this code works with that module.
+apoorva.a apooorva yeah
Absolutely
Why Nodemcu? For MQTT bidirectional communication which firmware is better?
+Tara Sandeep Arduino firmware is better for MQTT as it is easy to use and also ready made libraries are also available for it
thanks
Do you think its possible to use the MQTT + Node MCU to receive an email or sms and output the data to an LCD 2x16?
+Sam Clare I am not sure. But I'll try doing this. Just drop your mail I'd,I'll let you know if I succeeded doing this
+Sachin Soni (techiesms) how can I give you my email without publishing it in the comments. I managed to get the Node MCU working with the 4x20 LCD. :)
Sir , How i get feedback of relay status
i want to used a temperature sensor to my NodeMCU. i can't figure out the ide code to send data to my feeds.
You can go for the Slider(Photocell feed) given in the example by adafruit
Hi, i have connection failed problem ,while connecting to mqtt.connected() and give me return value -1
send the screen shot of error on whatsapp. +91 82000 79034
mqtt works on local network?
like arduino based esp88266's web server
+kamal sonani No.
It's like you can control from anywhere in the world with your smart phone having internet pack..
In the video also
I am using separate internet connection for smart phone and esp8266
So it's not a LAN connection
Hi,
Great video. Thanks.
In need some direction here :
My ESP8266 module connects to “test.mosquitto.org” and subscribes to a topic say “b1”. What ever is published to “b1”, it can read it immediately.
Problem happens when my second ESP8266 module subscribes to “test.mosquitto.org” to “b1”. It continuously returns :
WiFi connected
IP address:
192.168.0.9
Attempting MQTT connection…connected
Message arrived [b1] 0
Attempting MQTT connection…connected
Message arrived [b1] 0
Attempting MQTT connection…connected
Message arrived [b1] 0
Attempting MQTT connection…connected
Could you kindly suggest what might be going wrong. I look forward to your advice.
+Siddhartha Chatterjee can you send me the code so I can study and come to any conclusion
Hi Sachin, Thanks for your reply. I could manage to figure out the solution. It is working fine now. Regards.
+Siddhartha Chatterjee Great to hear that!!!
But will you share the problem and also the solution here so that people facing similar problems can be helped
Hey Hi,
I was using the same clientId for bother the ESP8266s. This was creating a clash.
The problem gets solved by using different cliendIds for each ESP8266 as then there is no clash.
Cheers !!
why when reset esp lost connection and when to generate another key it work
.any solution for this problem, thx
+ahmed ali I never faced such problem
Let me analyse
Mail your code at
sachinsms1990@gmail.com
Can we also integrate Alexa with this MQTT along with FTTT ?
+Zulfiqar Aadil yes
Can you explain mosquitoe broker
GREAT VIDEO SACHIN. I COULD NOT GET INTO DASHBOARD. PLEASE HELP ME.
just logIn to your account and after that go to the address, io.adafruit.com/username
for eg. my username is sachinsoni, so that address of my dashboard is
io.adafruit.com/sachinsoni
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
my mqtt connection cant established shows the above error
+ABHI KHANDELWAL mail me the error and the code you r uploading
Thanks for a tutorial
someone pls help,i cant find the dashboard
Hi techiesms This is Abhishek , I AM trying to create iot using standalone ESP8266 -01 . I have created my own app and also webserver . Problem is that I works fine for some time but then it stops working I.e blue light that keeps on blinking in ESP stops and it gets freeze . This usually happen when I connect AC source to relay. Other wise when I don't connect my appliance with relay. It works fine for long hours. I don't know what's the problem Please help me out. No clues in web i have found. Almost same thing happend when I tried creating using arduino nano and ESP. That after some time it stops responding. Please help me Please help...I am waiting for reply .... I have changed 3 ESP to confirm whether my ESP is fine or not....
+Droid Developer that's a great coincidence.
Actually I'm too facing that same problem of switching relay through ESP which I'm doing for my next video.
That same blue LED freeze when I connect relay.
Still I didn't find the solution but will soon fig out and will be making project tutorial video on it
So just subscribe my channel to get notified for that upcoming project
so there must be error in the code. When the code gets stuck in infinite loop doing nothing, the wdt overflows and it get reset
I made the video for solving that problem.
Have a look
ua-cam.com/video/3YG9uvCiHR0/v-deo.html
Bro can u use Ac Appliance with relay to make sure its not restarting .
That much was working fine with my setup i.e relay was switch fine without any appliance but when any appliance is connected it restarts randomly. Please do check . And also check using arduino serial monitor to check restart issue.
How can you get AIO server Port ?
how can i get the arduino code in this video ?
Sachin Soni (techiesms) hi ... i want to know how we can u
se mqtt and nodemcu to unlock door using RFID card and the unlocking of door automatically switches the light on of that area ..
+yuvraj upadhyay this can be done. But using WiFi and Mqtt is not at all useful in this application.
You can just use arduino board along with RFID reader module and connect all the appliances and electronic lock with wires. This will be cheaper and also easy to make.
If you use nodemcu then you need to attach wifi module to every appliances
yes actually i want to use nodemcu (as we all know its a it uses Aurdino enviorment) and i have done half part but how to use MQTT on it i'am not able to figure it out ...so i need help regarding that ..
+yuvraj upadhyay ok so let me know what you have done and what you want to know or how can I help you
so first step what i have done is
1>we have used the nodemcu coded it and linked up with the RFID setup .... which when scanned on the scanner opens the door and updates the RFID id of the person ...
2>now what i want is the next step i want to use MQTT protocol in a view to make it secure (MQTT all of us know is secure ) so how can it be done im not able to figure out how to corelate MQTT with the part that i have done
+yuvraj upadhyay just mail me
We will continue with mail
sachinsms1990@gmail.com
Nice sir,
Do you perhaps know of a php library i could use with adafruit mqqt broker?
+Rockson Kwame Agyeman I have bonuses about this.
But will let you know if I find any answer for this
In Adafruit control only 5 upto D4 why another pins can't control. Only 5 pins control
You need to change the Adafruit MQTT.h file
Their change the Max Subscriptions from 5 to 10
help me bro ...final year project .code error
I've done everything you have said but in the end i am getting some alien messages in the serial monitor after uploading.
for e.g. ^EpÉ4AHäMÐipÍ'$ü
I am also getting a message after uploading that WARNING: Spurious .github folder in 'Adafruit MQTT Library' library
I've been sitting with this thing from the morning but unable to figure out what next. Pl help
Check the baudrate both in Serial.begin() in code and in serial monitor. They must be same.
sketch_feb07f.ino:25:27: fatal error: Adafruit_MQTT.h: No such file or directory
it works but took a very long time to turn on and off the light. I don't know what's problem
It happened with me also. In my case the problem was slow internet connection
now its working fine,,thanks anyway..i would like you to do more videos on IoT
+hemanta phurailatpam I am working on that. May be I won't be uploading through this UA-cam channel but you stay updated with my fb page which says fb.com/techiesms
I have some doubt in this video are you ready to help me . anything please reply me you're my only help
Yes
techiesms i have some doubts in connection with wifi
Whatsapp me 8124888469
I have sent the message to your whatsapp
sorry i know i ask you many questions :D
my question is i want to connect switch and when on/off by switch the button state in dash board also change can you help me and how get dash board in mobile app (the same dash board on IO-Adafruit),thx
+ahmed ali no problem buddy
And you can definitely get the data on your smart phone through any MQTT app
And you can get it by physically pressing the button on ESP12e board
In the code
First subscribe to a topic and see whether the switch is pressed or not
And if switch is pressed
Publish a value in that topic
Easyyy
send state of led to broker when button pressed maybe i can do it ,but how change the state switch on dash board ,in other words how can i tell the switch new state from esp ,thx
+ahmed ali see
It's not a physical switch on the dashboard
It's just representation of data in memory.
Or we can say the it will show the last data updated in that particular topic
So if you are publishing some value in particular topic on which switch of the dashboard is subscribed, then the switch will also toggle it's position according to the new data updated.
Summing up my point
Just publish 0 or 1 in a topic through your esp
And also make a button in the dashboard with the same topic as that of you are publishing value.and observe the changes
Sachin Soni ok thx
I can't Understand why if I Upload the ESP8266 WiFi Scan Example, It can see my SSID WiFi ( I have three at my home). But With your Example, it stop at the first Step, It is waiting to connect at my WiFi, and doesn't work. It stop with many .............................................................................. and don't go ahead. I put everything I need like your example.
this means that you must have entered the wrong ssid name or password.
Or it can be like you accidentally have attached space after of before your ssid name or password. For example
"SmS " > this is wrong as I have a blank space at the end
"SmS" > this is correct
If still the problem is not solved, do send me the code, I will debug that
Hi your project is nice. can you post the code for this. i want to make replication of this project.
visit my blog on MQTT on my website, you will get code there
www.techiesms.com
get error alot
do to you have upload scrip
want to copy
i created an account on Adafruit and i can;t reach my dashboard
any help ,thx
goto
io.adafruit.com
on the upper right corner click on signin and than login to your account
Next page will be your dashboard
Sachin Soni thanks
Can you send circuit diagram or source code plzz
how can i make my own mqtt broker. I dont want to use any third party broker for my IoT project
+Rohit Mathur
I don't know how to make a global broker
But yes, you can turn your raspberry pi board as a Local MQTT broker
I have set up my raspberry pi as MQTT broker. The broker is working perfectly fine. But the client is not getting connected to the broker. On the serial monitor, I get "Attempting MQTT connection...failed, rc=-2 try again in 5 seconds" Client.state() returns -2. I believe -2 means the network connection couldn't be established. I hope that you could help me out to get this resolved. Ur help has always taken me a step forward. Visit goo.gl/eDodKJ. You can see my exact problem with the code I've been using.
while (( subscription = mqtt.readSubcription(5000)))
it is not going into the loop
no errors in execution
can u fix this
the same code I used as urs and also created a adafruit dashboard with two attributes under a feed name called project which consisted of Light and Radio
and also I have many doubts in this could ple give me ur mail I'd where I could send all my doubts
sachinsms1990@gmail.com
Nodemcu ko kese openhab se connect kare
Thanks a lot for your video :).I understand a lot of things
if you liked it, simply share it.
can you give me the code of arduiono
Bro this machine work from long distance
Yes
@@techiesms how much distance its maintain
From anywhere in the world
It’s working on internet
@@techiesms i want to make this project
wah bhiaband saru hto video mazza avi... bnavo aava video hu pn embedded engineer chu.. gandhinagar... subscribe my chnal too bro.
Code link
you could have finish this video within 5 minutes..
Please give me suggestions
plise help