 I get I'm real quiet I blend in yeah so this is a waffle bot and it's kind of a lot to carry around the country actually the globe so I I came up with this project about a year ago I'll get into that first I'm sorry many of you don't know me my name is Jonan I'm from Portland Oregon and I go by the Jonan show on the internet so you can find me on Twitter and GitHub probably not worth your time in either case I don't tweet very often in the code is my first Rails app is up there you can find it I deployed it to Heroku back in 2011 maybe 2012 and it was called warm warrior which was kind of a creepy you know how it like randomly assigns names I really didn't like that one people would get like meadow ninja and stuff and I got warm warrior so I work with that company now and I worked there because I love their product and I always have I came through a bootcamp when I was back then in like 2011 I was working for a small company in Bend Oregon and I was doing like PSD chopping when we would make IE 6 compatible CSS so that we could put the the images pixel perfect we would overlay a JPEG on top of the web page and then line up our little divs nudging them a pixel at a time the web is much better place now and we had the biggest party when we sons at IE 6 support at that company so I've always wanted to work at Heroku and now I do and I'm a developer advocate and that's like if you are an engineer now or a developer now and you sometimes think like I wish I had more meetings and more marketing buzzwords in my life then you should probably become a developer advocate it's a really good time that being said this was mostly financed by Heroku so that's a pretty good deal that I built a waffle making robot or not waffle making it remains to be seen so this is the waffle maker that I used it's made by Cuisinart it has a Christmas tree because I got it for Christmas last year from my children and the day after Christmas I was standing there in the kitchen I mean like waffles take kind of a long time like seven or eight minutes of peace and you get one out and then it's immediately gone because the kids are just like round robin you know coming back from you're like 15 waffles deep and you're like I am a robot oh wait I have an idea because I was holding this little handle in the end and I thought well this is a pretty simple motion right so this you just flip over it's one of those waffle makers you you lift the lid up you close it and you flip it over right it's like well those are things pretty easily replicated by motors I could probably take this project out in a cool month is right so this is when I started February 3rd I put a date on this slide only this is basically just like a photo tour of my life with waffle bot you're not going to see very much code if any except when I actually like get into the console and try and make it make a waffle for but I started out with this raspberry pie here this is a touch display with a raspberry pie in the back of it and then underneath it I have a whole box full of electronics with some circuits that I wired up also I don't know very much about electronics this was a huge learning experience for me and a real painful one on the left side you can see these servos here those servos this is like death row of servos right here they didn't know it at the time but they were doomed all of the servos I killed a lot of servos this is where I got a lot of my supplies it's around the corner for me and I just wanted to show you what this place looks like because it's so cool this is a place called surplus gizmos in Beaverton Oregon and they have a Burger King sign up in the back they basically go in like desoldered components off of boards they buy like bulk industrial equipment huge like manufacturing conveyors and things and they have them all disassembled it in this place but you can get a stepper motor that could flip over a car in this place it's incredible unfortunately they know it and they're a little bit spendy sometimes I mean like there's a circuit board for a dollar I feel like you can buy 20 of those for a dollar in any case it's worth it when you don't even have time for Amazon shipping because you are repeatedly flying around the country trying to give this talk and every single time three out of four times so far the Waffle Bot has been destroyed in transit to a point that I could not save the day yesterday Waffle Bot was also destroyed in transit shocking but true I have a good trick for that by the way so I carry this in two different Pelican cases and you can put locks on the Pelican cases but they've got to be TSA safe locks except in the United States there is a firearm law if you carry a firearm on an airplane including a flare gun that is unloaded then you can have it inspected when you check your baggage and lock it with real locks and they're not allowed to open it and rearrange all of your Waffle Bot packing with your carefully arranged foam and and then just pile it back in I've got some pictures of that too so this is my waffle maker from underneath this is when I first started getting into like the wiring of the thing so my theory was I want to twist this thing right but I also need to be able to lift it so I couldn't very well attach an axle to the front of this thing right because then I'm gonna have to make that this I have a motor on the front of it and it's twisting like this that whole assembly is gonna have to go up with the waffle maker at some point right and so I thought well I'll just come in through the back here and I'll put it through there's like a little axle on the back right and you can come and check it out afterwards but it's like a little plastic piece that looks kind of like this right and I thought I would just run a metal axle through here and kind of melt it in place and I'd be able to twist the whole thing right but this is when I opened it up and I discovered that that wiring harness there that on the back that's all of the control and heating wiring going into the waffle maker through the narrow hole that I intended to drill straight out so that plan didn't work out I came up with some other plans this is the first iteration of waffle bot it was much taller in fact exactly half an inch too big for a Pelican case that was poor planning on my part I have this aluminum frame here because my theory was if I can't move the whole mechanism up I can set the lid on the the twisty bit right so I have a little metal hook on the bottom like this and it's quite wide it fits it has to fit very tightly in the handle so when the handle comes down I can then twist that right and the handle will come with me if you look real closely I wish I had a better picture for you but on the tip of the motor there there's like some rivets going on and a set screw and maybe a chunk of wood yeah that's like me coupling an axle this is apparently an impossible task they make couplers for 10 millimeter shafts to 12 millimeter shafts or 14 millimeter shafts but not for this kind of thing like couplers are pretty inflexible if you are a coupler manufacturer I would like to have some words with you afterwards it's very difficult to take two shafts and put them together on center my solution was to take a piece of wood and drill it straight through and then drill back and widen the hole on the other side so I could attach my bit and in the end it was still off right so you have kind of this motion right in addition to the fact that this cusp here is such a tight fit so the lid has to land perfectly on it and then it kind of twists at a wonky angle and kicks itself off or pins itself and tries to snap the arm off of the waffle maker on the right I just wanted to like have a moment of silence for my happy hacker keyboard which only functioned because I had these little adapter here it was like an old old one right what is that interface called ps2 interface it was a ps2 adapter so I could use it over USB and it died that day with all of my dreams so this is another close up there you can also see that I've got this because the angle of this hook was so important I had to line the shaft up exactly with the waffle maker this is a very flexible piece here right it kind of bends around and snakes and I can lift it up I can slide the motor mount back and forth across that if you're trying to build things that require a large amount of torque try not to make them super flexible that was another poor design choice that I made in this one you can see I've got one motor controller hanging off the side to power my one motor but then I have another one up on the top that you can kind of see in the corner there and that one is got it has a bit of paracord tied down onto the handle so the paracord was looped around the front of the handle here and it would pull it up and then that loop would allow the handle to still rotate right I thought I was very clever but I was also super imprecise and the whole point of using a stepper motor as opposed to a regular motor a lot of these things that I'm going to talk about like I'm going to explain to you diodes and things if it's boring to you I understand if you want to get up and walk out many of you know a lot about electronics but some people don't know like what an npn transistor actually does or how to use it like me six months ago for example so this is the the shaft assembly that I had going for me that never really worked properly I got maybe one out of ten turns I could flip the thing over and so I was like well you know what I could do I just take some of these servos here I'll put a servo right on the front of that and then I can just like strap it to the sides with aluminum and you know servos they my impression of like the purpose of a servo was that it would just not do a full rotation right it was it was handy because you could go this way and you could have like very precise control over them much like a stepper motor but you didn't have to keep going around and spinning right and so I ordered some expensive high torque servos a high torque servo is designed to like flap a large model airplane wing instead of a small model airplane wing they are not designed for the kind of torque that I'm generating just in twisting this handle and it's amazing to me that I was standing there the day after Christmas thinking how very simple this problem is I think that this is a common thing among developers we look at a thing you're like I could probably do that I think I can do it and then you get excited and you're like this is going to be easy and then a year later you have a broken waffle maker on stage in front of all of these people you admire so this is similar to one of the five servos that were about 40 bucks a piece that I murdered in the process of learning what torque was I was trying to show you something specific here that I don't recall so I'm not going to oh yes so in the background there behind the screen that big white thing that's a Costco milk jug those square ones it was perfect because it fit directly between those aluminum rails that I have the brass bits on this frame by the way that alone probably took me like 20 25 hours to fashion this whole thing with the rivets I forget sometimes how lucky we are to work in software and just have that like control Z thing because when you rivet a piece of aluminum like that one's just ruined and now you've got to cut another piece exactly like to the millimeter and shave it down and don't get a half inch too big or one foot in your pelican case so that milk jug in the back was going to be a gravity feed you can see hanging down in the middle a little brass part that's this so this bit right here is a solenoid valve it's a valve that opens when powered and locks when it's unpowered right so if you want to get the solenoid on the side of this deal to open up like if I have to put the power in there to do it but I'll show you in a little bit maybe that this will work so the solenoid valve is in line with the pump here and then on the bottom of the milk jug I have a silicone a flow meter underneath it so my theory was that I would have these three brass pieces screwed together and I would put the batter in the milk jug and maybe I have to fill it all the way to the top but I get a lot of gravity going for me and now it does not push waffle batter through a hole that big things like a half inch diameter on these pipes and when it's going through a solenoid valve and then through a fan it didn't move at all like I I had this frame that I spent 30 hours building and I've got another hundred hours into the robot already and I go to do the whole thing and the part that I was least worried about screwed me over and I feel like there's another analogy to software there because that's pretty much every project actually I've ever been on like the part that we assume was known was the longest and most difficult so this took me some more time to do this is a new version this is like the new frame as I was like taking over the kitchen I have another shot later of more taking over of the house I actually have my own office with like a wraparound desk around the walls but that was already full so I took over the countertop here because usually it was a situation where like I started this project as a hack day project at Heroku and we have a hack day once a year where you just kind of go and do what you want to do right and I was like I'm gonna build a waffle making robot people were like I'm gonna see if I can improve our Kafka efficiency I'm gonna work on the I'm like I'm gonna make a waffle probably so I spent that eight hours on it and I legitimately believed I had a shot of like finishing this in that day's work not even close I mean I probably over the past year pulled ten all-nighters or close to on this one because every single time I was under a deadline I was flying down to San Francisco and this kind of thing to work on requires a huge amount of equipment right if I pull one of these wires too hard and I desoldered it for some little board I'm gonna get a soldering iron in downtown LA with like 30 minutes notice you know I brought my soldering iron with me I brought everything with me I brought 200 pounds of luggage in two pelican cases and I also fit some clothes in there my wife was very pleased to hear that she pointed out that naked people have very little or no influence on society so this is the back of this board here this screen there are a bunch of GPIO pins on the back of this generic programming input output is that right general programming these pins there are 40 of these pins on most raspberry pies the original ones had 30 on them and this is basically how you do everything you're gonna do with a raspberry pie when you're building a robot or a waffle maker whatever it is you're gonna call right I have 18 minutes left and I need to pause because taking it takes about 10 minutes to make a waffle if we're gonna actually make one but this the problem that I ran into here was that I needed all of these GPIO pins for all of the various devices right because using these motor drivers that I have here it allows me not to have to drive the stepper motors off of the raspberry pie a stepper motor is a motor that basically like ticks you can think of like ticking around a gear right I can say go to the right 50 steps and it will come back 50 steps and being exactly the same nanometer where it was before and you can cut them down even farther these steppers can take a stepper motor that has say 200 steps and it can do an eighth of a step on each of those steps right so I can go like 1600 steps to get a full rotation out of this and it allows me to be very precise but it also the primary benefit of using these drivers is that I don't have to take up all these pins on the board so this these pins that I'm using here for the display but it turns out if you power the display independently you don't have to use the SPI interface at all so I got to bypass that whole problem and I just ran a little ribbon cable through the side but with the motors a single motor would take up like four slots out of these 40 and it's not like all of the 40 can be used right this is what they look like this is my my GPIO diagram that I've been dragging around the planet with me and I highly recommend if you are working with a Raspberry Pi to just have this by your side and write down what you're plugging in where because it's actually pretty easy to fry your components inadvertently or to feed 12 volts back into a GPIO pin on your Raspberry Pi if you're not paying attention so I have this little diagram here but you can see the green ones here are the ones that we can use for our GPIO stuff like the yellow ones up here those double as as serial transmit and receive ports so you could plug in like a serial port like an old serial port into the let's see it's like the fourth and the fifth one down on the right side GPIO 14 and 15 and the problem with those ones and some of these other ones with the X's is that the Raspberry Pi when it boots up takes some of them high and some of them low and then it flips them and then it goes back and you you're thinking like okay but I went to like the very first place I can get access to the boot up process and I turned that pin off doesn't matter it's all out of your control there's nothing you can do in software to stop some of these pins from shooting high when the Raspberry Pi boots right this was a very surprising thing to me and I'll show you why in a moment so this is my first iteration of soldering a little circuit board and you can come admire my soldering work later it's really not good I have soldered things in the past but also pretty badly and I kept getting advice from people that you heat the element not the iron right this is what everyone tells me it doesn't make any sense to you until you just kind of see it happening I guess but then it took me another two years longer than that so the idea is that if I have my soldering iron approaching from this side then I'm holding my solder over here in order to start my soldering my solder melting I'm gonna have to tap the iron a little bit right but then once it's melting I want to mostly be applying heat to the component that I'm trying to solder in place because metals like when you're welding or soldering will flow towards the highest heat right so if you have a very hot little copper pin here and a you know slightly cooler soldering iron because it's just a little bit farther away the solder will glom onto the pan and you get these nice beautiful little solder holes unlike this nonsense please come and admire my tomfoolery later so this circuit board was the cause of two of my problems basically because these soldering bits on the bottom were weak and in many cases I have soldered jumper wires into the board itself this is not the way you should build these things right much like software your components in a system like this should be modular right I want to have reusable pieces all over the place I want a circuit that does one thing not everything right at the time I was in San Francisco and I had only brought one circuit board and my only option was to drive down to Silicon Valley and buy more so I just soldered and soldered and soldered and made this mess it was real bad but you know you'd lose one connection and that's five hours work when you find it and then you have to plug it back in again so this is me taking over the living room the previous mess you saw on the kitchen there this is the living room that is like a Thanksgiving table about this size that takes up good solid half of the living room I did I did that and then I put my waffle bot in my Pelican case and I left and my wife and kids enjoyed that mess I'm a real bad person but it's for your entertainment there's another nice piece of work that I did so again the circuit board thing you're gonna want to use those the nice thing about a board like this is it's got these little metal rings around the holes right that metal when it heats up will also attract the solder and the solder will stick to it if you were just soldering two pieces of metal together they are never going to be hot at the same time and you're going to have a blob of solder over here and a blob of solder over here and even worse there is a resin core in your solder that will sometimes coat your blob of solder on this side and so then you put your other blob of solder together and it sticks you did it success but there's a layer of resin underneath and you don't have conductivity and if you forget to check all of your connections which you should absolutely do as you're going along with your multimeter there are only two things you really need to know with a multimeter it's like continuity testing be able to put probe to this wire touch probe of this wire see the electricity go back and forth and the voltage measurements right so this is the control box that you see reworked here this is the TSA's handiwork I was in Chicago I think and they had opened my case to inspect it and then couldn't close it again and so they just went with this plan it was pretty good also reminds me of software this here is the side of my suitcase that was just under a plane and over conveyor belts and had lots of tiny electronic components in it and I don't even know what I lost if I lost anything and then this waffle maker right here on the back got a crack and I was crushed this was the third breaking of the waffle maker the third time that this was destroyed this is the one I got from Christmas for my kids and I wrecked it the other day I was standing in the kitchen with my waffle bot trying to get it to work I'll show you the waffle we made in a second if my son goes remember when we just used to make waffles I'm such a bad father for this I blame you so this is a Geiger counter I think if you read the abstract which was all lies by the way you heard something about a Geiger counter the Geiger counter is actually really cool instrument you order this kit from Adafruit I think I got this one from you can assemble it all yourself and that's in the plastic wrap there is the Geiger tube they're really really fragile if you ever happen to get a Geiger counter they're kind of fun to play with be very delicate with the tube that's the most expensive part it's got a it's a gas filled cylinder with a tungsten thread in the middle and it detects radiation when particles hit and I the gas inside I have a this here so you see like a radioactive particle this one that I use just has beta particles I think it only detects beta particles which conveniently what carbon 14 gives off so carbon 14 is naturally radio it's a radioactive isotope of carbon and all carbon exists in a combination of its isotopes and all food contains carbon therefore you are eating radioactive food every day and the next time someone wants to talk about Fukushima power plants you can be like shut up dude you just ate a banana that's like 10x right which is true actually bananas have a lot of radiation in them but they're not dangerous for you you're being irradiated right now and you look fine to me so this little particle comes in here splits the electron from the ion the electron flees towards the center coil and along the way builds up more electrons and they strike it very quickly but then the electricity is released through this anode here and we're done so like a Geiger counter makes that little that's all the electrons just hitting a little bit so my Geiger counter had a pretty serious flaw in that the serial port output doesn't work on the one that I bought there are hundred dollars by the way there's like one little four pin interface you can use to plug into a thing and actually get data out of it aside from just like the ticks so the theory was that I was going to measure the radioactivity of the waffles and use it as an additional vector for improving the quality of the waffles over time artificially intelligent waffle maker all right these words are terrible don't use them they don't have little metal rings and they're really hard to solder on it's bad I was showing you the diodes here this is like a little one-way flow thing given that I have eight minutes left I'm gonna stop talking and I'm gonna show you a robot maybe work and then we'll keep talking while the robot maybe cooks is this it's gonna need to warm up too so I'm gonna make some waffle mix right now I want to find a more interesting slide to show you oh this is my new improved circuitry look at me right I'm the best so I took all that nonsense out and I built these things because it was way better is my power thing in the middle so I've got all those little rails to put power plugs on and then the four corners that I can plug loose wires into the one next to it if you look on the bottom there's got three transistors on it those are tip 120 npn transistors npn stands for negative positive negative so on the bottom of the transistor you have three little legs like this the collector of the base and the emitter and we are aiming to add electricity to the collector we have the the plus going into the base right and then you you increase the current on the collector and that opens a connection between the base and the emitter so in a what I would do is I would connect the the negative wire to the emitter and negative wire to the collector and then a positive in the middle and when I apply a charge that will pass on more electricity than I would otherwise want to handle so I'm using these because I'm using 12 volts on these motor drivers and the 12 volt motor drivers I don't want that passing through my pie right so I have it going through these transistors the pie lifts up the collector to three volts and that turns on the 12 volts to fly through the other thing feel like this point I'm just like the most boring part of this presentation because you guys are about to see it not do its thing internally the code here is unfortunately very simple at this point so initially there were like three or four distinct raspberry pies strapped to this yes and the the point was that I wanted to learn about how to use Kafka has anyone used Kafka yeah you kind of have to manufacture use cases to come up with a reason to play with Kafka like unless you work at Twitter or New Relic you really don't have a good reason to be like I'm gonna casually add Kafka to this application and I made a poor choice I think it's safe to say I don't understand why but somehow I've backed up a huge number of events in my Kafka topics and so I every time I power on the or I like start the code it immediately consumes like 50 events and then one of those actually like causes it to start making a waffle and fortunately blocks but I think it's on like an infinite waffle loop and I can't stop it so I give up but I did get it to do something vaguely resembling waffle making the other day like kids oh wait now this was before that happened yeah that's when I sprayed water all over my electronics I spent hours and hours don't do that don't do that it's a bad choice just like don't do food you hear the beeping it's pretty exciting I actually have a trigger wired up to that piezo buzzer on the bottom here so this puts out like six or seven volts to my Raspberry Pi that will tell me when I need to flip the waffle but of course I don't care about what the button thinks I care what my artificial intelligence thinks my TensorFlow thinks about how long I should cook the waffle right I want TensorFlow to decide that how to best improve your waffle making experience so in the end my goal was to have a waffle bot UI here you'd walk up and you would click a button and it would say make me a waffle and then it would produce a waffle ten minutes later and you'd be invited to rate your waffle experience but that didn't come to fruition speaking of need to detach this real fast so I can oil the waffle iron without burning myself very very badly so the other Raspberry Pi is what those were doing was they were giving me more GPI GPI opens so then I can add more sensors because I have like a nine axis orientation sensor that detects like velocity of the waffle maker as it goes up which I think we can all agree is the most important part right the orientation of this is actually super valuable to me to know when the lid is all the way up or all the way down because the actuator here is not designed to run on this particular device I'm running it on so it's a pulse which pulse with modulation device the way you get those little gears in a stepper motor to turn is by anyone ever used Pam before here we go all right and try not to get any on the electronics seems pretty Pammy okay so it applies a pulse and then drops it and then applies it and drops it very quickly right we're going like five zero five zero five zero five zero five zero like a thousandth of a second apart right you determine based on and so what this actuator wants to do is it wants to just go all the way like you give it power it runs until it can't run anymore and it hits on shot off switch then you flip the polarity and you run it backwards and there is a way to assemble a little circuit called an H bridge out of transistors that does that thing automatically for you where you can apply a current to one of those transistors and flip the polarity of your circuit one way but you can imagine that like flipping the polarity in a circuit that you've designed is a pretty dangerous thing if you don't know what you're doing and I very clearly do not know what I'm doing so I chose not to go with that and I just hooked it up to this and then kind of like fiddled with the numbers until it worked but one of the downsides of this is that sometimes the driver says hey actuator you should lift the lid and the actuator is like nah and then the batter arm comes over and puts the water in the batter on top of the waffle and down over the electronics and then the lid comes up and breaks off of the arm it's been a real treat building this really enjoyed myself so let's see if I can actually make it go don't see I have my little green lights okay so basically like my my goal here was to have this this web UI and I broke it but I could start up my little rails up here and I've got a oh good that's not what I wanted I don't think but it didn't do anything ah you know why it didn't do anything it didn't do anything because I haven't gone into the actual pie and started the the code in there so I have a problem in that the Ruby script that I'm using needs to have root so we can effectively shut down the Raspberry Pi you don't want to just unplug power from a Raspberry Pi it'll corrupt your cards and if you're traveling around the conferences and planning on having those cards at the ready that's a real bad plan so I have this shut down thing that requires pseudo and that's not very good for my team so now if I can SSH into my waffle bot because we are hopefully on the same network still my password is password verify me unable to open display don't care and I'm here and I'm in strupe waffle who's to his strupe waffle and I'm going to herb and require that guy let's see so this also because all of this code lived on separate pies it ended up being one pile of code the strupe waffle thing I think what I'm trying to do is to make a waffle chef and I think just the act of making it will make it read from Kafka oh my god okay wait I'm just gonna fix the arm this doesn't count as cheating because I didn't put it right the first place okay come on baby just one time make a waffle just one waffle is all I want please okay and now it's got like all these sleeps in there right because I really don't want this arm to swing over and smash anything this thing is about the pump oh no but it's not going to pump because I didn't prime it I have to prime the pump by sucking on it to get the batter through the pump that was our dispensing of the waffle enjoy no one's actually gonna get to eat a diseased waffle now see the actuator kind of hesitates for a second it's like I don't know if I'm gonna do it okay I love but how bad is it then if my other component tries to turn the thing while it's open right and hot it's broken shards of metal you really have to come check out this gear on the back I manufactured a cog to fit around here for this little belt out of PVC pipe that I shaved in like millimeter thickness so that I could attach a belt to turn the thing and then I bonded the inside of that PVC pipe to make it a gear that fit the weird shaped axle thing that's on the back of this that I couldn't otherwise attach to so now we've got a nice long time sitting there and I'm out of time actually so I'm not going to talk to you anymore but I'll whip through my last couple of slides with you in seven minutes that's gonna flip back over and it's gonna have a ghost waffle in it and I'm gonna be real freaking proud of myself because I know that it didn't work because I didn't prime the pump but that's a human failure and this is the first time in 200 hours and an entire year of my life that the robot has come even close to making a waffle thank you so much this was a waffle that I got that doesn't count because I had to manually run the methods to make it come out that's what it looked like my kids ate it they said it was okay this is me coming down here this is the inside of my hotel room last night when I realized that my raspberry pies were not going to be able to communicate all over the Wi-Fi at the same time all five or six of them that I had strapped to this thing we're probably gonna be able to talk to each other so that was pretty bad time and then it got worse and then it got worse and this is I think about 3 a.m. you can see on the right side where I've hung a bathrobe over the painting so I can project the console from one of my raspberry pies onto it because the TV is in hotel mode which you can't get out of and they won't let you switch inputs I actually I've gotten really good at slipping my hand behind the television and identifying an HDMI port by feel so I had my cable in there but you can't change the input here's a picture of my feet and things out for you nicely that was 7 a.m. thank you very much it's been a pleasure