How to add WiFi Control to any project || ESP32 Beginner's Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
as you might know I created this 10 by 10 RGB LED matrix that can display mesmerizing pictures and animations doing a previous project video and while it is certainly an eye catcher I think it is a shame that once you upload your animations to the button Arduino Nano you can only watch the LEDs going through the codes and not select your favorite light show whenever you want that sounds like a job for the esp8266 which is a microcontroller with built-in Wi-Fi that features 160 kilobytes of memory 16 GPIO pins SPI I squared C 8 squares and a DC and much more seems like a suitable choice for a project but recently and with recently I mean in 2016 the successor of the esp8266 was released the ESP 32 this one offers a higher clock speeds more memory Bluetooth supports more gpros at DAC and even sensors like the temperature Hall or touch sensor so even though this mug controller is definitely an overkill for my project upgrade I will show you in this video how easy a-slash difficult it is to use such a microcontroller and in the end demonstrate how you can use it to control any kind of project through Wi-Fi let's get started [Music] first off we should visit ESP 8:32 nets which does not only offer tons of information about the microcontroller links to different tutorials and details about all the different development boards but also a list of the currently available development software while there's a variety to choose from I want to be lazier and stick with the one I'm familiar with the Arduino IDE after clicking the link akita page was presented which offered the Arduino core for the ESP 32 perfect to install it I simply followed the given installation instructions which means I installed the newest arduino ide version followed by the installation of kits and afterwards use the program to download the github data and moved it into the corresponding Arduino folder once that was done I started the arduino ide and noticed a couple of new ESP 32 options in the broad selection section of the software but the question was which one to choose now I got my ESP 32 boards for cheap from China and luckily it was not only the manufacturer mentioned on the back but the exact board type was also listed in the board selection that means it was time to connect the ESP 32 to the computer and have a look at a couple of the included example sketches as you can see there are quite a lot of different functions of the microcontroller presented through the example sketches and even the github page says that most of the framework is implemented only the analog right function is missing but you can use alternatives for that so as a first test let's see whether the whole sense of sketch works after opening it all we have to do is to check whether the comport is correct and then click uploads as soon as the software says that it is connecting we have to hold down the boot button on the ESP 32 boards until a successful connection was established afterwards at the upload executes automatically and after opening the serial monitor and changing the baud rates we can see that by bringing a magnet close to the ESP 32 the values of the serial monitor increase or decrease depending on which pole is aligned with the microcontroller of course this sketch has a more visual appeal when using the serial plotter but either way it means that the codes and ports functions correctly so after I tried out a second sketch the touch read sketch which changes the values of the serial monitor according to bother I touch a specific pin it was time to control the LED matrix the Arduino code I used so far utilized the fast LED library to control the ws2812 addressable LEDs since they require a precise timing of the high and low states which represent the decision 1 and 0 luckily though the ESP 32 is apparently supported by the fast LED library so I created a simple example codes uploaded it to the ESP 32 remove the data wire from the arduino and instead connected it to the pin 23 year of the ESP 32 which i defined beforehand as the data pin after then connecting the ground of the ESP 32 to the ground potential of the matrix and powering it all through my lab bench power supply we can observe two problems but firstly it is a positive aspect to note that even though the ESP 32 sends out 3.3 volt signals the 5 volts ws2812 IDs seem to react kind of accordingly even though the datasheet states a minimum data in voltage of 3 point 5 volts but then again random colors seem to light up periodically and the test animation of the troubling white LED is way too fast it seems like the delay function was altered through the fast LED library so in conclusion I cannot use this library year for the LED matrix upgrade thankfully though I assume found the ESP 32 or digital RGB LED drivers on github it seems to utilize the on T peripheral of the Mac controller which is the remote control module driver for infrared remotes so to test it I downloaded the github files open the included demo sketch uploaded it to the board connected it back to the matrix and powder roll-up in order to see that this code seems to work just fine as a last test I altered the code in a way that it is basically the same test code I tried earlier with the fast LED library with the only difference that this time the code broke flawlessly which means it was time to add the Wi-Fi parts to the project upgrade the example sketches for the ESP 32 contain a simple Wi-Fi server sketch which is basically exactly what we needs after including the SSID and password of my network I uploaded the codes check the IP address of the ESP 32 through my router enter this IP address in a browser and was greeted with the texts which was programmed beforehand on to the microcontroller here we can select whether we want to turn on or off pin 5 which doesn't affect work if we measure the voltage at the pin with a multimeter that means this concept of Wi-Fi control would just work fine but I actually do not want to control the LED matrix of to a browser so removed most of the server client codes and replace it all with a few simple lines which simply check what was entered after the IP address of the entire URL in this example I have to enter slash picture slash one to turn on the GPIO pin or slash picture / 2 to turn off the GPIO pin but since I do not want to turn on or off a GPIO pin I change the code once again to alter the value of a variable called picture in stats which I can use in the codes to activate different LEDs and thus create different pictures which after short tests seem to work flawlessly with the LED matrix of course those are only static pictures if I would want to create fluent animations I would have to check periodically whether Wi-Fi client is available which means we would need a timer interrupt or something similar so let's rather not focus on this typical problem right now instead let's get rid of this annoying URL and to ring every time we want to change the picture for that I visited the MIT App Inventor websites which is a very easy way to create your own Android applications there I created a new project editor text box for entering the IP address two buttons to switch between the two pictures and the web connectivity feature next I moved on to the block programming section of the app which simply contains of two blocks which say that when a button is pushed we want to set the URL to HTTP slash slash the IP address we entered in the text box slash picture slash one or two afterwards we simply execute the web cat commands which enters the URL and the project was complete all that was left to do was to install the app on my phone and giving it a try now as you can see here entering the IP address does work without a problem but once I click a button there is an error message popping up it basically says that we get no information from the server since we use the web cat function but since it entered the URL anyway the program does in fact work with the LED matrix we have the problem at this point we could of course improve the Android app and te SP 32 codes even more to get rid of the error message or add more buttons or playback fluid animations and whatnots but I think this project so far already gave you a good idea that it is actually not hard to utilize the ESP 32 in a project needless to say a couple of functions do not work perfectly yet but most of its work certainly good enough to create a few dozens of awesome projects and with that being said I hope you enjoyed watching this video if so don't forget to like share and subscribe consider supporting meer through patreon to keep such videos coming stay creative and now we'll see you next time
Info
Channel: GreatScott!
Views: 1,552,914
Rating: undefined out of 5
Keywords: ESP32, esp, 32, 8266, esp8266, arduino, tutorial, diy, how, to, beginner, beginners, guide, project, wifi, WiFi, control, add, ide, test, server, web, internet, iot, of, things, app, application, MIT, inventor, LED, matrix, animation, switch, easy, simple, hall, touch, core, instal, git, GIT, ws2812, electronics, greatscott!, greatscott
Id: ZAqNKaX3LQ0
Channel Id: undefined
Length: 10min 44sec (644 seconds)
Published: Sun Oct 01 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.