 Rwy'n cael ei siŵr o gweld i dwi'n gweithio a'r eurill o'r AMF. Mae'n gweithio, fel roedd yma yn ystod. Yn oedd P.J. Evans yn ystod o boili'r Nemo ac ymwneud. Dyma. Ddau'n gwneud hynny. Mae'r CEO? Rydyn ni'n gweithio i AMF? Rhywodraeth. Oedd, yn gweithio, mae'n ulyg. Rwy'n gweithio, Cadwodraeth i'r John C i'r team i gweithio'r hynny'n gweithio'r ysgolion. As part of the content team I've been watching what's been going on in the background, and they, I mean, if you were at the opening talk, John T didn't tell the half of it, he was very, very polite about some people who should not be being very polite too, but we're just trying to work out how the screen works, just fun, talk amongst yourselves. Oh, I could do a plug, actually I could do a plug. One of the things me and my family are doing here is running the film festival, and yay, and we've got, oh there we go, well I've started now so I'm going to finish. Yeah, slightly distracting slide. Pixar were not consulted. So we're running the film festival. Tonight we've got a world premiere of Tempman, a 30 minute feature that was actually made here at EMF in 2014 and 2016. I know it's the world premiere because I haven't seen it yet, I'm told it's very good. And then we're showing Coraline, possibly the scariest animated feature ever made. It's absolutely brilliant from Neil Gaiman and the director Henry Selick, who directed Nightmare before Christmas. That would be a very different experience. But of course on Saturday night we've got our big presentation which is Hackers with Jake Davis aka Topery in attendance and the director Ian Softley answering your questions afterwards. It's going to be amazing. So I better get on with the talk. Boiling Nemo, Adventures or Misadventures in the Internet of Things. So bit about myself, my name is PJ Evans. For EMF camp purposes I write for this magazine. This is the new issue that's just come out. It's another slight plug for you. In this one I've built something to annoy my teenage son, which is his klaxon. So he's always playing his games, headphones on, so you can build this with a Raspberry Pi and quite a cheap little industrial light and I can send signals to him from a mobile phone. If he gets really annoying it doesn't come down for his dinner when I want him to, it lets off the most ear piercing screech you've ever heard. That gets through to him. But anyway, on with the show. I've been building Internet of Things things for quite a while now and I want to tell you a bit about my experiences and hopefully encourage you to go out and start building your own things. The story starts with this device here. It's called a Canary. Anyone ever heard of one? No, probably not surprising really. Now my boss at the time bought one of these and came in and said, oh PJ this is brilliant. It actually looks quite nice. You could put it on your mantle piece or on a table somewhere in your house and it's got a camera in it and a motion detector. When someone moves around it takes a little video. So if someone breaks into your house it takes a video of them and I said that's brilliant. Where's the SD card slot? So it doesn't got one. Oh right, so it's USB. You plug it in and you take the video off the device so you've got a video file on your computer that you can give to the police. He said no. And I said well how did you get to it then? He said well you connect to the cloud. My alarm bell started going off. I said the cloud, huh? Oh right, so okay they're trying to do it so it's easy to use. You log into your account on there and you download the video and he said no. No? Only if you pay a subscription. So you've dropped about 200 quid on this device and then if you actually want to download the videos you've got to pay another 25 pounds a year. Since he got the device that's changed now and you could be paying up to 25 pounds a month to get access to your own videos. Now things like this is why you know here's the cloud and here's me. I am suspicious of the cloud. I don't like it very much because it's not the cloud it's other people's computers. So I thought it would be a bit more fun to build my own things. Now I didn't really get anywhere until I had a problem with this. My fish tank, 190 litre tank filled with tropical fish, absolutely love it and it sits there in our dining room. I come down for breakfast one morning and my son's there and my wife's there. And I walk in, good morning everyone and my wife gives me that look. Now if anyone's been in any kind of long term relationship they know this look, especially if you've got kids. The look says, do not say a word, which was fine because I didn't have the slightest idea what she was talking about. So I didn't say a word and she kept looking at me saying, what? I haven't got a clue. And this went on and breakfast finished. My son went off to school. And my wife said to me, what happened? And I said, I don't know. And she looked over to the fish tank, which was a bit suspicious because of the absence of fish. There weren't any, where'd they go? We opened up the top and there they all were, about 60 fish beautifully poached. We had boiled nemo. What had happened was that the firmista that controls the heater had broken. And for some reason its default state was to leave the heater on. Over a number of days the temperature at the tank had risen and risen so the fish couldn't take it anymore. So I was like, right, can't have this happening again. I mean we lost seriously, we can joke aside, but we lost fish that were over five years old. It was actually at the time quite upsetting. So I went to work, kind of buy something that measures the temperature and lets me know if anything's all right. And the answer is no. No one's got something on the market yet. So I decided to build my own. And I thought I'd use one of these. I love these. Raspberry Pi's, I even write for a magazine about them. This is a Pi Zero, the best bit about a Pi Zero is this bit, the GPIO. A device, this is a computer you can buy from as little as nine pounds, twelve pounds if you want Wi-Fi on it as well. And then you can connect all kinds of devices to that circuit board. And there is tons of documentation out there and tutorials. So even the absolute beginner can get the head around what's going on. So I took one of those and I thought, right, I thought right, I need something that's going to measure temperature, something accurate to within let's say a thousandth of a degree centigrade Celsius. Something like that's going to be really, really expensive isn't it? On Amazon, nah, one pound fifty and free delivery. Awesome, I bought two. I've got the other one here. There you go. Cheapest chips, incredibly accurate for Mr and its waterproof. And it just has three wires at the end. Power, ground and data. Again, tons of tutorials and information about how to get this thing wired up. So I started the plan. Now, I should explain. I was in a bit of a hurry putting this presentation together and I'm no good with clip art. So what I did is I went to Keynote and they have a little search box for the clip art. So I just typed in what I wanted and took whatever it gave me. So here's my tank. Here's my fish in the tank. And here is my thermistor that I've put in there. So they're all in the tank and then they didn't have a raspberry so it's connected to my strawberry pie. That's reading every 15 seconds and taking a reading of the temperature. It then sends that and believe it or not, this is what I got for server. To a server in a cloud. Okay, so that's my network diagram so far. Here's what it actually looks like wired up with a raspberry pie. Incredibly simple, only need one resistor as an extra component to get it up and testing. And this is what the end result was. This is a website I built where you can see throughout the day what the temperatures are. And the two red lines are the high level and the low level that it's safe to be in. And as you can see, once I got it up and running, it was working perfectly well. So I thought, project over. The only thing is, how's it going to tell me? Well, I got it to send me an email. That was straightforward enough if it went out of range. But if I want my phone, I'm going to need to know about it. So there's me on the phone. So I went with push over. Now that's actually quite good out because there's no subscription model for you. You pay for the app once and then it gives you an email to notification gateway. So I can get things like that. That's when it's the actual thing crashed, which it did frequently at first. It tells me I've not had any reports in on the temperature. Go and have a look. So project done, all happy. Until I went on holiday to Scotland. Now, if you've read the blurb for this talk, this is the Scottish toilets emergency. And this is it. This is one of my favourite places in the world. This is the Kerngaum hotel. Absolutely lovely bar up in Avymor on the Highlands of Scotland. My wife and I on the sun, we're sitting there, quiet drink, enjoying the atmosphere. And I suddenly got the call of nature. And I thought I was going to be some time. So I took my phone and the phone had been off. So wandered off to the toilet, sat down, looked at the phone, and that stirred back at me. Oh, dear. And when I looked at the website, it was something along the lines of that. It had actually happened again. This is about six months on from when the project was finished. The thermistor had broken again and the heater was heating everything up. But there's a problem because there's my network diagram, but it doesn't account for me being on a toilet in the Highlands of Scotland. The plug socket is 600 miles away. Now in this instance, I was quite lucky because we had someone looking after our cat. And I was able to send him a text better saying, can you knit round just unplug the heater? It'll be fine. And we didn't lose any fish from that incident. But he did realise that I had a problem if that happened again and someone wasn't coming round to the house on a regular basis. So I got one of these. You've probably seen these all over the place, little radio based plug socket switch things on and off of a little remote. The energy in one is particularly good because it's quite cheap. It's only about £12 for a pack of three. But also because Energini make this. This is a little add-on for the Raspberry Pi, a little hat, as they call them, and they give you the software to actually send those transmissions from a Raspberry Pi. So what I was now able to do is put that on the Raspberry Pi and then complete my network diagram. Rather than being able to do this, I can actually get and cut the temperature and cool my fish down. I can actually do that. So when the temperature goes out of range, the Raspberry Pi itself can switch off the heater. So I've got a nice closed loop system there. I decided to take it a step further and get into microcontrollers. Now these things are incredible because a Raspberry Pi is a very powerful object and I was doing a very simple job. So it didn't really require the horsepower. I didn't really want to have to maintain the operating system. So I started looking at microcontrollers. This is based on the very popular ESP8266 Wi-Fi and sort of Arduino compatible chip. And it also runs a variant of Python. So it's quite easy to code. And so it's very, very tiny as well. It's only about that big. And I thought, God, something like that's going to be really expensive, isn't it? It's a premium piece of technology there in a tiny little size. Now it's £3.50. Sheepers anything. It's absolute bargain. So there's a new wire up of the Femister using the microcontroller. Only about 20 lines of Python to make the whole thing work. And that's been sitting in his little box ever since. But I couldn't really put a breadboard like that near a fish tank. So I'd drawn everything out in a freeware program or a public... Sorry, an open source program called Fritzing, which you can use for designing circuits. And you can draw it out as if it was physically there, which is what I did there. And then you can go to another screen and it will make a PCB layout for you that matches the circuit. This is obviously a few tweaks, but that's what I basically come up with. I thought I could make my own PCB. I'd never done anything like that before. But I was like, OK, you've designed it for me but how do I actually make it? And I looked at the bottom of the screen and it's a fabricator. That's impressive. So I pressed it and looked at my printer, hopefully. But nothing happened. What actually happened was it went to Germany. And in Germany they made the circuit and then posted off to me about two weeks later my circuit turned up. And they just had a little socket so I would just plug in the little ESP8266, wire it all up, pop that in a little box to keep it dry because it's constantly by it. So you start with these little ideas and you keep reiterating and building them up. I think it started to get carried away. It started over engineering things. So next up was a doorbell. Now this is a speaker for a wireless doorbell. The circuitry is pretty locked down and very, very tiny. It's hard to look around with. But what you can do with those 8266s is you can read analogs so what you just do is you hook it up to the speaker. And when the speaker activates you plug it in. So it also can power it as well. So plug it in the ESP and it will power the doorbell, remote doorbell as well. And now I get a ding dong which means I can wear my noise counselling headphones and not miss the courier. It's brilliant. And now this is my garage door. I hope you all realise that. So I am terrible with my garage door. It's an electric one. It goes up and down on its own and I am forever leaving it open. So I thought okay, can I build something that will help me with that. Now what we used is read switches. Now these are incredibly cheap. You can buy five for five pounds. And what you've got on one side is a magnetically driven read switch. It just switches on and off. On the other side, which is dropped on the floor all you've got is a little magnet. And they both got little sticky pads on the back and you put one with the magnet on the frame or the door itself and you put the other one with the wires on the frame outside next to it. And then when they move away from each other the state changes and you can read that in with your microcontroller or Raspberry Pi. So I built one up and hooked it up to a Raspberry Pi which you can see there and hooked it up to the garage door. And now my garage door has an API. You can talk to it. It actually lives up here. This is next to my solar panel inverter which talks Bluetooth for safety reasons. It's got four hundred of volts running through it DC. And you don't really want your plug-in things into it. So the Raspberry Pi sits there and chats Bluetooth to it getting stats out and uploading them. So it now does that and looks after the garage door as well. It also chats Bluetooth to Minisand Leaf which is parked outside so we can get stats and information from there. So it's quite a busy little thing. Now I realised at this point with the garage door that I was getting into another aspect of the internet of things that people talk about and that's big data. I wanted that to be a real good big slide. Never mind. So I've got big data now on the garage door. So let's have a look at it. So here's a typical day. The 21st of September last year. I need to say there were five door opening events all around 30 to 50 seconds. What I've learned from that is it takes me an average of 45 seconds to get a bottle of wine from the fridge. It's good to know. But when I compare it with the next week sorry, the next day, what's happening here? It's about 600 odd seconds it was open for. Why? Because I left the bloody garage door open again. But thankfully it told me not my neighbour so I was able to go out and do that and then what happened? I did it again later on but I caused it a bit quicker that time. Now this one's slightly more complicated but it does tell an interesting story. These data points, the axis by the way is at seven o'clock at the bottom, to 7.40 a.m. Between these two times my son leaves for school and he gets his bike out of the garage so he opens and closes the garage door. So these data points are at what time between 7 and 7.40 he did that. What we can see here is he is slowly getting later and later for school. So he can nip that right and he's looking at me now. So you see big data, very important. The latest project I've done is a rain sensor. Again, these rain sensors are insanely cheap. They're about a pound each and they're very, very simple. Just two lines, if it's raining it sends some information. If it's not raining it doesn't send some information and you can hook it up to a Raspberry Pi, no components required and there's plenty of code out there that you can Google to actually read the things in. So what I've done, as you can see here, is I used two sensors to get a bit more service area, made a little 3D printed case to hold them in place and then used a food container to give some water resistance. Then you've got a battery and the microcontroller inside there that is just constantly reading it and it's got a Wi-Fi connection so it can send an alert if it rains. Why have I built this? Because if you've had yourself or your wife's screech RAIN when the laundry's out you know you're going to come down some very wet laundry. So what you do is you put the laundry out and you just stick that out in the patio and just leave it there and it will alert us if it rains. What the? Backblaze, don't understand. Do not disturb mode. Naughty. Sorry about this. Sorry about that. If this is my network diagram now it's all getting a bit out of control and of course I want to be able to access that data in the cloud, on my laptop or on my phone, on a toilet in the Highlands of Scotland. So it's all got a bit much. So I did what every good programming engineer, software engineer does and writes through a messaging protocol and of course that was it and you can actually have a look at it now at wasit.org which is basically just a simple way in Python of getting devices to send and relay messages to each other. It's very much in an alpha state but have a look, see what you think. It's all on GitHub. So there we are in the Highlands of Scotland now. We're going to do something very, very stupid especially at EMF and try a live demo. So here's our lovely day which we've got currently now. I'm not just looking at my phone because I'm bored of giving this talk. That's not true at all. I'm just setting it up. Make sure it's nice and loud. Take it out and do not disturb. Right. Here's my phone. Here is my rain detector and oh dear, our lovely sunny day has turned into a thunderstorm. Now, we're going to use some high tech special effects to recreate that weather environment. There you go. So I don't know if you can see this but what I'm going to do is I'm going to spray this right next to electricity. Now I'm not going to do that. That's really stupid. Right. So we're going to, it's going to start raining on this device and nothing happens. It has actually activated and said oh it's raining but whether it's got an actual connection oh there you go, it's raining. Yes. So there you go and I don't have to pay a dumb subscription to anybody. So if you've been affected by any of the issues raised in this presentation here's some of the places you should check out and there's some more inspiration ideas to build your own internet things and there's some URLs as well. Thanks very much for coming along if you've got time for any questions. I don't know where in earth the schedule is now but yeah we're saying yes to questions so if anyone's got any questions please fire away. Oh do we have the ball thing? Oh there it is. Right that gentleman over there I think. The gentleman lady can't see. I'm blinded. Hello. I thought it might be you. What a wonderful talk. No it was really so much fun. The bit of software where you hit fabricate and it magically came from Germany. How much did it cost to sort of print and then ship out? Yeah because it's bespoke it's not particularly cheap it was about £30. That's not bad. Yeah it's alright and I was quite taken back of how seamless the process was. It kept sending me updates saying right you know we're doing a run on this day you'll have it a few days later. So yeah I was quite impressed with it. Cool thanks. By the way I'm just going to say that that gentleman's name is Terence. If you enjoyed this talk or if you didn't enjoy this talk you might enjoy his talk which is called the Connected House of Horrors which is on Sunday. Sunday at 12.40 right here. Yeah so he's done something a bit different from me with the internet of things but it's a great talk. Anyone else? Have you noticed you wrote your own protocol? What's it? Have you looked at NQTT at all because that operates in a similar manner? Yes absolutely. Now this is the problem this is not what it was it solves because there are many different ways of the devices talking to each other. HTTP, MQTT which for those who don't know is a really data efficient way. So when you've got big data things like let's say in Milton Keynes they monitor all the parking spaces so 10,000 odd parking spaces you're going to want to conserve your bandwidth so MQTT is designed for that kind of application. That's not the problem it solves. That was it is going to support MQTT as a delivery protocol. The problem was there was no standard way that I could find for a device that's never known about another device to talk to each other. So it's more of a schema than anything else. So any device I build is going to obey these simple rules for how it delivers the data and that means that anything I build in the future will be able to talk to it natively. Cool. I don't really care how it does it by carrier pigeon, MQTT, HTTP whatever it likes to do it. Thanks. Anyone else? This is going to be good. I love this ball thing. It's fantastic. Oh, not bad. Not bad at all. Yeah, yeah. Round of applause for that. Hello. Hello. You mentioned they were tropical fish. Yes. What happens if the fish tank gets too cold? They're actually quite hardy with the cold. They don't mind it that much. It's not good for them. It's much better than being too hot. In fact, we did a couple of fish and they were called Daniels that did actually survive the extinction level of ends, as we call it. Because they don't mind the temperature dropping or indeed increasing. They're quite hardy. But yeah, it depends on the fish, but always better too cold and too hot. 21 to 26 for the record. Okay. Cool. Is that everything? Well, thanks so much for coming along. Listen to me rambolon and I hope you have a great EMF. Thank you very much. Thank you.