How to connect and use the low cost ESP8266 WiFi module with the Arduino environment.
How to connect with a Youtube API to retrieve channel statistics, using JSON on the Wemos D1 Mini.
Nixie Tube Project Part 7
Forum: http://www.eevblog.com/forum/blog/eevblog-998-how-to-program-esp8266-wifi-with-arduino/'>http://www.eevblog.com/forum/blog/eevblog-998-how-to-program-esp8266-wifi-with-arduino/
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
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, let's take a look at the Esp8266 a very cool little Wi-Fi module chip that allows you to and basically add Wi-Fi into any project you've got for like a couple of bucks. Fantastic! So let's take a look at it. Not only can you add it for a couple of bucks, but it also now has add we know integration. So you can actually program this thing which is not not we know, but you can program it with the Arduino Ide and it's really incredibly simple to do.

So let's take a look at it because there's actually three different things going on here. One is the actual chip which is under this metal thing here, and that's made by a company called Expressive. And then there are these modules here, which is the black module with the caste elations on there soldered onto a base board, which is the third thing over here. In this case, it's a we Must D One Mini.

So there's three different things going on here. So for the first part of this is the actual Esp8266 chip itself and that's made by a company called Expressive. And yes, you can just buy the chip and integrate that into your product. but you know a lot of people don't do that because they're so cheap as I'll show in a minute and the module based things.

It's just easier to use the modules, but if you're saving, you know, penny-pinching saving every cent. Integrating a real high quality product, you could just use the Wi-Fi chip itself, but then you've got to add the external antenna and a couple of external parts there. It says that their minimum is 7 external component and it basically it uses a 32-bit 10 C Lea Control Micro in it. It's a 16-bit RISC processor runs a real-time OS It's got a Wi-Fi stack and all that stuff to make it work.

It's got low power management, although Wi-Fi is not hugely low-power so you can't run it from a coin cell for example. That's why you do like something like that you use Ble. The loads of power are bluetooth and so it's basically the chip in there and we won't take a look at the datasheet and everything else. So if we have a look at the Wikipedia page for the 80 to 66, you'll see that it comes generally on these little modules like this and if we have a look at these, these are actually manufactured.

These modules are manufactured by a third party company called AI Sinker and there's generally different ones and these are the most prevalent ones available. Everyone seems to be using these. What we're going to. The one we're going to look at today uses the ESP 12, F, or 12s and it's got four Meg of flash memory in there I Think it's 64 K of RAM and you can run applications on this process.

You don't need any other external micro or anything, so it's more than just a Wi-Fi interface. You can actually run applications and programs on this chip on this module. It's fantastic. So the next level out from that is people take these companies, take these AI Thinker modules and then they add them onto more useable boards because the the cast elation ones are great if you want to.
The cast elations are the small little cutouts circular half hole cutouts on the side that allow you to surface mount it onto your own board. Great for a high-volume product. Not so good for like one-off stuff and things like that. So third-party companies make these boards that you know are to fruit.

do a Hazara and Ollie mechs do one and there's you know, a whole bunch of them. One we're going to look at today is the We Mas D One mini. The They sell a couple of different ones, but it basically takes the ESP 12's module there and it puts it on a more usable board with the pins. Because this chip has the eighty 266 has up to 1600 pins and Scott Urs and ADC interfaces and all sorts of stuff.

so it just basically breaks these out. So this is a three level solution that we're playing with here and this is only like five or six dollars for the We Must board. I Got it for like on eBay for nine bucks Australian from an Australian supplier delivered Interestingly I Think my seller actually gave me a dodgy like a fake one because it hasn't got the rounded corners it hasn't actually got we Must written on it although that sort of advertised as so I think actually got a fake one. So anyway, we're going to use the We Mas D 1 mini in our example today, but just be aware that the Esp8266 could be up to a three level solution like this: The chip, the module and then the board.

Choose which one suits your purpose and these things are insanely cheap. Look at this Aliexpress for like a module based one that we've got here. Seventeen bucks for ten a dollar seventy each. or you can just buy like the A I think of my choice self, the ESP 12s that we're looking at here or the twelve F for eighteen dollars for ten a dollar a th.

Just like think you can probably even get them cheap and that you know, imagine what they you know, get them cheaper in volume if you're manufacturing 10,000 items or Southern's just nuts. And the We Mas module we're looking at here comes in the pro version, the mini and the light. We just happen to have the mini. They've got little display shields and all sorts of you know it was all sorts of variants on this.

So if we go in and have a look at the we must see one minute for US dollars from we Must on. Aliexpress for box Insane And you've got to remember this is for box frame module. that's not just a Wi-Fi module, it's a complete processor with a DC's IO and everything. you can run applications on this.

It's got four mega flash memory like 64 K of RAM or whatever it is and just amazing. This is a complete solution for a Wi-Fi product. You just hook sensors up to it and a battery and Bam Done! So how do we program this wonderful little widget? I'm glad you asked. Expressive ever released various our SDKs over the years and various these various tool change GCC and all that sort of stuff.
and you can get a basic version and Zed basic and all sorts of stuff. But by far I Think the probably the easiest way for any beginner to get involved with this is to use the Arduino environment. so you can actually I get an Arduino plug-in for this that allows you to use the Arduino IDE No, it's not another way. no compatible board.

it doesn't use the app metal processor with it. like nothing to do that, they're just using the Arduino IDE and everything to make it easy and I'll show you how easy it actually is. So what you want to do is go to the Github repository for the Esp8266 Arduino environment and so hats off to the people who have written, personal, people who have written this and are involved in this project because it's absolutely fantastic. Doesn't have names there, does it? But yeah, hats off to everyone involved in this because you'll see it's just great.

So what we do is we simply download this and we'll download this as a zip. So we'll just download that zip. It's not particularly big and we've got Arduino Master Zip. There it is.

it's downloading done. So what this is going to let us do is run Arduino sketches on this actual module so your regular Arduino environment that you used to when you go in here and go to boards like this, After we install this, we'll see it pop up as a board. So just like any other board that will work with the Arduino environment. Okay so what we have to do is go into our Arduino environment here.

We've got the latest one one point, Eight Point Two I'm not sure which version has previously supported it, but this one is going to work. So you notice that we don't have anything in here like this. So what we need to do is go into file preferences here and you'll notice that there's an additional Boards manager URL and we just copy and paste this one from over here. there it is dot JSON Arduino Esp8266, etc.

We cut and paste that one in there and if you've already got multiple boards installed, you just separate them with a comma like that so we should be ready to additional Board manager URL Done! So now we simply go into tools and we go into a Board manager over here. and it's downloading downloading because it now has that new address that we've got and Bingo! These are all our additional boards. Arduino, Sam, and we know Nr F50, - Intel I5, 8 6 boards by Intel they've added added Intel Curie board. All this sort of stuff.

So all these weird and wonderful boards that are Windows 10, IOT core and all that sort of stuff. A lot of big-name companies like Intel and Microsoft and they'd have gotten onto this Arduino thing and produced boards that are compatible with the Arduino environment. And here it is. It's automatically listed this because we've put in that address and where it can get the information from Esp8266 community.

We just want to install that. So click on install, it'll download all of the requisite stuff and you can see that this actually includes support for the Art of Fruit, Hazhar, and all sorts of boards node MCU and the We Mas board. So there might be other boards out there that are not particularly supported by this. They may still work in some way.
I'm not entirely sure I haven't tried them, but this one definitely supports our we Must board or where any of the other ones listed here. No worries. Now we've got Next 153 made to download modern software. Anyway, it works.

The amount of capability you get, you're damn right. I'm going to download 150. Yeah, 3 Meg No worries. installed.

Let's go check it out so we'll close that down and we go into tools and we go into board and Bingo. There we have it. SP 82 66 modules all the different supported ones including our We Mas D 1 and our 1 Mini. Awesome - easy, but there's more.

One of the great things about this. Not only have we installed our board in there so it has all the support for it, but it's also automatically installed all of the examples. So what do we want? Of course we want a Blinky. There you go.

Let's give it a go. And there's our example code Oh Too easy. But of course this doesn't mean diddly-squat unless we program our board. So let's plug it in.

This is plugging in for the first time and of course it's got all the USB to serial driver on the back and everything else and it's installing my device driver Here we go search in search in Usb-to-serial that will eventually pop up. Bingo! We're in like Flynn ready to use on the Comm 11 and we'll choose our comport. Here it is Comm 11 so we'll choose that and we're ready to go. Are we? Yep, we don't need to open the serial port, we should just be able to compile this and run and upload.

So we've got our board set to the we Must D1 mini. We'll just leave everything as default. Flash sighs This has a four Meg I'll just leave it all hunky-dory Port 11 Let's go here We go. Compiling Sketch could take a little bit because it's got lots of stuff to install.

It's got all the Wi-Fi stack and the whole kit and kaboodle, so that's to be expected. Archiving Builder Built Core: Sketch uses 22 222 K 21 percent of the program space for a legislature because it's got all of the Wi-Fi stack away. Blinky Blinky. It works.

Whoo-hoo That's how easy it is to program an Esp8266 in Arduino piece of cake. Just go back and look at the examples here. Just look at all these different examples: DNS Server stuff EEPROM stuff and we've got the regular blink with what we did. our TC and you can make it into an AVR ISP programmer so you don't need to apply an AVR ISP programmer HTTP Clients Update Updates: HTTP Update Server Mdns No idea what half this stuff is, but it's awesome.

Your own web servers as a holo server or your Wi-Fi our staff Client: Moldy scanning Ethernet Advanced Chat server Barometric pressure webserver Like all these example files, this is absolutely brilliant. If you want to do some encryption hash stuff I Guess as I said the SD card stuff, you want to hook up an SD card to this piece of cake cereal. That touchscreen stuff. Just brilliant.
Thank you to everyone who's written all these examples and built this entire core. It just makes it so easy. So let's demo the Wi-Fi features of this thing shall we? And by connecting to my our youtube channel to actually get my subscriber and view count from this thing so we can, Somebody's written that? of course you don't have to write it from scratch. so thank you very much.

Whitman Witness me now who's written this Arduino YouTube API It's just on the github here and which should be able to get out our subscriber and view count and stuff like that and connect. It's a good example that it's got to connect to the Wi-Fi connect through and so we can just simply download the zip for that and we can store that one too. Fantastic! Let's go. So what we do is we simply go over to our sketch here include library and add a zip.

Rot library. Like I said, you don't have to unzip these things which is fantastic and we select the Arduino YouTube API master. We open that and that Oh Yep, it's done. Library added Beauty So now if we go back to our examples, we should have right down here.

Examples from custom Libraries: This is great. This is what I love about the Arduino environments. Now so polished that these things are so trivial to install and get run in for. You know, some idiot like me to actually do it.

Channel statistics with Wi-Fi Manager: I Don't think I need the Wi-Fi manager, but here it is. We've opened it up and shut down the other window there and that is all the code we need for actually connecting to the connecting tip while connecting to Wi-Fi The all the stuff we install before for the esp8266 or handles all that. but this is all we need to connect. So I need to get my API he and I need to get my channel ID I won't show you those at my Wi-Fi SSID and Wi-Fi password and it should just connect.

Let's try it all right? So let's give this a bill once. First of all, we need to open the serial monitor here. If it pops up there we go. We've got our serial monitor that's Comm 11 and it looks like it's a hundred and fifteen K board here.

so we need to select that and we're good to go. Let's actually download this: I've put in all my credentials up the top with my API key and stuff like that, my youtube channel ID and Wi-Fi password. So let's OH Era compiling Oh Arduino JSON Oops Yep, sorry I forgot about that. So we go to the Arduino JSON Github here.

Thank you very much. Be blanchin so we'll download that and we'll install that once again just like we did for the previous YouTube API Easy. So we'll add the zip library again. JSON Master It is now library added to your libraries and we should now be able to compile that again and could take a while once again because it's got to compile a huge stack and everything else.
but there's not much code in here as you can see it. Like to connect to YouTube and get your stats. it's pretty easy. someone's done all the hard work for us.

Beauty We using 27% of our program space, 40% 47% of our memory so it's still alright. Oops. Mm failed. Nope, something went wrong.

What? What? What? Mwah. So what I did is just rebuilt that we'll try the end. I Just went up there and simply Reeve Arif I Compiled Done compiling. Okay, okay, so yeah.

I'm not sure maybe I didn't install their library. give it enough time I don't something like that? Anyway, let's see if we can download, shall we? So it compiles. Okay, so the problem is we programming the thing. I'm not sure why this is looking good.

Tada, we're in like Flynn We've got some garbage come up. But those dots yeah. Wi-Fi connected. There you go.

It could take a while to connect to the YouTube API but you can see it obviously connects to the Wi-Fi which is fantastic. So the compile worked, all the stack worked, everything else is connected to the Internet and bingo it just took a bit. I'm not sure why it took so long to pop up, but there it is. Stats Subscribe account.

Yep. Fantastic. That's all there is to program with the esp8266. even doing something to me that's really complicated because I'm not into the web programming you know side of things I can program embedded stuff all right, but all this you know, internet connected and JSON stuff and everything else A I'm clueless about but hey, people have done all these examples I can work from the examples and compile these.

That's how easy it is. So I hope you found that interesting and useful. If you did, please give it a big thumbs up. and as always, discuss it down below.

Catch you next time.

Avatar photo

By YTB

22 thoughts on “Eevblog #998 – how to program esp8266 wifi with arduino”
  1. Avataaar/Circle Created with python_avatars Yushldnomi says:

    Does anyone know what the commands are for the esp?? Or how to find them?

  2. Avataaar/Circle Created with python_avatars Ron Jones says:

    That cleared up so much for me. I spent all yesterday trying to figure this out, but today when I saw you video, it started making sense. Thanks Dave.

  3. Avataaar/Circle Created with python_avatars Agus Suwardono says:

    Technology & Humor in one… Absorb 100% 😁

  4. Avataaar/Circle Created with python_avatars Spelter says:

    To people in 2022: I've bought 20 of them in a batch to install them into my home appliances, only 3 are working, the rest is crashing with total different exceptions all the time. I've tried new bootloaders, patches etc, but no way, they are garbage. The seller is not sending a replacement, so the bargain was a real pain to me. I've ordered from a different seller in Germany, he sent me also just clones of the Wemos D1, but they are all working.

    I'm thinking, maybe the carrier boards have some trouble and the chip itself is ok, so I will desolder them from the PCB and try them again. If they fail, I have 17 PCB's I can use for single chips, which are a bit cheaper (and work hopefully).

    So watch out, compile a small webserver after the blink sketch, if that one works, chances are the SPI memory is ok.

  5. Avataaar/Circle Created with python_avatars shashi nair says:

    SIR can u tell me why NTPClientlib.h is not working. When it is included in esp8266 d1mini board it showing error "compiling error for board LOLIN(WEMOS) D1 R2 Mini"If we remove the library then the problem is solved another error is showing "NTP is out of scope".I downloaded almost all verson of library but the problems remain as it is. If u want then i will send you the code. Pl. help me

  6. Avataaar/Circle Created with python_avatars Frankentrain Laboratories says:

    late to the party but fixing to put this gem inside a 1949 Model Train from my childhood. Oh YEah Love It. Thanks, Dennis

  7. Avataaar/Circle Created with python_avatars Wojtek Pypeć Official says:

    Connecting…….._____….._____….._____….._____…..
    how i do ?

  8. Avataaar/Circle Created with python_avatars Scott Murchison says:

    Fun video. Thanks. I just bought some Wemos D1 Minis and got it working. I hope you're still active.

  9. Avataaar/Circle Created with python_avatars Rupesh Patil says:

    hello sir, i have ESP-12-E wifi module only (there is only a chip which is plced upon Wemos D1 Mini ), how can i use it as wifi for ardiuno uno board? please help!!

  10. Avataaar/Circle Created with python_avatars Ahmad Al-Tarabeen says:

    YAY!

  11. Avataaar/Circle Created with python_avatars Mace says:

    This video is very much appreciated, thank you.

  12. Avataaar/Circle Created with python_avatars HAWK TECH says:

    Nice video Sir

  13. Avataaar/Circle Created with python_avatars Claude Dufourmont says:

    Very interesting subject, very well presented. I keep in mind the little tips for my next videos focused mainly on the ATtiny 85 (and 84), I will start the ESP32 soon.

  14. Avataaar/Circle Created with python_avatars gazzacroy says:

    just starting to get into this things (better late than never,lol) a really helpful video. and yes there amazing little things even to this day thay are still good… thanks mate 🙂

  15. Avataaar/Circle Created with python_avatars Somakanta Majumder says:

    May I program this circuit pixel cracker tree with synchronized with sound

  16. Avataaar/Circle Created with python_avatars midou games says:

    i have a web application that sends data and i need a code on esp8266 and arduino to read each data sent, could you help me?

  17. Avataaar/Circle Created with python_avatars Leigh W says:

    Perfect example of how to show viewers even the good guys have problems when compiling etc. Great clip and I really like the delivery with so much transparency and enthusiasm. I got a lot from this and thanks heaps for the walk through. Keep it up mate you’re doing a ripper job 👍

  18. Avataaar/Circle Created with python_avatars Milan Karakas says:

    Not working. Unable to find usb driver.

  19. Avataaar/Circle Created with python_avatars Jan Hörn says:

    can anyone nice tell me what I need todo if I only have the esp8266MOD without any board (someone gave it to me for free) I tried finding a breakout board where I could attach it to, like the board shown in the video but I can't find anything – I could just buy a complete one for 5$ but I wouldn't want the module I have go to waste and I don't know what search terms I need to find something useful on google 😀

  20. Avataaar/Circle Created with python_avatars Austin Esquirell says:

    What was the point of downloading the github zip? He didn't do anything with it

  21. Avataaar/Circle Created with python_avatars Qubitech Đầu tư 4.0 says:

    I have some basic documents for anyone who learns this ESP, leave a gmail for me to send

  22. Avataaar/Circle Created with python_avatars Michael Rotter says:

    hey dump man !! you have placed another board in your video thumbnail, than you are actually using in the video !! idiot !! i would not view your video if I knew that you are using another board in the video !! dump stupid man !!

Leave a Reply

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