 Hello? All right, what does it say? Can anyone guess? Quickly, quickly, quickly. If something can be done in JavaScript, it will be done in JavaScript. That's what it's known as. So I was a little worried about the fact that the Hasgig guys have not put a parallel track, and they've given me 45 minutes. That was very scary. I walked up to Kiran and Xenob, and I told them, dude, what the hell's going on? And they were like, no, we just want people to be gathered around here when we are doing the feedback, so don't worry. That's what they told me. So I'm going to go with that for now. You said 1024 by 768, right? Yeah, cool, cool. All right, let's talk about robots. Robots with lasers? No, no lasers this time, sorry. And I'm not talking about robots that are controlled by JS. That's not what I'm talking about. That's fun, and that's cool. I'm talking about running JS on the robot, right? So it's not just controlling robots by JS. It's having a node instance running on the robot that you can now program to do what you want, right? I don't know if everyone's here, everyone here is familiar with the Raspberry Pi. In fact, Kiran's got a Raspberry Pi outside, so you can have a look at that. It's right at the entry, so you could probably have a look at that. It's a $35 computer. It's a really small computer. It's a piece of hardware. It's literally a PCB that you buy, which has got, it's credit card size. It's really small. You can install Debian on it, which is awesome, and it has got external hardware programmable pins, right? So this is a photograph of the Raspberry Pi. It's about the size of a credit card. It's really small. And to give you a sense of the size, this is how small it is. It's really, really small. But what's interesting to me is these pins right here, these are called the General Purpose Input Output Pins, GPIO, which are pins that you can control from inside your application to do stuff. You can set those pins high, which is not high in our sense, but high in the digital sense, right? Like set it high or set it low, right? So that's what's exciting to me. So when I got the Pi, the first thing I wanted to do, of course, is to install Node on it, no doubt. It was more painful than I thought, but at least it worked after sub-tries. Two and a half hours or so for compilation, but it worked, it worked awesome. So, yeah, another photograph right there, the bottom right, you can see the GPIO pins. Very, very exciting. And that's the reason why I bought my first Raspberry Pi in the first place, somewhere here. But never mind, let's hope this works. Anyway, so when I got the Raspberry Pi, I started programming around with it. I created a project on GitHub to help just with that. So it's called Pi GPIO. The Pi stands for Raspberry Pi, not my last name. So all you do is you require Pi GPIO, and then you can specify a pin for output. You can have a pin either for output or for input. And then you can write a one to that pin, or you can write a zero to that pin, right? Which is happening right there on the second line. And you can close the pin. So it's a really simple model with which you can start playing with the pins and start setting pins high and low. So that's fun. But now, how about we start doing more funky stuff? Let's run a motor off of that. So with my primitive Google skills, I found that there is this IC called L293D, which is apparently a family of ICs really, which is what is known as a motor driver. And we can get into the complexity of how it works. But essentially it lets you control motors digitally. So you can set a pin high or you can set a pin low and then you can get the motors to move. And so I created PyMotor, the name's obvious, which lets you define or create a motor object in node, and then turn the motor clockwise or counterclockwise using just as much code. So it's really simple, counterclockwise, and you can stop it, of course. So really simple API, I'm a huge fan of simple APIs. So I thought this was easy enough. So we've got a motor running now. How about adding some more stuff? If I can run node on the Raspberry Pi, I can run a web server on the Raspberry Pi. And if this is on wheels, we've got web server on wheels, right? And then why stop at a web server? Let's add a socket.io server, right? And so we can do a lot of fun stuff, right? So here we go. Can you see that thing in the plastic? Can you see the thing in the plastic there? That's the Raspberry Pi. Here's another view. Can you see that SD card sticking out at the bottom? That's the hard disk. It is, it is, I'm not kidding. And these wires that you see coming out from the top, that's connecting to the GPIO. I added the plastic because I had like roughed up the Raspberry Pi like twice or thrice already. So I added the plastic to sort of give it some sort of protection. The huge thing on the top is a battery. Turned out I was actually draining my batteries pretty quickly. And I don't know if the camera will capture this. Well, never mind. Never mind. It's probably the lighting's too bad anyway. So what I wanted to show you was that I've got the L293D IC running at the bottom. There it goes. So this thing right here. This thing right here is the L293 IC. And that's connected up to the GPIO pins of the Raspberry Pi. And now I should be able to drive the car around, right? So let's get started. Obviously now, how do I drive the car? The first thing I would need to do is get node running. So for that I would have to SSH into the car. Can we, can we switch to the? Yeah, yeah. Oh yeah, so I've wired it up with Wi-Fi as well. So it's actually got a Wi-Fi hub on it. It's got a USB hub to which there is a Wi-Fi controller thing attached. So it's actually hooked up to the network right now. And so I SSH into the Raspberry Pi. So we are now inside the Raspberry Pi. This is all running inside the Pi, right? And so let's see. I start a WebSocket server on the Raspberry Pi, okay? This is, I kid you not, this is running on the Raspberry Pi, right? And now so let's access the webpage that's exposed by this. And if anyone gets the joke. So I decided to, so now I should be able to move the bot around to just to be clear, I am, what I'm gonna do is I'm gonna be emitting socket events from inside the browser that's gonna be picked up by the web server on the Pi. That's gonna then control using Pi motor and then Pi GPIO is gonna control the motors running on the Raspberry Pi. I hope this works. Let's give it a shot. That's really weak. There we go. Oh! Oh! That's our reason forward movement isn't working. Come on, move forward, man. Kiran, can you just give us a little nudge and see if that works? Yeah, something's really messed up with it. Yeah, I think it's because the surface is this felt thing, right? Maybe because of that. Well, but it moves. You get the idea, right? Yeah, maybe that'll help. Yeah, successful demo there. Can you switch back to the, sorry for the trouble, man. All right, so we sort of got the bot moving. Not very exciting, but sort of. But the Pi has its limitations. One of the limitations is the fact that it runs Linux and Linux, like most other desktop or for that matter of server operating systems, is not a real-time operating system. So doing precise timing-based calculations is kind of hard. And I wanted to sort of make it crazier, right? So if anyone's familiar with the Arduino, Sudar will be talking about it in far more detail tomorrow. But I decided why not go completely overboard with craziness and add an Arduino board to the bot as well. So that I can do things that are very timing-specific. So for example, oh yeah, before that. So I wrote a small firmware for the Arduino NC, very, very small, less than like 50 lines of code because my C skills are awesome. And so I, you know, very small piece of code on C. That's basically talking over USB to the Pi, listening to instructions and then acting according to them. So I use Chris Williams' Node Serial port for doing this. As an aside, Chris Williams has been a huge help to the community. Not only did he build this, but he proactively got in touch with me to figure out how to get, how to, you know, take this development further. So huge thanks to Chris, if he ever watches this video in the future. Huge thanks to Chris. So start going crazy with it. You know, how about adding more sensors? How about adding an ultrasonic sensor to it, right? An ultrasonic sensor for those who don't know is essentially a combination of a speaker and a mic where the speaker emits a pulse of sound, that sort of frequency that's ultrasonic, hence the name. And then it sort of bounces off a target and comes back to you and you get to know how long it took. And so since you know the speed of sound, you can now figure out how far that distance was, right? So that's an ultrasonic sensor. Secondly, how about adding a servo motor to it so that I can make the ultrasonic sensor move, right? From place to place so I can sweep across a larger area. And you know, has to do some client-shed stuff as well. So let's add SVG to the mix, right? And like make that funky. And of course, all of this running straight from node, right? So here we go, let me... So what I'm gonna do is for the purpose of this demo, just gonna keep that there. Let's see if it can find it. And ask it to do a sweep. And so now, see that button at the top there, it says sweep. And what that's gonna do is now that's gonna use the Raspberry Pi to send instructions over a USB cable to the Arduino, asking it to keep moving the motor from step to step and keep taking readings from there. Pipe that data back into the Raspberry Pi. And then from the Raspberry Pi using web sockets down to the client, this is clearly overkill. But, you know, why not, right? Let's switch it. It's, well, it's not gonna be moving right now anyway, so. So this thing right here is the ultrasonic sensor. As you can see, it has got the speaker and the mic combo in front of it. It's mounted on top of a motor at the bottom there. Right next to the motor, you can see is the Arduino. And the Arduino over here is, ta-da. Well, it's wired up over USB to the Raspberry Pi, right? So I'm gonna ask you to do a sweep and let's see how that works. This is the Raspberry Pi talking to the Arduino, sending it instructions, getting data from the sweep sensor and then sending it back into Arduino and then into the Raspberry Pi and then over web sockets down to the client, right? So what I'll do is now let me see, let me show you what's happening on the client side of things. Right, so it's connected. And now when I ask for a sweep, you'll be able to see that it's like streaming all this data, right? That's coming in from the sensors into the Pi. It's just a crazy amount of data that's coming through onto the client, ultimately, because you're using web sockets. Take tons of data. And then it can now plot graphs like this. Using SVG, what it does is that it's taking distances at every angle, starting from zero degrees, which is over there, up to 90 degrees in front and then 180 degrees over here and then detecting objects and then marking the distance of those objects as seen from the sensor on that radial plot, right? But obviously it's not fun enough until it's real time, right? We are all in order, so it has to be real time. Thanks, this is literally just two days ago that I built this because, you know, building hardware is actually very, very hard. It will fail in ways you did not know before. And if it fails, it's not like software where you can just download something or walk to the shop, right? It's also expensive, you know, it's not like software. So my next step, obviously, which I have not been able to achieve and I don't know because obviously the surface is not seeming to work. I don't know if I'll be able to demo it. But my next step was to get it to start thinking for itself and figure out from these kind of plots where it can now proceed on this map in front of it, right? So avoid collisions and get to some goal in the distance automatically without me controlling it. So that's where I went on to create that plot at the top right, which is essentially the same thing but represented as a horizontal plot. And just to make sense of this, let me move this a little closer here. Do a sweep again. So what it's trying to do now is like detect the edges of where it can go to and it has found that on top, right in front, obviously it cannot move because there is a dip there in the curve. And so it creates this Boolean graph which is a state of zero or one. One's representing where it can go and zero's representing where it can't go. And it should then probably take a turn and go in that direction. So again, I don't expect this to work but if I ask it to move forward 90 degrees, it goes, it moved a little bit and stopped. Let's try this one more time. It's likely to fail but let's just try it one more time. That's a horrible interface that I would have to wait for the sweep every time. And can we switch to, yeah. So if you see the Boolean graph is actually all flat. It's all one. That means that it can move anywhere now. And let's see if that works. It's, I have asked it to go about 70 to 80% of the distance to that box and stop. Though it doesn't look like it's working. Yeah, not working. Something wrong with the surface. I guess if we can catch up later outside, maybe I can show this off to you over there. We'll switch back to the laptop. I think that's all I have. Well, there you go, that's all I've got. Thank you. Looking for contributors and stuff. So if you are playing with the Raspberry Pi and you want to get your hands dirty with Node, give it a spin and maybe we can build cool stuff together. It'll be good fun. Thanks. Any questions? Let me know. This is definitely overkill for hardware. The question was how much did the whole thing cost you? The Raspberry Pi, if you talk to a real enthusiast about hardware, he'll probably tell you this could be built in maybe two, 300 bucks. Whereas I have spent close to 10K. So it's definitely overkill. Yes, that is including failures. And to some extent including spares. Yeah, so you can imagine I had to buy a soldering iron and then I had to buy like soldered metal and there was a lot of stuff that had to be bought because I just didn't have it. So yeah, it's pretty expensive. Go ahead. So what are the problems that you had when you were building this? The things that software developers wouldn't consider when they start off doing a hardware project. First of all, software side of things was as far as interfacing with the hardware goes was surprisingly simple. I did not know it's gonna be this simple. It's amazing how Linux makes these pins available as a virtual file system. And then you basically echo a one or a zero to a particular file and that sets the file high or low. Essentially that's what Pi GPIO is doing if you look at the source code is essentially it's writing files. And Linux then internally translates that to actually turning pins high or low. That was very simple. I guess Chris Williams has done the dirty work of how to talk over USB. And once I just had to figure out how to use his library which is actually very simple. And once I did that, talking to the Arduino as well was very simple. Programming the Arduino even though I'm not familiar with the language turned out to be actually very simple as well. So the software side of things was not hard. The logical side of things was actually pretty crazy. Freakin' trigonometry and calculus like I stopped doing that 10 years ago, man. I did not know, like radial geometry and polar coordinates, that is where I spent a lot of my time. Like cos theta and sin theta, arc tangent inverse and that was not fun. But that turned out to be more complex than I thought. And yeah, that's about it. And hardware of course, for the first time since in 10 years I justified my electrical engineering degree I guess. I have not done that so far. But yeah, I managed to do that. Oh my God, I did, yeah. Any plans to hook up a USB webcam and open CV and make it follow you around? What do you want to do with this? It can be the mini rakish following you around. Or any plans to put lasers on it? Lasers. So there is totally, in fact the Raspberry Pi has got and they have not made this available yet but it's got slots for connecting cameras to it directly. So you can now get data into the Raspberry Pi via camera or you could probably get a cheap USB camera or something and connect that up. So it's entirely possible to do that. And are open CV ports available for ARM processors? I don't know if that has anything to do with ARM processor, does it? Yeah, open CV has to be compiled to a processor. Oh, you mean, oh, like that. I thought you were talking about hardware ports. No, so there are surprisingly large amount of code that's available for ARM already. I was surprised myself. Because I had seen no open CV module, so it can probably be really easy to hook up, face detection and stuff like that. Yeah, that would be neat. And then it can follow you around. What kind of a load can this Raspberry Pi take like in the processing power and all? Oh, I don't have the exact hardware specs with me right off right now but I think it's somewhere around 700 megahertz processor and it's a 512 MB RAM. So it's not super powerful, but it's awesome. It's an ARM processor, yes. Sorry? You can overclock it to up to 900, you void warranty, stuff like that, but is it? That's neat, 1.1, that's crazy, man. And if you want to have a real-time sweeping and dictating an object, like when it is moving, is it possible? To some extent Linux itself fails at real-time, right? Because Linux is not a real-time operating system. So there's only a certain threshold to which you can go real-time. You are not absolutely millisecond, microsecond real-time on Linux. But still the processing power, will it be able to manage? No, the nature of Linux itself will not let it manage, let alone processing power. I mean, processing power is already very good, but the nature of Linux and the fact that it is switching tasks and running so many processes will not allow you to do very real-time stuff. So the OS itself has a limit. Near real-time is as close as you can get. Any other questions? All right, if there are no questions, I'm gonna give this a shot once again outside because I want to not look so bad. So maybe it's the surface, I'm still betting that it's the surface. So if you can catch me outside, maybe we'll take this out for a spin, all right? See you, thanks.