Connect your ESP device to WiFi with this Flutter/Dart package

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone this is the esp smart config package at the moment of recording this video this package implements esp touch and esp touch v2 protocols of smart config provisioning ok let's slow down what is smart config and what is esp touch protocol if we ask google about smart config we can see that the smart config is a provisioning technology that connects a new wi-fi device to a wi-fi network it uses a mobile app to broadcast the network credentials from a smartphone or a tablet to an unprovisioned wifi device in other words the idea behind smart config is to allow an unconfigured iot device to connect to a wifi network without requiring a direct connection between the configurator and the device itself it's pretty interesting isn't it but how is that even possible this is how a standard activation procedure works the iot device sets itself in wi-fi monitor mode and starts to capturing every wi-fi encrypted package over the air the configurator opens the iot device app and sets the wi-fi network name and wi-fi password after which the configurator starts the activation process the application encodes the wi-fi credentials into the length field of udp broadcast packages which is then sent to wi-fi access point packages are encrypted but the length is still readable the iot device reads the length of the captured package and decodes the wi-fi credentials at the end device connects to the wifi network and advertise itself to inform the configurator about successful connection once when we have learned what the smart config is let's get back to the esp smart config package this package is written in plain dart language which means that this package can be used basically on any modern platform like android ios windows linux and mac os with the help of this package we can easily implement provisioning process into dart or flutter application in this video i will show how to send wi-fi credentials to the iot device from the pc by making dart console application same procedure can be applied if you want to implement provisioning procedure in your flatter app and run it on your mobile phone okay here i have opened windows terminal and i'm going to navigate to my desktop where i want to create a new dart console project for creating a project i will use next command dart create then for the template i will choose console and for the name of the project i am going with smart config dart ok project is created and i will open it in the visual studio code with the command code and then the name of the folder file with the name smart config dart dot dart in the bin folder is the entry point of our application and i will remove this template code that comes with newly created project to add the esp smart config package to application i will use the next command dart pub add esp underline smart config ok now we can start with the actual coding of our app first i will create new provisioner that will use esp touch protocol if you want to use esp touch v2 protocol this is the place where you can do that then i will register new listener that will print me a feedback message in the time when the iot device is successfully connected to wi-fi network now i will invoke asynchronous method for actual provisioning that requires provisioning request as an argument i will create new request by calling static method from strings this method accepts parameters that will be sent to the iot device those parameters represents wi-fi credentials on which iot needs to be connected i want to connect device on the same wi-fi network on which my pc is currently connected to find out on which wi-fi i'm currently connected on windows i can execute next command netsh will run show interfaces i will copy ssid and bssid from this output and password is the password of my vp network as i have already mentioned the start method is asynchronous and we need to somehow make delay here otherwise our application will close immediately i will make a delay of 15 seconds that is enough for iot device to capture the packages and connect to wifi at the end we can stop the provisioning procedure and exit from the app ok application is ready for start but before that we need iot device that we want to connect to vp i already have esp32 device connected to my pc via the usb on the port com6 and here is the terminal where i can see the serial output of my device from the output we can see that smart config process is already started on the device and the device is currently in wi-fi monitor mode ready to capture our packages so let's go and run our dart application i will simply click on the run label above the main function shortly after the application is started the iot device has captured the credentials sent from the our app and successfully connects itself to the wifi network as a response in debug console of our app we can see the device sends back the feedback message about its connection from where we can obtain the ip address that is assigned to the device as well as its bss id and that would be the power of this esp underlying smart config dart package with just a few lines of code we can utilize the protocols of smart config technology and connect our iot devices to the world as i have mentioned before this same code can be used in the flutter applications so you can provision your iot device from the mobile phone tablet or any device on which flutter application can be run i think i will make example of using esp smart config in flutter application in the future if i do i will leave a link for that video in the description of this one and i hope that this package will be useful for your next project that would be all for this video if you like it as a support for the next awesome content you can consider to subscribe to my channel and leave a like on this video till the next time see ya
Info
Channel: Alija Bobija
Views: 16,871
Rating: undefined out of 5
Keywords: esp, esp32, esp8266, flutter, dart, package, arduino, smart config, esptouch, provisioning, wifi, network, udp, broadcast, monitor
Id: yjxtwQ8Xpuo
Channel Id: undefined
Length: 7min 25sec (445 seconds)
Published: Thu Aug 11 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.