#120 Wemos D1 Mini 👍 Intro (with shields)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
and welcome back now today we're gonna be looking at the we must D 1 mini that's this thing in the center of the board here okay because quite frankly it was a new item for me I'd already already use them the big ones like this one here at the back or indeed this one and the both we must be ones full size why they're different I've no idea they both say they're released to I think on the back and if you do go for a full sized one do try and get the D 1 R 2 the D 1 R 1 well I don't think it said R 1 Utama just the D 1 is in fact now retired and the main reason being that the R 1 had two buttons on the front unlike this one which just has a reset he had a reset and a flash and when you try to upload a program you had to hold the reset hold the flash let go the reset keep holding the flash until it it took hold as it were starting to flash the memory it was all a bit Fafi about quite frankly and a lot of people got a lot fed up with it and even me I must admit when I used to upload sketches to the the old style we must need one it was probably about a 50/50 percent chance of whether or not it was actually going to upload or not at that time so these are two versions have got around all that both these boards here but the mini which is this one here and it's functionally equivalent to this one here was brought to my attention as part of the esp8266 deep sleep video that I did a little while ago yeah let's not talk about the actual the way it goes into deep sleep because I was a little bit surprised that's the way it did it but the actual board itself I was unaware that they made the mini like this but there were a few comments in that video so and this is what I use and it's great because it's got obviously built-in Wi-Fi which you need anything you know internet things you can put it into deep sleep mode I'll run for 4 weeks if not months on something like this this is an 18 6 18 650 battery in case you're not totally familiar with these this is an ultra fire well it says it is on the packaging whether it is or not and it's a 10 18 650 it's certainly not 5,000 million per hours it's probably about 1,800 something like that but it's a reasonable battery this one now if you've read my blog you'll know that I connected this up to the shield that you can put onto this device so is this one here so this is a lipo shield you plug this this battery with this plug into that socket there and then plug your USB into there to charge it up every now and again and this will then supply the power for your we must be one that's great except then I put this on a metal dish you just saw accidentally fell on it really and it start to get very hot and melt some ores and indeed the battery got very hot so I suspect it it discharged quite a few amps in quite a few seconds I mean and unfortunately the the magic smoke may have escaped from this one but we'll play about with it a little bit later and just see how well it works there is an alternative way to power your we must e1 obviously you can pair it directly from the micro USB socket on the front or you can have one of these power units so this is the power unit very very similar to what you might find in the Arduino Uno worldwide the jack input and this one has a voltage range of if we can just catch that 7 to 24 volts it just says it in name probably just just catch that at 7 to 24 oh I'd be careful about the 24 don't push these things to the limit but I can run it on 12 and it doesn't seem to have any problem with that at all as you'd expect it not now most of these items on these big boards but most of these little ones were supplied by banggood because when I read about the we must do what many I thought hey this could be quite a good little video to do and Bhangarh agreed so they supplied most of these items for free in return for a video and also there are some links to each of these items underneath this video so down there and should you want to pursue following any of these all you gotta do is click on those links and Ashley is an affiliate link that gives me a small amount of commission of no idea how much it's not gonna be a huge amount but every penny counts as that means I can buy more stuff like this for future videos so let's see what we can do then now this we must D 1 mini came with a variety of options for soldering on these headers so which one should you in fact news as you can see I've used the longer stackable header which is used all the time on shields for the Arduino but is in fact the right one to use for the week most e1 mini well my logic was I didn't want this to be the first one in the stack I thought we could have this one which is the power input as the stack or indeed the lipo module this one here so power is the first one then we could stack this one on that one and then maybe this one here which is a I squared C temperature shield I believe yes temperature shield but the very top one obviously must be this one which is the TFT screen if that's not TFT it's an oled screen or oled screen okay it's only a tiny little screen on the top but it could be quite useful for I'm showing you the status of various things it's not I'd suspect designed for like primary use not like say a rise but if I might be have used their screens which are very very nice as a primary display this is simply to tell you perhaps what's going on in that module that's locked away in a cupboard somewhere counting bees in the Beehive for example so if we if we were to take the simplest route and say well we won't use that power we'll use this plug-in power for now we'll use this one and this one plug them all in together and let's see what happens now when you're plugging all these in together of course it's quite important well make that very important those are all plugged into the right orientation so make sure that your your pins with the TX is always at the front now unfortunately the the actual we mas has the antenna bit sticking out here so that could confusion thinking that is in fact the the other end which is here which is you know normally pin less so just just keep your eyes on that one so let's plug this in it's a standard esp8266 by all other means really you can run any esp8266 sketch on it obviously this hardware for this is a little bit bespoke but once again you can use them the Adafruit library for this and that's gonna be fine for what it's intended for so all we need is a 12 volt supply and this if by magic here's my 12 volt plug in so we'll plug that in down the bottom so I would expect something to happen maybe oh look at that and there's a clock all right I cheated a little bit I did in fact upload a sketch to the esp8266 6 world remember that the output for the LED and so forth is reversed so high means off and low means on so the double blink wasn't so much a double blink it was a double off if that makes sense there is permanently on but little blue your LED that's buried in there somewhere it was mainly on but it proved that it worked so I thought right now I've got that running and I can upload further sketches now I'll put a snapshot of what the settings need to be to upload to this and we're using the standard Arduino IDE for this we're not using your clips or anything else at the moment just to make it clear exactly what you have to do so let's have a look at the settings in order to upload any sketch to that we must be one stuffed in the middle there right these are the settings in that I used some of them are must have no I guessed a little bit but let's see how well it works first of all you got the the board we must D 1 r2 and Minnie so there we are that says it all doesn't it same board really just a different form factor flesh thighs for Meg now I've chosen the one makes spiffs rather than the three makes best because we're not using Smith's anyway so why allocate more memory to it debug port was disabled by default debug level was number default left those the the lower memory thing there I'll have to read up about that because that's a new thing that's popped up in this release of the arduino ide or at least for this board anyways I don't know what that means CPU frequencies finds 80 upload speed now I had to change that that was set to some ridiculous thing like 900 chaos something didn't like that at all 1 1 5 200 that's about the maximum the arduino ide normally supports arrays flash now that means do when we upload program a sketch do you want the entire chip erased including any data any EEPROM stuff whatever thought the whole thing raised or you just want the area occupied by the sketcher raised now by default I believe is only sketch so that you can have a sketch running that writes away to EEPROM and has some values there for example then you can update the sketch but not touch those values so our default it says only sketch so I've left is that the port is whatever port you've connected to on it - 12 and that's it oh yeah the programmer of course is AVR ISP mark 2 because actual arduino ide effectively so those are the values to use they worked well for me you may have to tweak some of them and I'll look into that the eye WIP variant to find out exactly what that means these days right so that's that so the the next thing to think about apart from showing you the price isn't thing log on here is the whole point really of an esp8266 anything is that you want to control it via the internet either you want to connect to it or you want it is about to its supply you with some data on a web page or something like that or there on your phone or in your browser now we've covered a few things on internet based web pages I did one for the Arduino with its LAN shield on it and it's it's just not very different from that at all so we'll get something up and running apart from this clock which is a nice demo but apart from showing your clock it's not of that much practical use is it so let's see let's get something else we're going on here something to do with a wireless after all that aerial there is looking us taunting us almost to say make use of me so we will okay here's the little sketch that I've had around for ages now I can't work out whether I wrote this or whether it's just one of the examples it's the sort of style I could read written but I don't know there's not enough comments in now I don't think for it to be my code maybe I've tweaked it anyway it doesn't matter it's all open source so what this sketch is actually doing is creating a little Wi-Fi server that is to say this little device is serving up web pages okay now it's not it's not like a web server you'd find you know in Amazon was on this little tiny thing but it's good enough to give you an indication of a status or something like a switch or a temperature gauge or something like that however all this is doing is showing you the status of that LED there whether it's on or off and as you can see it's brightly lit at the minute and that's fine let's let's see exactly what this is generating as a web page and then we'll come back to this code all right so in our browser here we are so I've connected via a browser to my local network okay so if we look at this address here one two eighty four one nine two one six eight that's always your local address one yours might be zero or two or something an 84 is just been allocated eighty four has its number now it says in big letters LED pin is now on and it is on as you can see we can click to one of these two things here to turn it on or off so if we if we click this one here where it says turn it off and off it goes now there's no smoke and mirrors here this is all done via the internet it's not it's not divided this USB cable and we can prove that by unplugging this USB cable and plugging in our alternative method of power which is this one here just to make absolutely sure that we are running off the network let's do that so here's the power about to connect on it goes and once again this is now running now what you're seeing on screen here on the browser of course is old it's from you know 30 seconds ago isn't it so let's refresh that by pressing f5 and making sure we can still connect now so it's still connecting and now it's saying off so let's turn it back on again with this one here oh yeah on and off as if by magic and as you can see the only thing that's connected to this device now is the power so it's all via the local network your home Wi-Fi effectively so this could be buried once again in that ubiquitous beehive at the bottom your garden powered by a solar cell or a lithium-ion S or anything you like it does need to be connected to your Wi-Fi as long as your Wi-Fi range extends at the bottom of your garden of course and you could be interrogating not the status of the LED but perhaps the I know the weight of honey or the temperature in your greenhouse or the level of water in a water tank something of that ilk now it's all very interesting turning an LED on and off and at least it does sort of prove the point that it does actually work okay so yeah we've proven that this definitely does work let's find out how it works behind the scene and this is the standard way it would work for a full sized ESP machine so something like this it would be exactly the same right let's have a look at the code and see what it actually it's doing right so back we are on the code window this is the standard Arduino IDE is all very familiar isn't it so what we've got here first of all we have to include this library esp8266 Wi-Fi now the esp8266 over the last couple years has come a long way in compatibility with the arduino ide and the support what you must do though is to make sure your boards are up-to-date so go to tools you're looking at my monitor screen now because you can't see the drop-down menus either sir tools board now we've selected the right ball that's fine in fact it has changed it does say we must D 1 and D 1 R 2 and mini and in fact if you look at the first bit now it says Lolan in brackets we mas I know anyway the point is there you have to go to boards manager and wait for them but it all load this up might take him a minute or so but then what we're looking for is the ESP part of it so at the top you can either type in ESP and your filter except it's not actually let me do that oh hang on that's why it's downloading load of stuff and if you call that down the bottom it was downloading stuff now we can type in ESP here as a filter or just scroll down until you find it which is what we'll do now this is the one of interest here let me zoom in on that so you can see what it says now this is this is the ESP core library support okay written by well the community these days but it's for the ESP so it works with the arduino ide now as you can see here this says version 2 4 to install 2.4 to installed now previously i had 2.4 dot one i think it was and it didn't work or at least say when i compiled the sketch the you see in the back there I've got lots of errors as I know I can't find this anymore on that although ello it's been a while since I've caught up this ESP sketch but surely it should still work but he didn't things have changed so all I did then was to say it fine okay on this board this version it said 2 for 1 there was an update over here Update button it's gone now because I've pressed it and it has updated to 2 for 2 so make sure they're up to date and every now and again come back to this screen you know every two three weeks if there are only updates the arduino ide will normally notice for you you'll get a little a little prompt somewhere down here okay and it'll say all you've got some updates to your boards and it's always a good idea to have a look what he's updating obviously if it's an update I know did you stump for example this one here and you think you haven't used it I'm not gonna use it yet you can ignore it but for the ESP obviously that's one we're interested in right so let's close that so the esp8266 Wi-Fi library is required you need your SSID you need your password which obviously I'm not prepared to tell everybody about here now the Wi-Fi server what port do you want it to run on all internet ports for the Internet are on port 80 if they're not secured and this one isn't so it's not an HTTP web page you're generating it just HTTP but 80 is what we're gonna use so we don't have to fiddle about with the address line in your browser we just keep it at 80 and everything just works now where we're setting the built-in LED we're connecting to the to the actual Wi-Fi now by saying start connecting users at SSID and password if you've typed them in wrong it won't otherwise it will and while it's doing it you'll get a little dot printed every half a second and well eventually it'll say the server at cover I've started now I've started my server my web server on your network and this is what you need use this the URLs connect it or display the URL so in our case remember once if we we go back to a little browser window that we had up there 191 6 1.84 that's the thing that will be displayed when this is running it's all very simple and it's straightforward and well normally it should just work ok quotes just make sure you get your boards up-to-date and it almost definitely well then what it does is just read the incoming web address line up here if you notice this there's more after that 84 and let me go back to the code window and zoom in on that a little bit so at the end of this some 1.84 there is there is more stuff so free um if we make this bigger there we are now you can see there's there's a bit of an argument there now that in a commercial environment you you probably would not want to do this and this is where you're you're exposing some of the parameters of your website in the URL itself now that's fine for what's known as a get command that is you're just retrieving information so if you're going to Amazon and retrieving information for shoes or something it wouldn't really matter if its head size equals 10 or something there right it's just not critical but you wouldn't want to expose anything critical here especially given that this is not a secure site we haven't got HTTP invoked this time ok now what the code then does is to say rot I'm reading that little bit off the end the / le D equals off or on and that's let's just move this out of the way a little bit what it's saying is that it's looking here for led on and if it doesn't find it it turns it off and if it is does find it it must be on so it flips or toggles the LED value now this is a little bit clunky but it's just to prove the point and it works fine right now this is all very well and yes as a demo great if you if you haven't done this before and you get this far you should congratulate yourself that you've actually got something working over you or your home network but turning an LED on or off isn't the most useful thing in the world is it let's think of another sketch which we can use perhaps still using this sketch part of as a sort of a basis and perhaps display something a bit more useful like the temperature perhaps or humidity what if we can do that so what I've done then is to collect this we must ss-sorry sht 30 shield to the actual ESP d1 mini powered underneath by this but of course we've got it connected at the moment to the US because I've just uploaded a sketch and I'm just praying that it works because I've not even had a look at it yet yeah I think it's time we undid this then take that off and connected it up to the power and doesn't see me any indication of life does that slope it's all hanging together here right let's look at the code then what I've done I've actually used the foundation of the previous sketch that we saw so it's connecting still to the Wi-Fi I've added in this little bit here now up oh yes and there's another include some where's the other include there it is so there's another include and all these libraries I'll point in the video description down below where you can find all these I wasn't gonna faff about and try and rhymer and library for this and it's only a you know it's Harvard as and lines is nothing so we need that library for the the actual device itself this is how we get the object and to get okay here we connect to the Wi-Fi again exactly the same way as we always did but now we go and get the temperature and all the rest of the gubbins you know you can get it in Celsius Fahrenheit humidity on it there's a couple of other values you can get as well but for a demo that will do we're saying right if the client can and this time you don't have to send any values you don't have to send that LED on or off because we're not talking about LEDs it's just like the client has requested that page okay just like you would do out in the Internet so it says all right okay you've requested something I'll send you back the HTML for that page just the same way as we always did it but I've changed that last line now instead of saying about the LED bit I've said right the temperature is then I've read the temperature out of that module that object that we've already requested at the beginning of this and print it they are now said and here's the humidity and going getting our object and print it finish it all off and well that's it and then disconnect and wait for a second because you can only convert the values on here about once a second and let's face it I mean if this really was measuring the temperature of my beehive down the bottom of the garden would I care whether it's five seconds at a day even now wouldn't so that's absolutely fine now if you're wondering what all this gobbledygook is here that's HTML and some of it is a little bit obtuse even if you know HTML sending it back a response type like well up to here you have to get that bit right then your page starts with HTML and your head and your title and I cannot possibly start teaching HTML in this demo it would take me about six months to get you up to speed so there's a little cost for you but it is pretty simple you can just use this an experiment and google it and you probably get more than enough of a pretty page I haven't made the page any prettier than what it was so I guess it's time to see if this works oh I should have tested this before I started a video you know I really no mind right browser where's my page all right that's the old one then so if I hit f5 all this is going to go right we're not going we're not talking about LEDs f5 and oh I better put into focus first f5 I'll look at that brilliant I don't know if the values are right on 28 in this workshop mm oh it's because I'm already holding it down okay let's see what happens then if I stick my thumb on the sensor down there like that the humidity value 41 well it might be I don't know in the UK we just we just don't seem to take a lot of notes above humanity unless it goes really humidity of 89% and even then it's just not one of the things that's reported widely on the weather stations anyway no sir refresh that so I'm just refreshing of the fact it's got led on out here now it is absolutely monsters we don't need any of that so I can take all that often just hit that and it says 33 all the humidity has gone up as well putting my sweating little bomb around there you see so well we can only assume it's working I'll just repeatedly hit f5 hmm well it's it's kind of 2:30 today I've already walked off a bit hotter let's try my other finger perhaps my other fingers a little bit clammy and hovering it might be the values have been different look five and oh no it's not doing it anymore probably disconnected something as you can see by the little twirly thing in the tab up here is having it's trying to connect to this but he's currently finally what happens when you put your fingers all over no I'll try again I kill that one let's try again or this motley a case of hitting reset where's the reset button on the side that's lucky on this version the resets actually mounted sideways so we can reset that like that hopefully it will spring into life in a minute if not we'll just we'll just reach them send that again I think we are in the back 29.97 fine okay well we're just with this assume that it's it's accurate so there we are that's another useful then now that is actually okay it's the webpage isn't particularly great is it but that could easily be buried in a beehive or a greenhouse or something like that and measure the temperature remotely because it's all on Wi-Fi long as your Wi-Fi of course reaches that far okay well that's that's a fairly good example of what can be done and we've had a look at the OLED screen tips here even though despite a clock but I mean the the principle was there wasn't it really I guess what we ought to do is plug in the this and power it from something separate than this because if this wasn't a beehive and it was too far away I'd have to use a battery yes I would normally have to put into deep sleep so what would happen is your power at the battery goes into deep sleep and maybe once every half hour or something like that 15 minutes it would do exactly this what it's doing on screen it would go and read the temperature or something like that and then go back into deep sleep mode and post those values somewhere where I can get hold of them or if it was running permanently be prepared to charge this up sort of you know Bailey O's and they automate right let's let's change the underlying shield or perish shield and see if it still works and that magic smoke hasn't escaped yet just before we connect up the power shield there's something to bring to our attention when I saw there oh yeah that's nasty connect up the lipo to there that's a jst connector ordered those which are these from bang good the same but of course these don't fit and why not well and you get one out and show you so this is the connector pretty standard for drones and cars and things for power reasonable thickness of wires okay fine because when you get to this this will not go into there because it's too big isn't it though I couldn't get that in at all so I'm thinking what is that and if it's not as jst connector well actually what it is is one of these it's a it's a micro jst connectors so that caught me out actually and in some ways I'm not so happy about this this micro jst connector yeah that's fine and it fits in there for any I could do it let me do off-screen right upside down that's what wouldn't want to go in so that goes into there just fine the wires though or a little bit thin there's certainly thin these ones on the standard jst lawn by much but a little bit but worse if you look at the layout here know when I discovered that these were too big I thought well it doesn't matter because it allows me to put in a couple of header pins at the top here and don't use those instead now the first thing that should strike you at this point is hang on the Reds over here and the blacks over here but the Reds here and the blacks there hmm something dodgy go on well I know this is working the header pins one was very sure about which one was putting it in and it's these cables actually which I didn't get for a mangled at all this is not bangers problem this is a local store I bought them from at least local in the UK and they've actually worn DS up back to front it would appear so on my power unit with the lipo on it so this one here if you notice I've had to switch around the cables now I don't know if there's some oddity going on with with polarity here or whether it's just these micro GA s T's that are the wrong way around but I mean that would cause problems quite severe problems invent really so something to be aware of and in fact I'm not going to give you the link for these micro ones in the UK because I think there might be a problem with those so we're just quietly quietly hide those away and pretend it never happened and we had the proper ones but obviously if I was to connect that up as it is now that would more potentially it's providing reverse polarity isn't it to this device and that's the problem right a couple of days like it because I did try out this lithium ion buck converter and I'm afraid it's fubar which is as everyone knows stands for fried up beyond belief because yes this is fried it sort of works in the sense that if you plug the lithium into here and the USB into here the red light goes on but then very shortly after that it goes off and they it doesn't convert the other way around so it doesn't convert the battery into five volts if you disconnect the USB so this is as I said fubar shame really and well one of two things happened either it went bad when I placed it into the metal dish but if you remember I said I'd put the battery leads into here straight as they came out the packet so this one here for example so it goes in with the groove at the tops like that and as you can see the polarity is reversed now it's only for a fraction of a second but who knows one of the two killed it off though so back into the recycling dish in the sky you go pity because I like this one from bang good a bit better than the other one because this one allows you to put a couple of pins in here you want to and more things up in a more permanent fashion but there we are so I had to rush a replacement from a Oh supplier locally as in UK and luckily it came and it is different if we look at the two side-by-side although there are stents ibly the same you know same size same format sockets in the same place polarity is the same as well and obviously the the components are different in themselves and I'm not going to go into what the component differences are it's just not not relevant at this stage but it's still gonna be a buck boost because we've still got the same chip on here we've still got the coil and a few other unnecessary components that we're not going to talk about okay so that's what that does now so what I've done is plugged the lithium ion into that socket if we plug the USB this is just a standard USB I've not actually put it into a lock of charging sake or anything not the moment make sure I get the polarity right here now you can make out that the the LED red light has gone on which means it's charging at the moment what would an that would then so this is all powered up and it works this is red now it goes to green when this is fully charged okay but we haven't got time to wait because I don't know how many amps our sucks out of here by frying that thing at the back there not that one it's gone this one there by frying this one but obviously it took some power out of it so it's charging it back up now what I'm gonna do is connect this under here and quite frankly I'd rather do that without any power being connected so let's disconnect this one here holding the plug blue blue light okay right making sure we get our orientation correct so the TX nor that is a top right so we plug that into there and then these pins again a little bit bent now I keep on plugging them alright push those down no that's enough yep alright so now if we just connect the battery it should have a fire up oh it does oh there we go little face little image the changes or it is it's not supposed to change you if that would I look at this live it's totally not changing here we get this rolling display probably something to do with a refresh frequency or my lighting or something no it's an that that rolling bar that you can see going down the image does not happen in real life I can't see if I look past the camera not to worry anyway the batteries powering theirs now the thing you notice in here look nothing's lit up no LEDs are lit up either on the power supply board nor on the ESP itself is there's no little blue light coming on or anything which is exactly what you want if you were thinking of running this in deep sleep mode running on a battery for weeks on end which is great oh I like that I must have a nice good nut you'd have to de sold or anything it's cool and then every now and again of course you want to come along and charge it up so that one goes in here there are so that goes back to read because it's charging but wouldn't go green when it's finished and that's it all done and dusted pretty good yes I like this some this whole little setup really of stackable things obviously you don't it stacks up too far but for an individual project if you think right I need an ESP I need to know LCD or in this case OLED I need some kind of power that's either like that or like that or just plain USB plug directly into there there's the sense of all the way so you have options and as I showed you in the the parts lists from Bangor they they do many many different options some of which I've felt were bit too long-winded to demo here and talking of long-winded I realize this videos going on a while so I think we'll call a halt where this works I've uploaded another BMP to this just to show you we can really it's not exactly practical but who knows it could be a sign couldn't it to say error or stop or something cool okay that's it then that's the sort of introduction to the we must D 1 miniseries thanks very much for watching don't forget to put comments down below YouTube like it when people comment shows that as an interest thanks very much see you in the next video thanks for watching I hope you're finding these videos useful and interesting there are plenty more videos to choose and a couple are shown below and if you'd like to subscribe to this channel just click on my picture below and enjoy the rest of the videos thanks for watching
Info
Channel: Ralph S Bacon
Views: 29,364
Rating: 4.936759 out of 5
Keywords: wemos d1 mini, esp8266 mini, ESP8266, esp8266 d1 mini, wemos d1, wemos d1 r2 getting started, wemos d1 r2 wifi esp8266, d1 mini, sht30 shield, wemos d1 r2, oled shield, battery shield, Beginners, esp8266 d1 mini arduino, arduino wifi, electronics, C++, microcontrollers, Arduino, programming, gadgets
Id: TKN9WmunCQU
Channel Id: undefined
Length: 39min 54sec (2394 seconds)
Published: Fri Aug 24 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.