DIY: Home monitoring with Ruby & Pi
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Cola, Helio
Ruby and RaspberryPi are available to us for quite sometime and this talk ismeant to discuss how to use Ruby to explore things on a RaspberryPi. From apractical point of view, we will go through installation, setup, and build asimple Motion Sensor application on a RaspberryPi. In a world we teach ourselves a lot of things, why not do it Ruby & Pi way?Let’s get our hands on a piece of hardware, understand what it takes to setupone up, install a couple of libraries, Ruby, RVM, RBENV, a GUI. Let’s get acouple of sensors: motion, temperature, humidity, tsunami, ectoplasm and seeif we detect a cool thing or two.
 Hi everybody, I'm happy to see the room full again. Thanks for that. So it's our last talk and it will be given by Helio. He's from Brazil but he lives in the US. He works for now for a nonprofit organization providing free literacy to students. And he will talk to you about how you can do home monitoring with Frostbite Repai and Ruby. So please welcome him with me. Hello everybody, so let me get started. And a little bit about myself. My name is Helio and I'm working in a nonprofit organization called Common Leeds. We do free literacy tools in student tracking tools. Mostly students and teachers, empowering teachers to improve education for kids. I've been doing software development for about 16 years and I've been working with Ruby on Rails for about 7 years, roughly. So the agenda of my talk is going to follow these major steps, which is why Hearthsbury Pi, Parallel or MicroPCs. What is available for you guys to poke around by install setup, your development environment and the emotional sensor app that I used to monitor my house when I was on vacation. So before I start, let me just ask you a quick question here. I think there is three main topics in my talk. One of them is Ruby, the other one is Raspberry Pi and Parallel and the other one is Ghost Stories. So who is here, who is in this room, it's like Ruby on Rails developer, Kenu Hazarin. Who is Raspberry Pi, kind of like stuff. And how about Ghost Stories? Alright, cool. So let me get started. So why Raspberry Pi and Parallel? So there's not a lot of things here in this slide that's kind of serious, but I was curious. I was not bored and I was doing some renovations in my house. And pretty much all these restarted because of Ray Hightower. I saw one of his lighting talking at a conference a couple years ago, talking about Parallel. And I was like, oh yeah, there is Parallel now and there is Raspberry Pi. I've heard about these things. So one day I'm going to poke around that. So that's how these next chapter of my career started. So what is available? Let's talk Raspberry Pi. You have Pi 0, Pi 1, Model A, Pi 2, Model B, Pi 3, Model B. These are the ones available now. And a little bit of visual for you guys. Pi 0, Pi 1, all of them. They pretty much look like the same difference in size. To get a little bit of perspective, these are Pi 0 and that's a quarter. So a Pi 0 is probably the size of your thumb. And a Raspberry Pi 3 case is like this. So that is this case over here. So this is pretty much the size. The Pi 3, which is the one that I bought and have been using it, is the size of a credit card. And this is that case. It's a plastic case for Raspberry Pi 3. So a little bit of the difference is between them. So you see mostly what's mattered to me is CPU and RAM. So you can see Pi 0 is a single core gigabyte, Pi 1A+, Pi 2 and Pi 3, the quad core processors already. And the Pi 3B, which is the latest one that was released maybe a year or so ago, is like 1.2 quad core. This is the one that I've been poking around. And this was also the first one to have wireless and Bluetooth. There is one interesting thing about this Pi 1A+, which is that it's the low power. It's like 1 watts and half a watt. And usually they recommend this if you want to, one of the scenarios that they describe that this is useful for is for, if you're a balloon or something that's going to fly around and is going to collect some data, and you really need low power because it's up in the air, it's not in your desk. That's the one for it. But it doesn't have that an add. So it is for embedded stuff, not for you to poke around in your basement. As far as price goes, the Pi 0 is $5, freaking cheap. The Pi 3 goes to $40. A little bit about dimensions of them and some GPIOs. All the latest ones, they have for the GPIO pins for you to plug sensors in whatever you want. So now moving on to Parallela. Parallela is pretty much another Raspberry Pi board. And they have these three options, a Microsoft or desktop and embedded. Although they are pretty much the same, close to the same size, they are quite different in price and in power. All their Parallela, they have 18 cores and they start in prices, $99. The embedded one is $260. So they all come with one gigabyte of RAM. The desktop and embedded has HDMI, the Microsoft doesn't, and they have only one USB port. So you need to plug something else if you want to poke around with that, mouse, keyboard, that kind of stuff. And the desktop has 24 ports and embedded 48. I haven't bought one of those yet, but it's on my to-do list as soon as I finish all the stuff that I want to do with the Raspberry Pi. I'm kind of curious to see what these 18 cores is really going to do and compare with the Raspberry Pi for whatever basic simple application that I usually want to do to do my home monitoring. Apart from Parallela and Raspberry Pi, there are other things. So Intel, Asus, all these big PC companies, they have their own version. So this Intel Galileo, Intel Galileo seems to run Linux, but the Asus, no, it doesn't. And that one over here, this one, it does not come with a processor. You have to buy separately. And there is also these stick PCs. Not sure if has anybody here ever used one of these? Okay, two people. All right, three. So this is mostly Windows based, and the way this is Intel one and this is an Asus one, and the way this stuff is, you plug in the back of your monitor and then you have a Windows. And that's it. So, buying, installing, setup. So now let's start getting into the Pi stuff. Where to buy? Element 14, other fruit, Amazon, or anywhere you find these micro centers near you. So I bought all of mine from Amazon. And now what is your buy? That's a good question because it depends on what you're going to do. If you like balloons and you want to put your pie in a balloon, you have to go to a Pi one because that's the low power and that's the one you need. If you're not, if you're going to do these stuff on your basement, your house, then you probably should go with the Pi 3, which is the latest one, has Wi-Fi and AT&T. That's the one I started. And it's easy for you to find these starter kits, which comes with a Pi 3, a Pi, a case, a power supply, heat sink. And you're going to need to buy these stuff separate, these SD cards. That's the basics. With that, you can have a Linux running on your home and poke around with that. You plug in a monitor on the TV and that's it. You don't need much more than that. The extras on these is camera sensors and a 7-inch touchscreen display. On my first, with my starter kit, I also bought some sensors because I want to do a home monitoring and a motion presence app. So I bought that at the beginning and then later on I did buy the camera and the 7-inch display, 7-inch touchscreen, which is this one. This is the 7-inch with a case and the Raspberry Pi is here at the back. There's a board and this is the Raspberry Pi board over here. So let's keep going. So depending on what machine you use at home, Windows, Linux, and Mac, these are some references. If you do use Linux as your main laptop at home or at work, I suggest you go for the second reference, which is from Ubuntu Mate. That's just going to fuse at home to you. The other one is more perhaps for Windows and Mac users. Now I am at a third of my talk and I want to kind of breathe in a little bit and I want you guys to look at this slide. If there is one thing that I want you guys to remember is what is written on this slide. So if you ever start working with Raspberry Pi for the first time because you came here and listened to me, this is what I want you guys to remember. So my tip to you, as soon as you start installing OS, I mean I'm talking about Linux, not talking about Windows, but as soon as you start installing Linux OS, that's where you end up executing a couple of commands that will have some of these ones. One of them is BS equals to 32M and the other one is BS equals to 1M. I hope that you remember me about this and for the first time you use BS equals to 1M. Because if you use the other one and you happen to follow the steps I followed, you're going to miss a lot of hours of your life, troubleshooting something without finding a solution. And I think it's related to that BS 32M, which is kind of block size, 32 megabytes versus block size, 1 megabyte. So I bought these stuff as a cool toy, comes at home, you're going to, the family go to sleep and you go to your office to do some work and to poke around with your new toy and you spend five hours in there trying to install a freaking Linux on it and it doesn't work. And then you go to sleep really sad because your new toy doesn't work. That's kind of what happened with me from 10am to 3am the morning, something like that. Downloads. So these are the three main OSes that I would like to try and that I picked at the beginning. So Core is just a plain Linux core that is no graphical interface, Ubuntu Mate in another one that has a nice set of installation steps. Pretty cool. And there is these things, Windows 10 for IoT Core, like what? And I was like, okay, I mean, I've decided to try. So when I started, I bought only one of these, the SD cards, and then I bought two more. And these is Ubuntu Mate, these is Ubuntu Core, and these is what I've been trying to do with Windows. So it's still my to-do list. So, and the SD is still in the package. So if you are a Mac user and you're going to install one of these Linux machines in your SD card, you mostly are going to run these three commands, a DD list. And in those references, you have more step-by-step on how to execute these and what to do. And I have one slide at the end with all the references and I'm going to publish these after the talk and you guys can look around. But basically, you're going to run these three DD lists to find, I mean, let me go from the beginning. So you're going to download an image, you're going to un-archive it, and you're going to stick an SD card in your Mac. And then as soon as that is done, you're going to run your DD list, which is just going to find what is your SD drive. You're going to do a diskUtube to amount my disk to you. And then you're going to do this DD, which kind of install that Linux distribution on your SD. And the third one is the one that is going to take a little longer, maybe 20 to 30 minutes. And then as soon as you have your SD card all done with your Linux on it, you're going to put on the Raspberry Pi, plug in the power, put on a monitor or a TV or anything like that. And you're going to boot. So the first boot will take a little longer and you're going to be sweating because you want this to work. And sometimes, depending on the Ubuntu that you decide, it's automatically going to extend the file system. If you use Ubuntu Mate, you have to manually do that. But there is a simple command in there in the installation procedures that you just need to run and it's easy and fast. You may need to do something else. So just follow instructions on the display. You may need to configure a network and create an admin account, the first one that you have. And this is a little picture of my Raspberry Pi, my TV and a keyboard. So if you look over here, this small display here is actually this box, which is the 7-inch display with the Pi at the back. And that's my living room TV and a keyboard and mouse that I was using. That's what I use for all the stuff that I did for the testing and programming my TV because I don't have an HDMI monitor and I have the TV. And this is the Raspberry Pi. This is exactly this box. And what you see over here is this is a motion sensor, infrared motion sensor with a black tape on the kind of covering it to minimize the noise. And so I could test. So this is actually what I end up installing in my house that I did my experiment. So as soon as you get, so you can use your TV monitor and keyboard to use your Raspberry Pi. You can use a 7-inch touchscreen or you can just SSH to your Linux machine for whatever laptop you have. So as soon as you do that, then you have your Linux. The Raspberry Pi is done. The installation is done. Now it's just another Linux machine that you are poking around. So now as soon as now that you have that Linux machine there, let's do some development, right? So my main development environment is playing old Ruby style, IVM, IVM-V, Post-Crystal, PGAdemy, and text editor, a browser. And I hooked these up on my TV and then I have it. And I kind of toggle between using the TV and the keyboard and just SSH from our Mac to there, to the Pi and then do some stuff in there using Veeam. But you can do whatever if it's better for you. It's a plain Ruby and Rails development environment as it gets, as classic as it gets. So this is the 7-inch touchscreen. There is a reference in there. It costs twice, close to three times more than the Pi itself. But if you're playing to do some infotainment system or do anything that requires some kind of display for someone else other than you do, so you may need that. It does not look well. It does not play well if you want to poke around the Linux itself because the screen is too small for you to open a terminal, to type a bunch of terminal commands. But it can be used as well. And this is an image that is started. I just pulled it up. That way you see my login page, my login screen. These use a terminal screen, my keyboard and a mouse somewhere in there. These 7-inch screens also have a soft keyboard. That's what you're seeing there in the bottom. And then you can type it in there. But it's small. You're not going to be able to type. You're going to need to need some pins to do, like to do on a tablet. You're not going to be able to use that to type anything soft to the terminal related. I was unable. So now let's move forward. Let's go to our MotionSensor app. That's what I was wanting to do from the first place. So that is my hello world for Raspberry Pi. That's the one that I decided to do. And basically what I want from these MotionSensor app is pretty simple. Detect a movement. And as soon as you detect a movement, you do something. Which is, and then if you go into the Ruby arrays, Ruby world is calling an API. It's pretty simple. Sound and alarm. Then you go back to the Pi and maybe you're going to use an external buzzer to do that. Turn on the lights and play the music. Again, you go back to the Pi and interface out. Turn on the camera, record something. Make a video from what your surroundings are. And stop when there is no more presence. And then report an event in a video. So those are the kind of stuff that you can do. The idea of, that is a very simple code to do. This scenario over here. The tech presence. Turn on the camera, record. And then turn off the camera. On the Raspberry Pi website, I can probably try to find that link and put in the references. It's 20 lines of code and you can do that in Ruby and Python. And my MotionSensor app is starting very, very simple because I don't want to build a MotionSensor app. I want to build, I want to monitor the sensor. But if you look at the data model, just users have locations, sensors, events and data. Locations and sensors can be kind of a bundle together. But if you want to have separate, my living room or one house A, house B and house C, your user can do that. And then each house has a bunch of sensors and each sensor has the events. And each event has data, which is the video or whatever else data you capture. Sound or anything. And I wanted to build this basic app because I want to detect presence of my house. And I want to be able to see that from my cell phone or from outside my house. And I use one of these enemy apps on Rails to build this very simple app that just creates a sensor and allows me to login and deploy it to Heroku. And that's what it looks like. That's how I was monitoring my house. And that you do in an hour or something, maybe a little bit more, you build that simple app for you to collect and store the data that's being generated by your sensors in a, by monitoring whatever environment you are. And now comes back now to this infrared motion sensor. This is the one that I used. This is the one that I tested that I left in there. I kept the black tape in there just to minimize the area and try to get less noise. But basically these, these are all the same. This is another one that I bought. And this is a zoom version of that. It's just infrared in infrared motion sensor. And basically there is a nice reference here. And here's about infrared motion sensor. I strongly suggest you to read this PDF. It's pretty cool. And that's where I got this picture. And basically the infrared sensor has two areas, the red and the green, which is the hot and the cold. So when the heat comes through the, through the hat to the hot area, the pie, the sensor is going to generate a high voltage. As soon as you leave that and you go through the code and you leave the area, the sensor generates a low voltage. That's pretty much roughly from what I understood. That's how these sensors works. But in that PDF there's a lot more information about these. But that's what I thought I was smart enough to share with you guys. And then now monitoring a sensor. So these are a little bit of code. I use these gem called Piper. And the reference is there. It's on GitHub. It's open source and all of that. And this is a pretty simple Ruby code that actually does my monitoring. Because the one thing that I wanted most is to get these stuff working in my house. So you run these on, on your, that's what's going to be running on your Raspberry Pi. And basically what it does here is I have my PIN 14. My PIN 14 is, I don't think I'm going to be able to show this, but it's a GPIO pin where you just put some jumper cable. And these cables here, these connect to the, to the sensor. And the other side goes directly into your Pi. So in that PIN 14, that's where the motion sensors connect. That's where the data is. The other two cables of the motion sensor, one is power grounded in data. The data goes in the 14 and then you say, hey, as soon as 14 goes high, throw me an event. And then I'm going to do something. That means that I detect, the sensor detects the presence. And then basically I do a little bit of logic and he'd say, all right, I don't want to generate every single little thing going on through my living room. So if, if the, the, the burglar or my wife or whatever else goes to my living room within the same six, the same unit, I'm going to consider that as a single presence. I don't want to have five, five motion events within a minute for the same person walking around. And that's the logic that I do on current presence and last presence. And these simple mapping here are to do that. And as soon as I do that, then I'm reporting. I'm going to call my, that API that the Rails app that I have that has that credit app and also very basic API API. And it does not use any common practice of API because this is a post and not a get, but three am in the morning, I, I did a get to report that sensor. And everything is hard to code in here. As soon as I started doing this for real, I had to call it the hero co-op in here. And the hero co-op, the sensor ID is one. So these scripts are only going to work for that scenario because I didn't have much time in the, I was just experimenting playing with it. So, and that's how you monitor infrared sensor. And one interesting thing here now is I'm going to, I'm going to, I think it's really on fault. Let me make a side note here. I think it's really unfortunate that now we live in a world that I cannot travel with those, with all these electronics. I, I, I was encouraged enough to board an airplane coming from US to, to, to Europe, bringing all these electronics. The maximum that I bought was these. But I'm going to, but, but there is one interesting aspect to all these sensors is every single sensor, regarding whether it's an infrared sensor or whatever the sensor. If they work in a high low, then your code is pretty much the same. And what you have to know what the, the, the binding between these data being changed in the field in the rest of the pie and whatever your cloud system you have is which sensor goes in which pin. And there is a lot of software that you can build to make sure that your pie, it's slave and you pull the data from the cloud, but to do that, but there is nothing like that on these demo that I have. So let me show you a little bit of a sensor. Let me take you on a sensor journey and show you some of them. So that's the classic one that I showed you guys, the motion sensor. This is smoke and combustible gas. I think they actually send these wrong to me because they seem to be exactly the same. And, but they came as two different sensor. In this one, guess, guess which one this is? I'm not sure if I heard anything, but this is just a buzzer. If you want to, if you want to play some sound after you detect something. This is a carbon monoxide. And these, these all, for example, these also have the three pins, the power ground and data. So it will work the same way that the infrared sensor works. So you're going to send zero one and that's going to, that are going to buzz or stop buzzing. So carbon monoxide. How about this one? Guess which one this is? Is it temperature or light pressure? Kind of pressure is a digital touch. If you touch your hand in there, it's going to throw an event. These are flame. All right. So I don't want to check whether Mike has some fire, but it came on a box and that's fine. I have in there. These are vibration, these temperature humidity that, that, that one, I don't want to poke around that. This one is sound. That's interesting as well. But it doesn't seem this one is going to give you the sound. Just going to say, hey, there is some sound level over here and not. This is the coolest one that came in the box. And also the biggest. Can you guess which one is this? Water level. Exactly. Oh man, I never could guess anybody would find out that this is a water level. This is a water level. I want to play around with this so much. And so my home monitor system. So let me go through now my experiment that I did on my house. This is what I actually installed on my house. I deployed this, this, that, that app into Hiroku and it's going to their running. And I went on a vacation on a very long vacation. So all my family went on a vacation for two months. Sometime November, December last year. My contract was, he was going to come to the house regularly. A side note on this contract. He, he's been doing all the renovation that we're doing the house for the last four, four, five years. And he was just there going to go to the house, walk through and make sure he's not on fire when we are gone. So, and I asked him, hey, there will be some things, some stuff there in the living room. So every time you come by, you walk around the living room a couple of times as you're doing your chores. And do that for me because I have this thing that probably you're going to have to install at my house next to you. And I want to test it. So, and, and that's what happened. So we, we flew away and November 1st and we came back and the experiment was planned to start November 1st, which is the day that we leave until you 21st, which is the last day that the contract was supposed to go to our house before we come back. And I left through running. I left this stuff running with that sensor on my living room connected. The sensor is there. And let me show you a little bit of the logs of that. So, so here we go. It's running local hosts, but these are, sorry. Oh, that is going to be, okay, that is a display. There we go. So this is that, this is that Rails app that is on, is running on my Mac, but is a backup database from, from what I got reported on Heroku. And during the time I got 6,679 reports of presence in my house. And I was like, whoa. And so everything started around there. You see October 29. This is probably some test, the first one, ID one, ID two. So November 1st was the day that I was trying to finish these stuff and get it working. So I had to stay late night and I was testing, you see, 3.30 a.m. This is 3.30 a.m. My time, whatever time zone in US, 3.45. And the test keep going. You see, here's when I realized that, you see, 3.40 is when I realized that I need some kind of timer because I don't want to see 3s, 3 presence because I just crossed my hand in front of the sensor. That's why I'm like, all right, maybe 5 minutes or 1 minute is the time that if you pass here, that takes presence 5 times in a minute. I just want to find out that that happened once. So that's what I did that, the 2 minutes, the 1 minute. So November 1st I kept working, 3.50, 5.45 a.m. 4 a.m. and then 4.20 and then I went to sleep and 7 a.m. I don't know, I don't know my wife, my kids, I don't know what happened. Here's us probably going, packing up and going on a vacation November 1st and then November 5 p.m. and let me keep going here so, sorry, went too fast. November 1st, 5 p.m. This is probably us packing up and going and traveling and then here we left the house somewhere on this. But I don't know what happened at that night at my house and he kept going. You see, 3 a.m. I know the contractor that was going to my house pretty well and that is extremely unlikely was him. So, but I have to make another side note in here and he believes in ghosts. Once a couple years ago and he came back for another round of renovation of the house and he said, we were talking about something, hey, there is a lot of noise in your house, there is something going on in here and he is scared of that. So, but anyway, that happened way before I started working with this pie stuff, we had this conversation. So, my sensor kept going, the infrared motion sensor kept detecting infrared where that is. This was installed in my living room near my TV. It was winter in the US so the house was, the heating system was coming and going as it is too cold and heats up. So, it's possible it was that, I don't know, but there was no direct air going into the sensor and I had the black tape on the sensor. So, I wasn't trying to catch a lot of small things, I just want to see if this is working. This kept going November 3rd, 4th, 5th, 6th at all times of the day, during the day, night and afternoon. Some of these days, really my contractor here come to the house and check it up, make sure that everything is fine. November 8th and then that kept going. So, I'm not going to keep going over here, but if you scroll to these, that's going to keep going. And I was gone and you see every time from 2 to 4, every time between 1am and 4am there was some event. And even if my contractor went to my house to throw some parties when I'm gone, he didn't do that every day. So, and that kept going, kept going. And one day I called him, he called me and I told him that this was happening and he told, guess what he told me? I told you that he's a ghost in your house. And around November 19th, I asked him to shut down. Because when I said that this was happening in the house, he said, no, no, I'm not going there. And he said, all right, go power off that stuff, go to it, unplug from the power and that's it. I'm done with my experiment and it was planned to last until December, but it just took a couple of weeks. Now let me display off and come back to my presentation. So that was my experiment. And so here it goes, here are my theories. So what happened in my house? So one of the things is that he is a ghost in my house. It's possible that that's happening. And that ghost is generating some infrared in my sensor and as soon as the ghost wakes up and walks through my house, it detects a presence and my sensor is detecting that. My infrared sensor is detecting that. So the other theory is that there is an infrared noise near my sensor, which is, I don't know, which one is more likely. But it's a possibility. The other possibility is my sensor is broken. That's another thing, hard to test. That's not like pushing your code to GitHub and let your CI run your test. That's not how you test sensors. And it's hard to find out whether it's broken or not. But I do suspect this one is broken. Or it can be bugging my code. I work on their code every night from 10 p.m. to 3 p.m. Not every night, but I didn't have a lot of time before I travel. And because I wanted these to leave these running at my house, when I was gone, I didn't have much time. I had to finish by the time I was leaving. But the code is pretty straightforward. Most like the sensor is broken. Or there is some noise. I don't know. Or maybe there is a ghost. So here are all the references that I showed the code, the presentation. And that's what I came up here to talk to you guys. So thank you for your time. And if you have any questions, I'll be more than happy to answer. We have 10 minutes for questions. No questions? Do you have multiple rat rat pies or just cables from the sensor or from the house? Can you repeat the beginning of the question? Do you have multiple pies or just one with a lot of cables going through the whole house? The question is if I have multiple pies through the house, right? No, I only have one. So far I only bought one. But my idea from my next renovation prior to the house is to kind of install maybe two, one at the front door and one at the back door of the house. I'll probably try to do that sometime this year. What are some of the debugging tools that you use with Raspberry Pi, like say, you know, say you plug in the SD card and it's like boot up. What are some of the things you do to figure out why that's happening? So the question is what are the debugging tools that I use to troubleshoot the Pi and if I put the SD in a boot up and it doesn't run, what do I do? So that's a good question. I didn't use any fancy tools. The problem that I had with the block size 32 megabytes, I Googled a hack out of that to see if I could find anything I couldn't find. Nothing explaining why it was breaking, why my Pi was not the Linux was not starting up. For the sensor stuff, that's a simple script. And so there's not a lot of... I never really came across any tool to test the sensor itself, but it's just logging in. So I didn't really use any debugging tool other than trying to find an answer on the Internet. Any more questions? Can you read like... You can only read one or zero from the sensor, you can read like two hundred or two hundred. I'm not sure if I follow your question. There's a way to measure if there is too hot. How hot is this for the sensor? It's only one of... like two or four. Okay, so the question is if there is a way to measure how hot is the sensor? So this is infrared, so it just gives you high and low. But I do believe there are some temperature sensors that can give you like the water level. The water level is going to give you something else other than two or four. It has to give you 10, 20, 30, whatever percentage on that level. So that's going to vary on sensor by sensor. Most like on sensor like that, you may need more than three pins. Or maybe it's going to find everything, everything changes, I give you a number. So I give you 10, 20, and then in that case, only one pin should be enough. I think that changing your approach and using a camera instead. So the question is if I look into changing my approach and using a camera to detect... That's an interesting question. Does an application that does that could motion? Yeah, so instead of detecting infrared and saying, oh, there is an infrared in here, you keep taking pictures and then you detect movement and you can compare images and see. The one reason why I didn't go for that is because I want to test the sensor itself. The camera is just a software and you put a camera in there in your USB and then a bunch of software doing that. The sensor, no, the sensor is a piece of hardware that you have to jump in and you're cabling into the pie and do that. So that's why I decided to do that. But I do want to extend that to use that other code that detects the presence and light up the camera record because if there is a ghost in my house, maybe the camera is going to tell me something. Any more questions? I have a question. Did you resolve the case? No, no, I have not resolved the case. What about a mouse? It could be a mouse that only gets in my house when we are gone because I've never seen a mouse living there for four years. I've never seen a mouse in the house. But it could be. Maybe it's a mouse. It only comes... A fly. The one reason that I put that tape in there is... So the infrared sensor has two imprimed. One is sensitive and one is timing. I tuned it really down but to the minimum sensitivity possible and I put the tape to try to go around that. So if a fly goes around, it's not going to hit the sensor but it could be. So maybe the camera is going to help me to find out if there is a fly or a mouse. What did you use that for? Thank you for asking this question. So the question is what do I use this rack for? And the question is I still don't know. This is a freaking cool toy. This is a Raspberry Pi cluster. So over here we have five boards. One board, two, three, four and five. On top this is a switch that connects all of them at an end and you can get out to the web. And at the bottom is a 500 gigabytes SD card and all these pies have Linux using NFS. So instead of using the SD card, these 32 gigabytes SD card, they are using Linux and NFS on the SSD drive. And I got this picture from the references here. This is a guy from Google that made this presentation in DC a couple of months ago. And he found out this conference here in Europe. And you can buy these and you can do that yourself. But these cost like $600. So it's not that cheap. And I'm still trying to find a use for that. So if you guys have any idea, let me know because I'm really interested in buying one of those. But for that kind of money, I need to find a better usage other than hunting ghosts. So the question is if the pie can boot directly from the NFS. I don't know. There's a good question. But on that link, there is a whole article that the guy did. It is possible that he did something. But it's possible that he might have an SD card in there. I'm not sure if you can boot directly from the NFS. But that's all Linux. I think most of it was with an SD card because I wasn't able to boot from the NFS. Have you tried using NFS? I tried just starting it up and then it... Okay. You may need the SD because you need to get the Linux, something the Linux in there. Then the Linux knows that it needs to go to the NFS. So... Thank you, my man. Thank you, my man.
 Hi everybody, I'm happy to see the room full again.  Thanks for that.  So it's our last talk and it will be given by Helio.  He's from Brazil but he lives in the US.  He works for now for a nonprofit organization providing free literacy to students.  And he will talk to you about how you can do home monitoring with Frostbite Repai and Ruby.  So please welcome him with me.  Hello everybody, so let me get started.  And a little bit about myself.  My name is Helio and I'm working in a nonprofit organization called Common Leeds.  We do free literacy tools in student tracking tools.  Mostly students and teachers, empowering teachers to improve education for kids.  I've been doing software development for about 16 years and I've been working with Ruby on Rails for about 7 years, roughly.  So the agenda of my talk is going to follow these major steps, which is why Hearthsbury Pi, Parallel or MicroPCs.  What is available for you guys to poke around by install setup, your development environment and the emotional sensor app that I used to monitor my house when I was on vacation.  So before I start, let me just ask you a quick question here.  I think there is three main topics in my talk.  One of them is Ruby, the other one is Raspberry Pi and Parallel and the other one is Ghost Stories.  So who is here, who is in this room, it's like Ruby on Rails developer, Kenu Hazarin.  Who is Raspberry Pi, kind of like stuff.  And how about Ghost Stories?  Alright, cool.  So let me get started.  So why Raspberry Pi and Parallel?  So there's not a lot of things here in this slide that's kind of serious, but I was curious.  I was not bored and I was doing some renovations in my house.  And pretty much all these restarted because of Ray Hightower.  I saw one of his lighting talking at a conference a couple years ago, talking about Parallel.  And I was like, oh yeah, there is Parallel now and there is Raspberry Pi.  I've heard about these things.  So one day I'm going to poke around that.  So that's how these next chapter of my career started.  So what is available?  Let's talk Raspberry Pi.  You have Pi 0, Pi 1, Model A, Pi 2, Model B, Pi 3, Model B.  These are the ones available now.  And a little bit of visual for you guys.  Pi 0, Pi 1, all of them.  They pretty much look like the same difference in size.  To get a little bit of perspective, these are Pi 0 and that's a quarter.  So a Pi 0 is probably the size of your thumb.  And a Raspberry Pi 3 case is like this.  So that is this case over here.  So this is pretty much the size.  The Pi 3, which is the one that I bought and have been using it, is the size of a credit card.  And this is that case.  It's a plastic case for Raspberry Pi 3.  So a little bit of the difference is between them.  So you see mostly what's mattered to me is CPU and RAM.  So you can see Pi 0 is a single core gigabyte, Pi 1A+, Pi 2 and Pi 3, the quad core processors already.  And the Pi 3B, which is the latest one that was released maybe a year or so ago, is like 1.2 quad core.  This is the one that I've been poking around.  And this was also the first one to have wireless and Bluetooth.  There is one interesting thing about this Pi 1A+, which is that it's the low power.  It's like 1 watts and half a watt.  And usually they recommend this if you want to, one of the scenarios that they describe that this is useful for is for,  if you're a balloon or something that's going to fly around and is going to collect some data,  and you really need low power because it's up in the air, it's not in your desk.  That's the one for it.  But it doesn't have that an add.  So it is for embedded stuff, not for you to poke around in your basement.  As far as price goes, the Pi 0 is $5, freaking cheap.  The Pi 3 goes to $40.  A little bit about dimensions of them and some GPIOs.  All the latest ones, they have for the GPIO pins for you to plug sensors in whatever you want.  So now moving on to Parallela.  Parallela is pretty much another Raspberry Pi board.  And they have these three options, a Microsoft or desktop and embedded.  Although they are pretty much the same, close to the same size, they are quite different in price and in power.  All their Parallela, they have 18 cores and they start in prices, $99.  The embedded one is $260.  So they all come with one gigabyte of RAM.  The desktop and embedded has HDMI, the Microsoft doesn't, and they have only one USB port.  So you need to plug something else if you want to poke around with that, mouse, keyboard, that kind of stuff.  And the desktop has 24 ports and embedded 48.  I haven't bought one of those yet, but it's on my to-do list as soon as I finish all the stuff that I want to do with the Raspberry Pi.  I'm kind of curious to see what these 18 cores is really going to do and compare with the Raspberry Pi for whatever basic simple application  that I usually want to do to do my home monitoring.  Apart from Parallela and Raspberry Pi, there are other things.  So Intel, Asus, all these big PC companies, they have their own version.  So this Intel Galileo, Intel Galileo seems to run Linux, but the Asus, no, it doesn't.  And that one over here, this one, it does not come with a processor.  You have to buy separately.  And there is also these stick PCs.  Not sure if has anybody here ever used one of these?  Okay, two people.  All right, three.  So this is mostly Windows based, and the way this is Intel one and this is an Asus one, and the way this stuff is,  you plug in the back of your monitor and then you have a Windows.  And that's it.  So, buying, installing, setup.  So now let's start getting into the Pi stuff.  Where to buy?  Element 14, other fruit, Amazon, or anywhere you find these micro centers near you.  So I bought all of mine from Amazon.  And now what is your buy?  That's a good question because it depends on what you're going to do.  If you like balloons and you want to put your pie in a balloon, you have to go to a Pi one because that's the low power and that's the one you need.  If you're not, if you're going to do these stuff on your basement, your house, then you probably should go with the Pi 3,  which is the latest one, has Wi-Fi and AT&T.  That's the one I started.  And it's easy for you to find these starter kits, which comes with a Pi 3, a Pi, a case, a power supply, heat sink.  And you're going to need to buy these stuff separate, these SD cards.  That's the basics.  With that, you can have a Linux running on your home and poke around with that.  You plug in a monitor on the TV and that's it.  You don't need much more than that.  The extras on these is camera sensors and a 7-inch touchscreen display.  On my first, with my starter kit, I also bought some sensors because I want to do a home monitoring and a motion presence app.  So I bought that at the beginning and then later on I did buy the camera and the 7-inch display, 7-inch touchscreen, which is this one.  This is the 7-inch with a case and the Raspberry Pi is here at the back.  There's a board and this is the Raspberry Pi board over here.  So let's keep going.  So depending on what machine you use at home, Windows, Linux, and Mac, these are some references.  If you do use Linux as your main laptop at home or at work, I suggest you go for the second reference, which is from Ubuntu Mate.  That's just going to fuse at home to you.  The other one is more perhaps for Windows and Mac users.  Now I am at a third of my talk and I want to kind of breathe in a little bit and I want you guys to look at this slide.  If there is one thing that I want you guys to remember is what is written on this slide.  So if you ever start working with Raspberry Pi for the first time because you came here and listened to me, this is what I want you guys to remember.  So my tip to you, as soon as you start installing OS, I mean I'm talking about Linux, not talking about Windows,  but as soon as you start installing Linux OS, that's where you end up executing a couple of commands that will have some of these ones.  One of them is BS equals to 32M and the other one is BS equals to 1M.  I hope that you remember me about this and for the first time you use BS equals to 1M.  Because if you use the other one and you happen to follow the steps I followed, you're going to miss a lot of hours of your life,  troubleshooting something without finding a solution.  And I think it's related to that BS 32M, which is kind of block size, 32 megabytes versus block size, 1 megabyte.  So I bought these stuff as a cool toy, comes at home, you're going to, the family go to sleep and you go to your office to do some work  and to poke around with your new toy and you spend five hours in there trying to install a freaking Linux on it and it doesn't work.  And then you go to sleep really sad because your new toy doesn't work.  That's kind of what happened with me from 10am to 3am the morning, something like that.  Downloads. So these are the three main OSes that I would like to try and that I picked at the beginning.  So Core is just a plain Linux core that is no graphical interface, Ubuntu Mate in another one that has a nice set of installation steps.  Pretty cool.  And there is these things, Windows 10 for IoT Core, like what?  And I was like, okay, I mean, I've decided to try.  So when I started, I bought only one of these, the SD cards, and then I bought two more.  And these is Ubuntu Mate, these is Ubuntu Core, and these is what I've been trying to do with Windows.  So it's still my to-do list.  So, and the SD is still in the package.  So if you are a Mac user and you're going to install one of these Linux machines in your SD card,  you mostly are going to run these three commands, a DD list.  And in those references, you have more step-by-step on how to execute these and what to do.  And I have one slide at the end with all the references and I'm going to publish these after the talk and you guys can look around.  But basically, you're going to run these three DD lists to find, I mean, let me go from the beginning.  So you're going to download an image, you're going to un-archive it, and you're going to stick an SD card in your Mac.  And then as soon as that is done, you're going to run your DD list, which is just going to find what is your SD drive.  You're going to do a diskUtube to amount my disk to you.  And then you're going to do this DD, which kind of install that Linux distribution on your SD.  And the third one is the one that is going to take a little longer, maybe 20 to 30 minutes.  And then as soon as you have your SD card all done with your Linux on it,  you're going to put on the Raspberry Pi, plug in the power, put on a monitor or a TV or anything like that.  And you're going to boot.  So the first boot will take a little longer and you're going to be sweating because you want this to work.  And sometimes, depending on the Ubuntu that you decide, it's automatically going to extend the file system.  If you use Ubuntu Mate, you have to manually do that.  But there is a simple command in there in the installation procedures that you just need to run and it's easy and fast.  You may need to do something else.  So just follow instructions on the display.  You may need to configure a network and create an admin account, the first one that you have.  And this is a little picture of my Raspberry Pi, my TV and a keyboard.  So if you look over here, this small display here is actually this box, which is the 7-inch display with the Pi at the back.  And that's my living room TV and a keyboard and mouse that I was using.  That's what I use for all the stuff that I did for the testing and programming my TV because I don't have an HDMI monitor and I have the TV.  And this is the Raspberry Pi.  This is exactly this box.  And what you see over here is this is a motion sensor, infrared motion sensor with a black tape on the kind of covering it to minimize the noise.  And so I could test.  So this is actually what I end up installing in my house that I did my experiment.  So as soon as you get, so you can use your TV monitor and keyboard to use your Raspberry Pi.  You can use a 7-inch touchscreen or you can just SSH to your Linux machine for whatever laptop you have.  So as soon as you do that, then you have your Linux. The Raspberry Pi is done.  The installation is done.  Now it's just another Linux machine that you are poking around.  So now as soon as now that you have that Linux machine there, let's do some development, right?  So my main development environment is playing old Ruby style, IVM, IVM-V, Post-Crystal, PGAdemy, and text editor, a browser.  And I hooked these up on my TV and then I have it.  And I kind of toggle between using the TV and the keyboard and just SSH from our Mac to there, to the Pi and then do some stuff in there using Veeam.  But you can do whatever if it's better for you.  It's a plain Ruby and Rails development environment as it gets, as classic as it gets.  So this is the 7-inch touchscreen. There is a reference in there.  It costs twice, close to three times more than the Pi itself.  But if you're playing to do some infotainment system or do anything that requires some kind of display for someone else other than you do, so you may need that.  It does not look well. It does not play well if you want to poke around the Linux itself because the screen is too small for you to open a terminal, to type a bunch of terminal commands.  But it can be used as well.  And this is an image that is started.  I just pulled it up. That way you see my login page, my login screen.  These use a terminal screen, my keyboard and a mouse somewhere in there.  These 7-inch screens also have a soft keyboard.  That's what you're seeing there in the bottom.  And then you can type it in there.  But it's small. You're not going to be able to type.  You're going to need to need some pins to do, like to do on a tablet.  You're not going to be able to use that to type anything soft to the terminal related.  I was unable.  So now let's move forward. Let's go to our MotionSensor app.  That's what I was wanting to do from the first place.  So that is my hello world for Raspberry Pi.  That's the one that I decided to do.  And basically what I want from these MotionSensor app is pretty simple.  Detect a movement. And as soon as you detect a movement, you do something.  Which is, and then if you go into the Ruby arrays, Ruby world is calling an API.  It's pretty simple. Sound and alarm.  Then you go back to the Pi and maybe you're going to use an external buzzer to do that.  Turn on the lights and play the music.  Again, you go back to the Pi and interface out.  Turn on the camera, record something.  Make a video from what your surroundings are.  And stop when there is no more presence.  And then report an event in a video.  So those are the kind of stuff that you can do.  The idea of, that is a very simple code to do.  This scenario over here.  The tech presence.  Turn on the camera, record.  And then turn off the camera.  On the Raspberry Pi website, I can probably try to find that link and put in the references.  It's 20 lines of code and you can do that in Ruby and Python.  And my MotionSensor app is starting very, very simple because I don't want to build a MotionSensor app.  I want to build, I want to monitor the sensor.  But if you look at the data model, just users have locations, sensors, events and data.  Locations and sensors can be kind of a bundle together.  But if you want to have separate, my living room or one house A, house B and house C, your user can do that.  And then each house has a bunch of sensors and each sensor has the events.  And each event has data, which is the video or whatever else data you capture.  Sound or anything.  And I wanted to build this basic app because I want to detect presence of my house.  And I want to be able to see that from my cell phone or from outside my house.  And I use one of these enemy apps on Rails to build this very simple app that just creates a sensor and allows me to login and deploy it to Heroku.  And that's what it looks like.  That's how I was monitoring my house.  And that you do in an hour or something, maybe a little bit more, you build that simple app for you to collect and store the data that's being generated by your sensors in a, by monitoring whatever environment you are.  And now comes back now to this infrared motion sensor.  This is the one that I used.  This is the one that I tested that I left in there.  I kept the black tape in there just to minimize the area and try to get less noise.  But basically these, these are all the same.  This is another one that I bought.  And this is a zoom version of that.  It's just infrared in infrared motion sensor.  And basically there is a nice reference here.  And here's about infrared motion sensor. I strongly suggest you to read this PDF.  It's pretty cool.  And that's where I got this picture.  And basically the infrared sensor has two areas, the red and the green, which is the hot and the cold.  So when the heat comes through the, through the hat to the hot area, the pie, the sensor is going to generate a high voltage.  As soon as you leave that and you go through the code and you leave the area, the sensor generates a low voltage.  That's pretty much roughly from what I understood.  That's how these sensors works.  But in that PDF there's a lot more information about these.  But that's what I thought I was smart enough to share with you guys.  And then now monitoring a sensor.  So these are a little bit of code.  I use these gem called Piper.  And the reference is there.  It's on GitHub.  It's open source and all of that.  And this is a pretty simple Ruby code that actually does my monitoring.  Because the one thing that I wanted most is to get these stuff working in my house.  So you run these on, on your, that's what's going to be running on your Raspberry Pi.  And basically what it does here is I have my PIN 14.  My PIN 14 is, I don't think I'm going to be able to show this, but it's a GPIO pin where you just put some jumper cable.  And these cables here, these connect to the, to the sensor.  And the other side goes directly into your Pi.  So in that PIN 14, that's where the motion sensors connect.  That's where the data is.  The other two cables of the motion sensor, one is power grounded in data.  The data goes in the 14 and then you say, hey, as soon as 14 goes high, throw me an event.  And then I'm going to do something.  That means that I detect, the sensor detects the presence.  And then basically I do a little bit of logic and he'd say, all right, I don't want to generate every single little thing going on through my living room.  So if, if the, the, the burglar or my wife or whatever else goes to my living room within the same six, the same unit, I'm going to consider that as a single presence.  I don't want to have five, five motion events within a minute for the same person walking around.  And that's the logic that I do on current presence and last presence.  And these simple mapping here are to do that.  And as soon as I do that, then I'm reporting.  I'm going to call my, that API that the Rails app that I have that has that credit app and also very basic API API.  And it does not use any common practice of API because this is a post and not a get, but three am in the morning, I, I did a get to report that sensor.  And everything is hard to code in here.  As soon as I started doing this for real, I had to call it the hero co-op in here.  And the hero co-op, the sensor ID is one. So these scripts are only going to work for that scenario because I didn't have much time in the, I was just experimenting playing with it.  So, and that's how you monitor infrared sensor.  And one interesting thing here now is I'm going to, I'm going to, I think it's really on fault.  Let me make a side note here.  I think it's really unfortunate that now we live in a world that I cannot travel with those, with all these electronics.  I, I, I was encouraged enough to board an airplane coming from US to, to, to Europe, bringing all these electronics.  The maximum that I bought was these.  But I'm going to, but, but there is one interesting aspect to all these sensors is every single sensor, regarding whether it's an infrared sensor or whatever the sensor.  If they work in a high low, then your code is pretty much the same.  And what you have to know what the, the, the binding between these data being changed in the field in the rest of the pie and whatever your cloud system you have is which sensor goes in which pin.  And there is a lot of software that you can build to make sure that your pie, it's slave and you pull the data from the cloud, but to do that, but there is nothing like that on these demo that I have.  So let me show you a little bit of a sensor. Let me take you on a sensor journey and show you some of them.  So that's the classic one that I showed you guys, the motion sensor.  This is smoke and combustible gas.  I think they actually send these wrong to me because they seem to be exactly the same.  And, but they came as two different sensor.  In this one, guess, guess which one this is?  I'm not sure if I heard anything, but this is just a buzzer.  If you want to, if you want to play some sound after you detect something.  This is a carbon monoxide.  And these, these all, for example, these also have the three pins, the power ground and data.  So it will work the same way that the infrared sensor works.  So you're going to send zero one and that's going to, that are going to buzz or stop buzzing.  So carbon monoxide.  How about this one?  Guess which one this is?  Is it temperature or light pressure?  Kind of pressure is a digital touch.  If you touch your hand in there, it's going to throw an event.  These are flame.  All right.  So I don't want to check whether Mike has some fire, but it came on a box and that's fine.  I have in there.  These are vibration, these temperature humidity that, that, that one, I don't want to poke around that.  This one is sound.  That's interesting as well.  But it doesn't seem this one is going to give you the sound.  Just going to say, hey, there is some sound level over here and not.  This is the coolest one that came in the box.  And also the biggest.  Can you guess which one is this?  Water level.  Exactly.  Oh man, I never could guess anybody would find out that this is a water level.  This is a water level.  I want to play around with this so much.  And so my home monitor system.  So let me go through now my experiment that I did on my house.  This is what I actually installed on my house.  I deployed this, this, that, that app into Hiroku and it's going to their running.  And I went on a vacation on a very long vacation.  So all my family went on a vacation for two months.  Sometime November, December last year.  My contract was, he was going to come to the house regularly.  A side note on this contract.  He, he's been doing all the renovation that we're doing the house for the last four, four, five years.  And he was just there going to go to the house, walk through and make sure he's not on fire when we are gone.  So, and I asked him, hey, there will be some things, some stuff there in the living room.  So every time you come by, you walk around the living room a couple of times as you're doing your chores.  And do that for me because I have this thing that probably you're going to have to install at my house next to you.  And I want to test it.  So, and, and that's what happened.  So we, we flew away and November 1st and we came back and the experiment was planned to start November 1st,  which is the day that we leave until you 21st, which is the last day that the contract was supposed to go to our house before we come back.  And I left through running.  I left this stuff running with that sensor on my living room connected.  The sensor is there.  And let me show you a little bit of the logs of that.  So, so here we go.  It's running local hosts, but these are, sorry.  Oh, that is going to be, okay, that is a display.  There we go.  So this is that, this is that Rails app that is on, is running on my Mac,  but is a backup database from, from what I got reported on Heroku.  And during the time I got 6,679 reports of presence in my house.  And I was like, whoa.  And so everything started around there.  You see October 29.  This is probably some test, the first one, ID one, ID two.  So November 1st was the day that I was trying to finish these stuff and get it working.  So I had to stay late night and I was testing, you see, 3.30 a.m.  This is 3.30 a.m.  My time, whatever time zone in US, 3.45.  And the test keep going.  You see, here's when I realized that, you see, 3.40 is when I realized that I need some kind of timer because I don't want to see 3s,  3 presence because I just crossed my hand in front of the sensor.  That's why I'm like, all right, maybe 5 minutes or 1 minute is the time that if you pass here,  that takes presence 5 times in a minute.  I just want to find out that that happened once.  So that's what I did that, the 2 minutes, the 1 minute.  So November 1st I kept working, 3.50, 5.45 a.m.  4 a.m. and then 4.20 and then I went to sleep and 7 a.m.  I don't know, I don't know my wife, my kids, I don't know what happened.  Here's us probably going, packing up and going on a vacation November 1st and then November 5 p.m.  and let me keep going here so, sorry, went too fast.  November 1st, 5 p.m.  This is probably us packing up and going and traveling and then here we left the house somewhere on this.  But I don't know what happened at that night at my house and he kept going.  You see, 3 a.m. I know the contractor that was going to my house pretty well and that is extremely unlikely was him.  So, but I have to make another side note in here and he believes in ghosts.  Once a couple years ago and he came back for another round of renovation of the house and he said,  we were talking about something, hey, there is a lot of noise in your house, there is something going on in here and he is scared of that.  So, but anyway, that happened way before I started working with this pie stuff, we had this conversation.  So, my sensor kept going, the infrared motion sensor kept detecting infrared where that is.  This was installed in my living room near my TV.  It was winter in the US so the house was, the heating system was coming and going as it is too cold and heats up.  So, it's possible it was that, I don't know, but there was no direct air going into the sensor and I had the black tape on the sensor.  So, I wasn't trying to catch a lot of small things, I just want to see if this is working.  This kept going November 3rd, 4th, 5th, 6th at all times of the day, during the day, night and afternoon.  Some of these days, really my contractor here come to the house and check it up, make sure that everything is fine.  November 8th and then that kept going.  So, I'm not going to keep going over here, but if you scroll to these, that's going to keep going.  And I was gone and you see every time from 2 to 4, every time between 1am and 4am there was some event.  And even if my contractor went to my house to throw some parties when I'm gone, he didn't do that every day.  So, and that kept going, kept going.  And one day I called him, he called me and I told him that this was happening and he told, guess what he told me?  I told you that he's a ghost in your house.  And around November 19th, I asked him to shut down.  Because when I said that this was happening in the house, he said, no, no, I'm not going there.  And he said, all right, go power off that stuff, go to it, unplug from the power and that's it.  I'm done with my experiment and it was planned to last until December, but it just took a couple of weeks.  Now let me display off and come back to my presentation.  So that was my experiment.  And so here it goes, here are my theories.  So what happened in my house?  So one of the things is that he is a ghost in my house.  It's possible that that's happening.  And that ghost is generating some infrared in my sensor and as soon as the ghost wakes up and walks through my house,  it detects a presence and my sensor is detecting that.  My infrared sensor is detecting that.  So the other theory is that there is an infrared noise near my sensor, which is, I don't know, which one is more likely.  But it's a possibility.  The other possibility is my sensor is broken.  That's another thing, hard to test.  That's not like pushing your code to GitHub and let your CI run your test.  That's not how you test sensors.  And it's hard to find out whether it's broken or not.  But I do suspect this one is broken.  Or it can be bugging my code.  I work on their code every night from 10 p.m. to 3 p.m.  Not every night, but I didn't have a lot of time before I travel.  And because I wanted these to leave these running at my house, when I was gone, I didn't have much time.  I had to finish by the time I was leaving.  But the code is pretty straightforward.  Most like the sensor is broken.  Or there is some noise.  I don't know.  Or maybe there is a ghost.  So here are all the references that I showed the code, the presentation.  And that's what I came up here to talk to you guys.  So thank you for your time.  And if you have any questions, I'll be more than happy to answer.  We have 10 minutes for questions.  No questions?  Do you have multiple rat rat pies or just cables from the sensor or from the house?  Can you repeat the beginning of the question?  Do you have multiple pies or just one with a lot of cables going through the whole house?  The question is if I have multiple pies through the house, right?  No, I only have one.  So far I only bought one.  But my idea from my next renovation prior to the house is to kind of install maybe two, one at the front door and one at the back door of the house.  I'll probably try to do that sometime this year.  What are some of the debugging tools that you use with Raspberry Pi, like say, you know, say you plug in the SD card and it's like boot up.  What are some of the things you do to figure out why that's happening?  So the question is what are the debugging tools that I use to troubleshoot the Pi and if I put the SD in a boot up and it doesn't run, what do I do?  So that's a good question.  I didn't use any fancy tools.  The problem that I had with the block size 32 megabytes, I Googled a hack out of that to see if I could find anything I couldn't find.  Nothing explaining why it was breaking, why my Pi was not the Linux was not starting up.  For the sensor stuff, that's a simple script.  And so there's not a lot of...  I never really came across any tool to test the sensor itself, but it's just logging in.  So I didn't really use any debugging tool other than trying to find an answer on the Internet.  Any more questions?  Can you read like...  You can only read one or zero from the sensor, you can read like two hundred or two hundred.  I'm not sure if I follow your question.  There's a way to measure if there is too hot.  How hot is this for the sensor?  It's only one of... like two or four.  Okay, so the question is if there is a way to measure how hot is the sensor?  So this is infrared, so it just gives you high and low.  But I do believe there are some temperature sensors that can give you like the water level.  The water level is going to give you something else other than two or four.  It has to give you 10, 20, 30, whatever percentage on that level.  So that's going to vary on sensor by sensor.  Most like on sensor like that, you may need more than three pins.  Or maybe it's going to find everything, everything changes, I give you a number.  So I give you 10, 20, and then in that case, only one pin should be enough.  I think that changing your approach and using a camera instead.  So the question is if I look into changing my approach and using a camera to detect...  That's an interesting question.  Does an application that does that could motion?  Yeah, so instead of detecting infrared and saying, oh, there is an infrared in here,  you keep taking pictures and then you detect movement and you can compare images and see.  The one reason why I didn't go for that is because I want to test the sensor itself.  The camera is just a software and you put a camera in there in your USB and then a bunch of software doing that.  The sensor, no, the sensor is a piece of hardware that you have to jump in and you're cabling into the pie and do that.  So that's why I decided to do that.  But I do want to extend that to use that other code that detects the presence and light up the camera record  because if there is a ghost in my house, maybe the camera is going to tell me something.  Any more questions?  I have a question. Did you resolve the case?  No, no, I have not resolved the case.  What about a mouse?  It could be a mouse that only gets in my house when we are gone because I've never seen a mouse  living there for four years. I've never seen a mouse in the house.  But it could be. Maybe it's a mouse.  It only comes...  A fly. The one reason that I put that tape in there is...  So the infrared sensor has two imprimed. One is sensitive and one is timing.  I tuned it really down but to the minimum sensitivity possible and I put the tape to try to go around that.  So if a fly goes around, it's not going to hit the sensor but it could be.  So maybe the camera is going to help me to find out if there is a fly or a mouse.  What did you use that for?  Thank you for asking this question.  So the question is what do I use this rack for?  And the question is I still don't know.  This is a freaking cool toy. This is a Raspberry Pi cluster.  So over here we have five boards. One board, two, three, four and five.  On top this is a switch that connects all of them at an end and you can get out to the web.  And at the bottom is a 500 gigabytes SD card and all these pies have Linux using NFS.  So instead of using the SD card, these 32 gigabytes SD card, they are using Linux and NFS on the SSD drive.  And I got this picture from the references here.  This is a guy from Google that made this presentation in DC a couple of months ago.  And he found out this conference here in Europe.  And you can buy these and you can do that yourself. But these cost like $600.  So it's not that cheap. And I'm still trying to find a use for that.  So if you guys have any idea, let me know because I'm really interested in buying one of those.  But for that kind of money, I need to find a better usage other than hunting ghosts.  So the question is if the pie can boot directly from the NFS. I don't know.  There's a good question. But on that link, there is a whole article that the guy did.  It is possible that he did something.  But it's possible that he might have an SD card in there.  I'm not sure if you can boot directly from the NFS. But that's all Linux.  I think most of it was with an SD card because I wasn't able to boot from the NFS.  Have you tried using NFS?  I tried just starting it up and then it...  Okay. You may need the SD because you need to get the Linux, something the Linux in there.  Then the Linux knows that it needs to go to the NFS.  So...  Thank you, my man.  Thank you, my man.
DIY_Home_monitoring_with_Ruby_Pi_0_47.png DIY_Home_monitoring_with_Ruby_Pi_48_131.png DIY_Home_monitoring_with_Ruby_Pi_132_4523.png DIY_Home_monitoring_with_Ruby_Pi_4524_5255.png DIY_Home_monitoring_with_Ruby_Pi_5256_7619.png DIY_Home_monitoring_with_Ruby_Pi_7620_8075.png DIY_Home_monitoring_with_Ruby_Pi_8076_9395.png DIY_Home_monitoring_with_Ruby_Pi_9396_10019.png DIY_Home_monitoring_with_Ruby_Pi_10020_21155.png DIY_Home_monitoring_with_Ruby_Pi_21156_21995.png DIY_Home_monitoring_with_Ruby_Pi_21996_22763.png DIY_Home_monitoring_with_Ruby_Pi_22764_22811.png DIY_Home_monitoring_with_Ruby_Pi_22812_22943.png DIY_Home_monitoring_with_Ruby_Pi_22944_26507.png DIY_Home_monitoring_with_Ruby_Pi_26508_30791.png DIY_Home_monitoring_with_Ruby_Pi_30792_31535.png DIY_Home_monitoring_with_Ruby_Pi_31536_32771.png DIY_Home_monitoring_with_Ruby_Pi_32772_33671.png DIY_Home_monitoring_with_Ruby_Pi_33672_33839.png DIY_Home_monitoring_with_Ruby_Pi_33840_34115.png DIY_Home_monitoring_with_Ruby_Pi_34116_34307.png DIY_Home_monitoring_with_Ruby_Pi_34308_35711.png DIY_Home_monitoring_with_Ruby_Pi_35712_37763.png DIY_Home_monitoring_with_Ruby_Pi_37764_38015.png DIY_Home_monitoring_with_Ruby_Pi_38016_38279.png DIY_Home_monitoring_with_Ruby_Pi_38280_38339.png DIY_Home_monitoring_with_Ruby_Pi_38340_38459.png DIY_Home_monitoring_with_Ruby_Pi_38460_38603.png DIY_Home_monitoring_with_Ruby_Pi_38604_40439.png DIY_Home_monitoring_with_Ruby_Pi_40440_40643.png DIY_Home_monitoring_with_Ruby_Pi_40644_40691.png DIY_Home_monitoring_with_Ruby_Pi_40692_40811.png DIY_Home_monitoring_with_Ruby_Pi_40812_41087.png DIY_Home_monitoring_with_Ruby_Pi_41088_41639.png DIY_Home_monitoring_with_Ruby_Pi_41640_43967.png DIY_Home_monitoring_with_Ruby_Pi_43968_44687.png DIY_Home_monitoring_with_Ruby_Pi_44688_44855.png DIY_Home_monitoring_with_Ruby_Pi_44856_44987.png DIY_Home_monitoring_with_Ruby_Pi_44988_45503.png DIY_Home_monitoring_with_Ruby_Pi_45504_45551.png DIY_Home_monitoring_with_Ruby_Pi_45552_47459.png DIY_Home_monitoring_with_Ruby_Pi_47460_47567.png DIY_Home_monitoring_with_Ruby_Pi_47568_47807.png DIY_Home_monitoring_with_Ruby_Pi_47808_47867.png DIY_Home_monitoring_with_Ruby_Pi_47868_47939.png DIY_Home_monitoring_with_Ruby_Pi_47940_48299.png DIY_Home_monitoring_with_Ruby_Pi_48300_48659.png DIY_Home_monitoring_with_Ruby_Pi_48660_50627.png DIY_Home_monitoring_with_Ruby_Pi_50628_50747.png DIY_Home_monitoring_with_Ruby_Pi_50748_51083.png DIY_Home_monitoring_with_Ruby_Pi_51084_51251.png DIY_Home_monitoring_with_Ruby_Pi_51252_51359.png DIY_Home_monitoring_with_Ruby_Pi_51360_51431.png DIY_Home_monitoring_with_Ruby_Pi_51432_51983.png DIY_Home_monitoring_with_Ruby_Pi_51984_52043.png DIY_Home_monitoring_with_Ruby_Pi_52044_52115.png DIY_Home_monitoring_with_Ruby_Pi_52116_52403.png DIY_Home_monitoring_with_Ruby_Pi_52404_53135.png DIY_Home_monitoring_with_Ruby_Pi_53136_53207.png DIY_Home_monitoring_with_Ruby_Pi_53208_53327.png DIY_Home_monitoring_with_Ruby_Pi_53328_53375.png DIY_Home_monitoring_with_Ruby_Pi_53376_53507.png DIY_Home_monitoring_with_Ruby_Pi_53508_56063.png DIY_Home_monitoring_with_Ruby_Pi_56064_67799.png DIY_Home_monitoring_with_Ruby_Pi_67800_67847.png DIY_Home_monitoring_with_Ruby_Pi_67848_67923.png