Brian is the one who wrote the ESP8266 Youtube library that I used in the Nixie Tube Sub Counter video series. Here he is showing you all sorts of cool libraries for the ESP8266 module in this guest video.
Check out Brian's channel: https://www.youtube.com/user/witnessmenow
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
💗 Likecoin – Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3

Hi my name is Brian Locke and on my channel I do videos on Arduino Z'. I mainly use the Esp8266 microcontroller, which is the same one that they've used in his Nixie Tube Youtube subscriber counter. If you're unfamiliar with the chip, it's a three dollar microcontroller that can be programmed using Arduino. The best thing about it is though that for three dollars, you get a chip with built in Wi-Fi In Dave's video, he mentioned that there's a lot of different libraries and software available for the Esp8266.

For example, he used the Youtube api library which is actually one I rolled I Thought it'd be interesting in this video to go through some of the different libraries that are available for the Esp8266. The first library we're going to look at is one called Wi-Fi Manager Dave Briefly mentioned this in his video because there's an example of it in the YouTube API library. Basically, what it is is it's a way of configuring the Wi-Fi on your Esp8266 without needing to reprogram it. Wi-Fi Manager is really configurable and the documentation on the Github page is really good.

But the basic use case of it is is that your Esp8266 will attempt to connect to the last known Wi-Fi network. If this fails, the Esp8266 will host its own Wi-Fi network and you connect to that using your phone or your laptop or whatever. When you open a web browser, when you're connected to this network, you'll automatically get redirected to this configuration page. so you click configure Wi-Fi You enter into the details of your Wi-Fi network that you want the Esp8266 to connect to.

so this would be your home network or whatever and then when you click go, your Esp8266 will restart and it will connect to that. Network You won't need to do this every time your device starts up, these details that you entered are saved and flash memory. So this is what the Esp8266 tries to use on startup. so the only time you'll see this configuration page again in under the basic use case is if those details don't work for it.

so I'll cover some more advanced use cases in a minute. though. This is a Kickstarter that recently raised 183 thousand dollars. It's called Connected a line panel so it aims to be a replacement panel for your alarms at home that integrates with different IOT platforms such as Smart Things and Home Assistant.

If we scroll down to see a picture of the inside of it, this is an old MCU board which has an Esp8266 on it. So this project will definitely have some form of Wi-Fi Manager. If it doesn't actually have the Wi-Fi Manager library installed, it will have some way of when you plug it in for the first time hosting its own network to allow the end user to configure it for their own. Wi-Fi So like this: Wi-Fi Manager is even enabling commercial products as well.

Wi-Fi Manager is available to install through the Arduino Library Manager. So if you just go to sketch include library Manage libraries and when that loads up, if you search for Wi-Fi Manager, you can install this one here by Zabu and just click install and then just as Dave did with the YouTube API library. If you go to examples, you will now have new examples for the Wi-Fi Manager and you can play around with the different ones of these. So the most basic one is Auto Connect.
Basically all you need to do to add Wi-Fi Manager to your Sketch is you include these three libraries up here. You initialize Wi-Fi Manager in your setup and then you add this line Wi-Fi Manager Auto Connect. So this will create a Wi-Fi network called Auto Connect Ap. If it fails to connect the Wi-Fi network, you can look through the other examples to get more complex use cases.

Also, the github page has pretty good documentation. Another great feature about Wi-Fi Manager is it allows you to enable custom configurations inside this configuration page. So for example, this is looking for an MQTT server. but if we go back to the Youtube subscriber counter, we could enable one for the Youtube api key and we could also enable one for the channel ID.

So this is great for two reasons. Number one, from an end-user perspective, you could ship them a device, they'll be able to configure their Wi-Fi on it, and also they can enter in their own YouTube API key and the channel ID of whatever channel they want to monitor. and then from a code perspective, it keeps these private keys and information completely out of your sketch. so you do need to handle what you do with them when this configuration happens so you can store them somewhere persistent like EEPROM but the Esp8266 has something called Smiths which I'd recommend using instead.

It's kind of a flash storage system. works kind of like an SD card, but you don't need any external hardware, so this allows you to upload your exact sketch to github and not be worried about sharing private information with anyone. This brings a new problem though. Previously, if you're only using it to configure your Wi-Fi details, your Wi-Fi details.

failing to connect was a pretty good indication that you needed to configure something. But now what if you want to configure your Google API key or your channel ID but you're still connected to the same network as before. We need a new way of entering this config portal so we can do something like on the press of a button or if you hold this button down at startup, enter into the configuration mode and that's all fine. but I Find the best way of doing this is using another library and we'll take a look at that now.

Double Reset Detector is a library with a pretty descriptive name. Its purpose is to detect when the reset button is pressed twice. It's pretty simple, but it's very useful. We can install Double Reset Detector the same way as we did with Wi-Fi manager to the library manager.

When we have it installed, it will add new examples so if we go to the double Reset Detector folder and then minimal. As mentioned, this library is really simple. Basically, we need to pass in a timeout and that's the amount of time in between two resets where the second reset is considered a double research and also an address. When this method is called detect double reset, it will check an area in persistent memory for a flag.
if it sees that that flag is there, this detectable reset will return true and it's considered a double reset. If that flag is not there, it will return false and it will also set that flag inside our loop. We called Er de Loop and basically what this will do is after the specified timeout, it will set that flag to be false again. So the next time the tie double reset is called, it will return false.

If we look at the example in a bit more detail on detectable reset returns true, it turns the built-in LED to be on which is active low and if it returns false, it'll turn the built-in LED off. So I have this example running on my board here. So when I press reset once, the built-in LED stays off. if I press it a second time since it's it within the ten-second time limit, the LED will turn on and if I press it again, the LED will turn off.

So this is useful if there's something you want to configure at the startup of your project. So for example, what? Wi-Fi Manager: When it detects double reset to be true, you want it to launch into config mode, else just let it flow true as normal. If you check out the YouTube API library, I have an example that has double reset detector and Wi-Fi manager working together. The next library I'd like to cover is another one of mine and it's for Telegram Messenger.

If you're not familiar with what telegram is, it's very like Whatsapp. It's basically a multi-platform messaging client, but it has some additional features such as BOTS. So this is a library I created that allows your esp8266 to integrate with the telegram bada. API So that means you're able to send messages.

you're able to receive notifications from it, so it's pretty useful to start using the library. You're obviously going to need to install telegram, but also, you'll need a bar token to get that you search for a user in app called bot father and then when you message him, you'll get a list of commands and you want to type in new bar and follow the instructions. One thing that's important to note is that your bot will not be able to message you until you start a conversation with it first. So if you just click the link here and click the start button, your bot will now be able to send you messages.

This library can be installed through the Arduino Library manager. So if you just search for telegram and install the one with my name because I think there's one for erred, we know 101 boards and you will also need to install the Arduino Json library the same way as Dave did for the YouTube API library. So again, there is examples that come with the library. So if we go to Universal Telegram Bot and then the Esp8266 folder, there is a good few different life examples.
So Echo Bot is probably the most straightforward. So you would enter in your Wi-Fi details here, enter in your bar token. This is just standard code for connecting up to the Wi-Fi inside the loop. It will check telegram every one second for updates.

so this one second can be configured and if it has a new message Nam new messages will return, not zero. So while no new messages is not zero, step through them and send a message back. so it'll take the chat ID from the received message and also the text from the received message. so it's gonna echo back.

Whatever you send the bot back to you and it will keep checking. get updates until Nam new messages zero. This is the most basic example, but there's several other ones to go through. If you're looking for more details.

I've tried to document all the features that the library has on the github page and with the included examples. but if you find something lacking, make sure to give out to me and I'll try update it the best I can. It's a show-off what this library can do. Here's something that I made earlier.

so it's Adafruit Fighter huzzah which has an Esp8266 on it as well. It's got a Neopixel ring and it has a button so when I press the button, I should receive a notification. Yep! So it just took a couple of seconds to get through. but there's the notification that the message was sent.

But I also have these onboard keyboard options so if I click the red it will turn the Neopixel ring on. it's very bright. If I change it to green, it'll set it to green and if I set it to blue, it'll change it to blue. I can request the status.

the new ring neopixel ring is now blue and then I can turn it off. This can be useful with any project. say for example, instead of having a button to send you a notification, you had an LDR instead. So if the room was too dark or too bright, it might send you a message or the same with a temperature sensor and then with the commands that could be used for basically anything.

If you want to turn on and off a motor or if you want to even send text to a screen. that's possible too. So I think it's really useful in the interest of time I Just want to quickly mention a few more libraries that I think are really useful for the Esp8266. The first one I'd like to mention is one called Blink and this one's a little bit different because you don't actually need to write any code for the esp8266.

You install a set sketch and then you do all the configuration on your phone. So you just set up an account, you get a token and when you set up your app, you then install a sketch onto the esp8266 that you get through the library and as you can see the library or the sketch doesn't have any configuration in it, it just has the or token and then it does this blink that run. So if you want to turn on and off an LED from the blink app, you're configuring all of that including hot pin that LED is on in the app so it's a pretty useful one. The next one I'd like to mention is another one of mine.
It's an Arduino Coin Market Cap API library. So this is used to get cryptocurrency prices from Coin Market Cap so they support basically any cryptocurrency so it's an easy way of getting the live price of any cryptocurrency on your Arduino projects. Mac Lighting is the next software that I want to look at. This one actually isn't a library, but it's nearly more of a collection of libraries.

So it's a piece of software that's used for controlling Ws2812 S which are addressable LEDs and they're also known as Neopixels And so not only does it give you a web interface to control these Neopixels, but it also provides an API around them so you can control them from different devices such as your app or your phone. So the API is it provides is a REST API a WebSocket API and also one for MQTT so it's really useful. This one is a another one of mine. it's the Arduino I have TT maker so there is a trigger and IFTTT or if this then that and that was called maker I Think it's now called web hooks but it still works the same so this will is a way of triggering that.

So this would be the if part of an if this then that from your Arduino board. So this is a cool way of say you have a moisture sensor attached to a plant. You could get your plant to do anything you wants that IFTTT supports. so maybe post a Twitter to say hey, water me or whatever you'd like to do.

And finally this is another one of mine. It's around the Google Maps API so if you want to check the live travel time between two positions on from your Arduino project, you can do that with this. So you just need to sign up for a Google Maps API. It's the same as signing up for a YouTube API basically.

and then you can do that. You can also be used to compare the travel time between multiple different routes. I built the project before for a friend buying that showed the quickest route home from work to where he lived. Hopefully you found this video interesting to jump out in front of a question? I'm sure I'm gonna get asked in the comments, why wasn't this video on the ESP 32? To put it simply, the ESP 32 just doesn't have the same library support that the Esp8266 has.

I think 2018 will be the year of ESP 32 passes it out, but it's just not quite there. If there's any other libraries that have missed out on or any pieces of software you'd like to share, please put them in the comments below. Thanks a lot.

Avatar photo

By YTB

22 thoughts on “Guest video: brian lough – esp8266 libraries”
  1. Avataaar/Circle Created with python_avatars Sultan Mehmood says:

    Great video

  2. Avataaar/Circle Created with python_avatars Charles Goehring says:

    Great contributions to the community.

  3. Avataaar/Circle Created with python_avatars Marc Paradis says:

    You should update ur libraries with arduino json 6

  4. Avataaar/Circle Created with python_avatars brainfornothing says:

    Is interesting see your hair "evolutioning" in real time 😀 Hehehe ! Thanks !

  5. Avataaar/Circle Created with python_avatars Short to Ground says:

    My last project was a GPSless tracker using only the ESP8266. So basically it sends beacons with position to an IOT website via fon.
    wake up
    scans networks SSIDs
    tries connect to fon
    login fon
    sends local SSIDs to google maps api
    gets position
    gets time
    posts to iot map website
    sleeps

  6. Avataaar/Circle Created with python_avatars Lucas Dixon says:

    Proof exception alcohol start constantly horse output transfer not show.

  7. Avataaar/Circle Created with python_avatars GRBTutorials says:

    The ESP32 is great, but for accessing its interesting advanced functionalities, like Secure Boot, flash encryption or the ULP coprocessor (which must be programmed in ASM), you must make an effort and learn ESP-IDF, which uses FreeRTOS. I'm doing that because I need the advanced functions and it's probably faster. Also, it updates faster (they updated ESP-IDF first to patch KRACK, the biggest Wi-Fi vulnerability since WPA2 was implemented)

  8. Avataaar/Circle Created with python_avatars Maksim Sokolov says:

    Thanks Brian, subbed. 🙂

  9. Avataaar/Circle Created with python_avatars Thiwanka Wimalasuriya says:

    These Gust videos are a very good idea.

  10. Avataaar/Circle Created with python_avatars groove jet says:

    esp 8265 wasnt it?? Shiiiiiiit!!

  11. Avataaar/Circle Created with python_avatars Persona says:

    Wow, that's incredible stuff! Just wish the video had come earlier — I had a ton of work with the ESP8266 in my classes last semester, would have been useful then 😛

  12. Avataaar/Circle Created with python_avatars Jens Jensen says:

    A piece of feedback, the text in your arduino ide session is a bit small to read. Might want to increase the font size a few points for screencasts.

  13. Avataaar/Circle Created with python_avatars ISO Guy says:

    Cool

  14. Avataaar/Circle Created with python_avatars Garry Keogh says:

    Well done Brian, onwards and upwards. A busy 2018 to maintain this trajectory 🙂 Best regards from the east side!

  15. Avataaar/Circle Created with python_avatars Fanta BH says:

    EEVblog or Dave , can your community , your viewers help all small youtubers to not die in one month , I mean not die on youtube, as google announced from today in 30 day's they going to suspend monetization on all channels which have not reach threshold of 1k subs and 4000 hours of view during last year. So bye bye many small youtubers. It is truth that I started being youtuber in hope to make some extra money and I never succeeded with that. Life here where I am is not just hard, it started to be way to hard. In last 2-3 months my monthly income can not cover regular monthly bills, and with every day it is worst and worst. 6-10 $ per month on youtube is nothing but still I do make videos and will continue with that, it just started to be part of me part of my life. I just hope that I will not have to cancel my internet in home, to save some money. Well till I have internet I will be around here I like what and how you doing Dave. And still thank you big time in name of all guests on your channel , that what you did for smaller youtubers is really very nice from you, it shows to all what kind of man you are. Wish you everything best in your life.

  16. Avataaar/Circle Created with python_avatars Manick N says:

    A little over my head at the moment but I intend to get into it. I will go back to your channel when that time comes.

  17. Avataaar/Circle Created with python_avatars lanz1987 says:

    I really enjoyed this video, a lot of substance no flash. New subscriber 🙂

  18. Avataaar/Circle Created with python_avatars Łukasz Szakuł says:

    You can add your own code to blynk sketch and virtual pins…

  19. Avataaar/Circle Created with python_avatars aszi88 says:

    I think they should have given the ESP8266 some catchy, easily remembered name like the Arduino. Nobody wants to hear about "ESP8266".

  20. Avataaar/Circle Created with python_avatars Mert Kırımgeri says:

    Wow thats serious.I specificially liked the maps library. It could be quite useful. May be I'll try to write my own library😄

  21. Avataaar/Circle Created with python_avatars TheGame402 says:

    I totally have to get all my plants twitter so they can tweet me "Water me bitch" every now and then.

  22. Avataaar/Circle Created with python_avatars lacombar says:

    No more original content… 'guess I'll unsubscribe soon…

Leave a Reply

Your email address will not be published. Required fields are marked *