 I think Oma's already done the business there really, but I thought I'd start off with taking the piss just a little bit further to see if we could have a little quiz, so if you think that the following picture is real, then raise your hand, okay? That one is real. That one's real. Real fake? Who thinks it's real? That one's a fake. It kind of speaks to the arrogance, doesn't it? That one's a fake one, I'm afraid to say. That one is also unfortunately real. You might be asking. So this talks about this little chip that Oma mentioned briefly in his last talk, the ESP8266, and here's the kind of the top level spec sheet. As Oma said, it's a smaller micro, more like you might find in an Arduino chip, one of the smaller ones, but it's coupled onto a Wi-Fi chip. And it's very, very cheap, which is why it's quite interesting, and it was released about a year ago, so I was interested in it for quite a long time, but never actually got round to finding out about it until I got asked to do this talk, so that's a good excuse. Unfortunately, Oma's already shown my best slide, but it's quite a cool image, and these octagonal structures here, apparently the tuning inductors for the Wi-Fi side of it. It's really interesting to see how it's just amazing, actually. If you look at, if we take a little bit of a closer view in here, I just don't know how they do that in the factory. So, yeah, they're very tiny things. This is a breakout board. This is the first one, the O1. This is the ESP chip here, and you always have some flash memory and a crystal on it as well, and then the aerials are either on the board as a copper tray, so they use ceramic lines or some of them have a little plug so you can add your own antenna. And schematic is fairly straightforward. There's a few pins that you need to pull high or low to do different things in boot modes, so if you're going to be prototyping that's something definitely you need to pay attention to. The flash is on SPI, and then you have a number of GPIOs. So this, the problem with this one, when it was released, it just, I think it had two or three GPIOs. It was more just as a serial to Wi-Fi bridge, so you could plug that into your Arduino and then have Wi-Fi really cheaply because I think the Wi-Fi board is about 50 or 60 quid. You can buy these for two or three pounds. Plug that into your Arduino and then you put your Arduino on the internet. But actually, as you can see from this picture here, there's loads of scope for doing your own projects on it because there's a whole bunch of unbroken out GPIOs, about 10 or so that you can get hold of. So let's have a look at what you've got. So this is how they've evolved over the last year. All different kinds of sizes, pretty much the same thing. I think only the ESPO1 had pins that you could stick into a breadboard. All the others had their little castellated 2mm pitch spacing surface mount connections. So you would have to put this onto a breadboard or solder wires onto it to start prototyping with it. This is my favourite one and it's the favoured one of quite a lot of other people because it's got all these GPIOs broken out really easily. Very, very cheap. If you can wait a couple of weeks you can get them for £2 in one-offs, two-offs. Apparently they're FCC certified. We don't know. So if you're going to experiment with one of these, you probably want to stick it on a breakout board or buy a breakout board. There's the Olim X1. That's quite nice because it's got a lot more flash on it. So that little extra chip, different manufacturers put different size flash on. So depending on what your application is, if you're building a web server and you want to put images or data on there, then having more flashes is more useful. The SparkFun one is more expensive but it's got an on-board lipo charger. So that's really cool for making it ready to go. Project just add your lipo. The Adafruit one, that has level translation. It's 3.3 volts, not 5 volts. So if you're wanting to make it communicate with other things, you would need to do level translation. And they've done the breadboard friendly stuff so you can just take that and then plug it straight on your breadboard and start prototyping. The NodeMCU, which I believe Omer, that's the one he's using in his workshop tomorrow, and by default that's flashed with Lua. So you wouldn't be writing a scripting language to programme that rather than C or something like that. And this has also got the USB to serial converter that you'd need to programme it built onto the breakout board itself. And then this is the one that I developed in the process of researching this talk. It's on OSH Park. You can order three blank PCBs, six quid for three including delivery. And then you'd have to build it up yourself for the bomb and stuff like that is up there for you on those links. By the way, all the links in this presentation are available from a short link. I'll share at the end of the presentation so you don't need to write down stuff if you're interested in it. So how do you use these things? Well, I mentioned that first one, the ESPO1, was meant as a Wi-Fi bridge. So you just plug in your RXTX lines, make sure they're the right way around, and then it has a built-in AT instruction set so you can say, okay, find me the Wi-Fi networks, connect to this one. Here's the pathways. Now open a TCP server, listen on this port, do this kind of stuff. And that was really exciting because of the huge cost difference. It was much more expensive to do it before that came along. What happened that was really interesting was that people started working on an open source SDK and then you can now download all of that stuff and you can compile your own firmwares for the ESP chip. So you can now use all those GPIOs for your own project so you don't now need the microcontroller on the side. You can write it all for that one target. But for programming, you need something like this. You can use an Arduino because they have the built-in USB to serial conversion. Or you can buy one of these boards with an FTDI chip on it if you've heard of that. This chip here just converts the USB to serial connection. And then I mentioned earlier that you need to have the pins in certain configurations to make it boot or to accept new firmware. So if I just zoom into this one a little bit. So there's these GPIO 0 and 2 are the important ones to be controlling. And usually people have a button on the board so that when you want to flash your firmware you can press the button. That will toggle the pin state and then it will accept the new firmware. So here's a bit more information on how you might write software for it. That top GitHub link is a full SDK that you can access all the parts for the expressive chip. And it's usually set up using Eclipse or something like that. It took about half an hour to compile on my Mac and it takes about three and a half gig on disk. So it's quite a chunky install. My preferred setup is with the Arduino. The new 1.6 versions I think have a, in the preferences, you can copy and paste a JSON link. And then when you say then it's got a board manager and you can just say I want the ESP866 tools and it downloads it all in about five or ten minutes. And it's very small on the disk, but then you don't have all that extra stuff. You don't have all the reference. Then there's NodeMCU. So that's putting lure on it. A scripting language. Also MicroPython, which I didn't have time to have a look at, but there's quite a lot of different options that you can run on this. Probably the two most popular ones are writing in C++ for it. So power consumption's important. I cracked out the multimeter. I don't know if you can read the pictures, but I've put the text up here as well. With all the pins broken out, it's got a deep sleep mode, but you need to connect GPIO15 to reset so then you can go to sleep but set a timer and then at a certain time it'll wake itself back up again. So you can do the kind of wireless sensor networks. You can sleep for a long time on 18 microamps. For transmitting, you need to have a higher amount. And one thing to bear in mind is these. The little RS232 converter boards usually only supply about 40 or 50 milliamps at 3.3 volts. So don't attempt to use those because you'll get all kinds of weird areas. The access points will fall down. It will work for 10 minutes and then as it gets hotter it will stop working. So you really need to make sure you've got a good enough power supply to probably you want to be supplying peak for 200 milliamps, but that's the kind of a quiescent current. And then three hours is if you were transmitting full time. What you'd probably do is you'd sleep for five minutes, wake up for a couple of milliseconds. This can, as I said there, wake up and send in two milliseconds so you can eke out that battery life for a long time. Here's a nice little picture that shows what the pins do. You've only got one ADC and it's a low voltage one. It's designed for measuring an onboard battery. But you've got SPI so you can plug in a chain of sensors or things like that. This is an infrared photo of it working. I was having problems with a temperature sensor I built, which was always reading too high. So I decided to take a photo of it. But the second set that I got, the 12s, the ESP12s, actually run really cool. If you look at this one, this is the ESP01. So apparently it's the same chip, but it's 30 degrees hotter. It doesn't have the metal case on the front, but I really don't think that would make a huge difference. So it does highlight one of the problems with these chips coming over in huge quantities and very, very cheap. The quality control is maybe not the best, and there's not really knowing if there's good ones or bad ones or whether ones will run hot and really... I mean, that's clearly using a lot of energy doing that. This is the explanation for why my temperature sensor was running so high. You can just about see that this PCB tracier starts off warm and gets cooler, but that was still traveling up the legs of the thermometer that was changing the temperature, putting it on the flying lead to solve that. And here is a basic test program that I wrote to test all the functions. So this is what it looks like in Arduino style. What they've done is they've forked the Wi-Fi stuff. So if you've ever used the Arduino Wi-Fi stuff, it's the same kind of thing. So you need your SSID and password there. Down here, we can start up, look for a way to get a connection, print out some diagnostics, and then in the loop, maybe we're going to connect to some remote host, print some HTML. Maybe if someone's made a connection to us, read what that is, and then there's a deep sleep stuff here. I hope if anyone wants to have a look at that, fairly straight forwards. So I wanted to show you some projects that do with this kind of chip. I start off with my first one. So this is using the 01 board right there in a little temperature sensor. There's the temperature sensor there connection. One thing that I did was at the same time is setting that up, logging every minute to the SparkFun data service, which I recommend is quite a good way of doing IoT data. I set up a cron job on the Raspberry Pi connected on the same home network, so I could then run these numbers and see how many packets were lost over the course of things. So it's not too bad compared to the Pi. There were some power outages in my house, which is why neither of them are 100%, but it's not too bad. Here's a little closer of what happened when I put the temperature log on flying leaves. Lost a couple of degrees. So getting a bit more complicated, I found a very nice old galvanometer, and I thought I'll put an ESP chip inside it and then I can make it show what I want to. I had a chat with the York Hackspace guys about MQTT, so I thought I'd do that as well. Put an MQTT stack on there, and then at the moment, my first test was just on a cron job on the Raspberry Pi. I was just sending the number of minutes of the hour, so it's just a clock from zero minutes to an hour, and I thought, oh, I'll change it so it tells me when the next bus is coming, do something really cool like that, but actually I don't have a clock and I don't wear a watch, so I've just left it as a clock. A very over-the-top internet-dependent clock. This is quite a cool one. Bristol Hackspace. We've got a kind of clean room and a more dustier room, and we're getting a bit more health and safety conscious, so I bought one of these dust sensors in a cool components-component sale and made a nice little graffing sensor there. I'd never seen what dust looks like, but it works really well as an occupancy centre. As soon as someone opens the door and moves around, the dust goes up into the air and you get these spikes. That's from a circular saw, that one. Then it takes maybe four or five hours for it to settle all the way back down to nothing. You can't tell how many people are in there, but you can definitely tell people are in there doing stuff. Here's a super simple one. This is like the Amazon dash button. People heard of that. It's just buying one of these off the shelf. You press it and the LEDs come on. You put an ESP chip inside it so that you press it on. You press it on, that provides the power. It does something. The lights change colour and then you let it go and the power is cut when you let go of the switch. It's a really nice, just simple presser button. Something happens on the internet. This is a nice one that I found on Hackaday.io. I think he was using it for controlling pumps in a greenhouse or something like that, a channel relay controller. But if you look for the ESP projects on the Hackaday project site, there's huge amounts of stuff on there and everyone's publishing their schematics and loads of boards are being made on OSH Park in public, so it's very easy to get involved with this kind of stuff. I wanted to mention the MyRobot, which I think is a really great example of a good fit here. This is a guy who made a robot for kids to learn how to programme with and it hosts a little web server on the chip itself and then you connect with the tablets and then it's got its own graphical programming language that you can drag and drop blocks and that's all done on the one ESP chip and that drives the stepper motors and everything. So it's all the electronics, it's a £2.50 board and then a couple of stepper motor drivers and a servo drive. Super simple and he's done a really good job of putting the whole kit together. If you've been to Maker Fairs, you've probably seen that really nice bit of kit. I just found out, has anyone heard of G-Link if you're into radio? A few people. He's done loads of stuff with small internet connected radio nodes and I think he was really excited when the ESP came along because he's now dedicating a lot of time onto this and he's kind of gone back to this original idea where you take the ESP and you make it into a Wi-Fi bridge for your microcontroller but he's made it as a... now it's no longer AT commands, it's transparent serial. So you can plug that into your Arduino project and then you can do over-the-air firmware updates. You can see what's happening on your project. So if you've got something and it's even just for debugging if you've made some kind of microcontroller project and it's in your loft and you need to check on it or flash a new firmware onto it, then something like an ESP running this GLabs ESP link could save a lot of climbing up and down ladders. And this is a nice little open source project to mention. One guy made the code to fetch the weather data. Another guy patched an OLED screen onto it and a third guy made a 3D printed enclosure for it. So it's a really nice kind of all around the world. Nice collaboration there. So what next? If you're interested in checking out those links, then this is the short link that I promised. Omer's running an ESP with Llewer workshop tomorrow if you've already heard about that. I ran a workshop on using this like a kind of basic, okay, how do you use the AT commands? How do you flash firmware onto it? And the handout for that and the instructions is on that workshop link. There's my contact details and all the references from the presentation.