 Hello, thank you everybody for coming. My name is Joe Grand, also known as Kingpin, and it's an honor to be here in Beijing and present to you the first electronic badge for DEF CON China. Like Dark Tangent just mentioned, badges have always had a special place in the DEF CON community, so it's really an honor to come here and talk about the development process and show you why we feel so strongly and why we think that electronic badges are so cool and why they're going to continue to be a part of the hacker culture. So here are some of the early electronic badges, and this is something like when we first released an electronic badge at DEF CON 14, we didn't know what people would think. Nobody had really tinkered around with electronics, and we wanted to give them a platform that they could learn electronics and kind of something that would make it easy enough for them to get excited about it. And over the years, things got more complex, more interesting games and things that people could do with them, and that's what we're trying to sort of spark over here as well, is we have more of an entry-level badge, if you will, and I'll talk about some of the process and the functionality of it. But over time, things might get more complex as more and more people start hacking on hardware, so it really is very fun. And being an electronics designer, this has always been an area for me that has just been fascinating of having something in your mind and then being able to turn it into a physical thing that people can use. So the goals of designing the badge for DEF CON China really was to bring the community together and then let you walk around, and as you experience DEF CON, you sort of get rewarded for that. And I'll show you a demonstration of it a little bit later, but just really quickly, if you look on your badge and if you put the battery in, you might notice that there's nothing lit up or anything, but if you turn it over, there's a little flexible connector on the side, not the USB connector, but on the other side, that's what you use to plug in as you complete different tasks around the event and different lights will light up on your badge. And the goal is to complete them all. And by doing that, you would have tried out a lot of different things at DEF CON. So a little bit of a game to get everybody together and build this community and sharing information about, oh, how did you turn that light on? How did you turn that light on? And sharing information. So I thought it'd be fun to show some of the early concepts because when you're designing anything, even if it's a piece of software or a piece of hardware, you always start off with some concepts and some scribbles and notes and over time, things change and things get refined. So when the dark tangent and I were talking about, what can we do for DEF CON China? I really wanted to try this flexible circuitry. I'd never used that before. We wanted to have this tree of life that kind of symbolize this growth as you experience DEF CON. And in theory, it sounded really simple. In practice, as you'll see, it was a very complicated process, but we still wanted to make it up here very simple. So we had some kind of sketches and inspiration that we started with. Some other pictures as well. A lot of times with the development processes, you would start prototyping. So build up a little bit of electronics to make sure things work before you go to an actual production type of device. So we have some hand-built electronics. Of course, that's not all of it because if you look at the electronics on the back here, there's a little more functionality going on there. Some early paper sketches and some debugging of things. And then we finally come to a point once we refine it enough to the real design. And this platform for this badge, we originally and intentionally created as this reusable platform that you can use after the conference as well. And that's something that's also really important. It's sort of this electronics reuse and being able to take something and modify it after the fact. So we can use it at the conference and then we can go home and we can write some extra code for it or we can cut it apart and add our own electronics to it. And that's what we really wanted is something that you can take afterwards and build on. And we hope that if you do that, you can share with the community what you've done. So here's our block diagram where this whole platform is based on an Arduino platform which is a general purpose kind of microcontroller based platform that started in this educational environment that is now kind of taken over the hobbyist electronics world. And a lot of people might say, oh, if you're familiar with Arduino, Arduino is to beginner, it's to basic. But that was our point is to have a platform that's custom. But again, we'll let you write code with this developed environment already. So it makes it way easier to get involved in hardware hacking because a lot of that work has already done that base level development work. So in Arduino is based on an at mail part. This one is the AT Mega 328P, just a general purpose microcontroller that's running the Arduino bootloader which will then have Arduino software on it. We have a USB interface. And again, I'll talk a little bit more about functionality. We have an accelerometer. So if you do have lights on yours and then if you stand still and don't move then the lights will turn off to save battery power. I'll talk a little bit more about that later on. Our edge connector which is gonna plug into things our LED driver because we have 32 LEDs on here. And we only have a single three volt battery. So we had to do some tricks to be able to enable all the LEDs at the same time. And then just some power supply circuitry as well. So it really is this kind of simple platform that you can build on. And here's the, here's a picture of it. So kind of go left to right. We have our USB connection on one side, our power with the battery. There's also a reset button. So if you end up loading new software onto this thing new firmware, you can reset it manually if you need to. Our LED driver, our accelerometer, the microcontroller and then the connector at the end. Building a flexible circuit is like the Dark Tangent mentioned, something that nobody has done in the hacker community before. And we see flexible circuitry in printers and in all sorts of consumer devices and phones to wrap around inside of the devices. And I'd always just been fascinated with like how small can we build something? How flexible, how thin? And this was a real challenge for us because every single board I've done for my entire life has been a rigid circuit board, like a normal circuit board you would see in most products. So there was a big learning curve of the different processes that are required for flex that are sort of similar, but not exactly than rigid. So it's a little bit, you know, it's a little bit tricky. The most important thing is the flex connector on the side, the flexible printed circuit connector has a very specific thickness requirement because the connector that we use requires a certain thickness. If we hadn't gotten that right, nothing would have worked in the entire conference. So that was a really important thing. And it's down to, you know, micrometers, like very, very, very thin, precise thickness. And also the, we needed help with this. I think that's something also in the hacker community we're all here to learn, right? We're all here to try something new and to question what's out there. So to take this step of doing flex, I couldn't learn it on my own. I needed help from other people. And luckily I found some people local to my area in Portland, Oregon, and also some other folks in the United States and then in China to help teach me how I need to do all the manufacturing. So adept electronics, electronic interconnect. These are people that, you know, behind the scenes a lot goes on, but the badge wouldn't have happened without all the support from other people helping me out. So they definitely deserve a thanks for that. So the edge connector is sort of a hackable interface as well. So it's meant to plug in, which I'll show you the demonstration of, but there's a bunch of other connections on there. So if you are familiar with hardware already, or if you are learning and you say, I want to add some extra functionality or I want to sniff some communication that's happening, say between the microcontroller and the accelerometer, or I want to add on different types of hardware to it, you can do that through this edge connector. And that's kind of cool. And it bends, of course. This was something, you know, we didn't know how much it would bend, but again, it was just something fun to try. So from a software perspective, a firmware perspective, we're using the Arduino. For this particular microcontroller, we end up using about 90% of the available memory. And a lot of this work wouldn't have happened without some of the third party libraries that are available. And that's another reason to use the Arduino platform for this, because Adafruit had already created accelerometer libraries and other people had created low power libraries. So I could kind of cobble this thing together and hack the firmware together to do the functionality that we wanted without having to build everything from scratch. And that's a really important part of the open source community and of course the hacker community as well of sharing. And this badge, the code that I wrote is available on my website now and it's going back into the community. So then people can use that to build upon. The functionality is really kind of simple. We have a loop and the system's constantly looping. It's going to first check the state. It's going to say, am I plugged into a computer? Or am I plugged into a USB charger? Or am I plugged in just with a battery? And it will kind of switch functionality depending because if we're on battery power, we want to save battery so it will go to sleep after 10 seconds of inactivity. But if you're connected to a computer trying to load code into it, you don't want it to go to sleep. And then you can add another functionality if you want. Say if you plug it into a charger instead. So there's all these options. Once it checks the state, then it goes to look for what I call the interactive mode. And that's if you plug in a computer to the micro USB port and set up your terminal program settings properly, this will appear as a virtual comport and it should come up and say Defcon China badge or something like that. You'll figure that part out. There's a menuing system and you can do all sorts of neat things like diagnostics and kind of play around with the badge. That's the interactive mode. So it checks if anybody's connected looking for bytes on that interface. Then it's gonna look for connection from the FPC connection, the finger connection on one side. Then it updates the LEDs. It says have any new LEDs been enabled? If so, let's turn them on. And then it goes to sleep. It just does that over and over and over again. I thought it'd be fun to show some pictures of the fabrication. This factory was based somewhere down in Southern China and super helpful for us to manufacture these boards. The timeline for this project was actually pretty small. We've known about Defcon China for a long time but building it, testing it, refining it, all takes time. So these boards ended up being built in two weeks, all 3,300 of them and they were shipped directly here just a few days ago. And I had the factory take some pictures of the process because it's really fascinating to see how things actually are built. So some of the fabrication pictures I have here, I will post a version of the slides on my website and there's a link at the end to that which will have some assembly pictures as well. We just didn't have time to add them in beforehand. So here like the circuit boards are being made, the different layers, here they're putting the white solder mask on which is the coating that protects the electronics or protects the copper traces on the board. And it's a very manual process to do this because these techniques require really, really good precision. You can see the boards actually get manufactured in a panel. So there is four per panel and each one has to go through these different steps. So the middle one here is the silkscreen and then the picture on the right is what it looks like after the silkscreen where the ink is pressed through. Once the hardware is actually built, we need a way to program the code into them, test them before they end up around your next to make sure that they actually do what they say they're gonna do because we don't want a bunch of people walking around with a dead badge. So there's a little bit of a process that we had to do for that as well. And what we did is created little programming stations with a Raspberry Pi, little Linux based module and that has USB support. So what this does is we'll configure the USB chip that's on here. It's an FT-232 USB to serial adapter. It will configure that. Then it will load the Arduino code into it and then the LEDs will all turn on to indicate that to make sure all the LEDs are good and then all the LEDs turn off. It also checks the state of the accelerometer. So if the accelerometer doesn't work, say during the assembly process there's a problem which there actually were with a few of them and the factory had to refine their process a little bit then the lights would blink on power-ups. You would know, oh, the accelerometer is not working. So a little bit of a test procedure for that and that's why you'll notice when you plug in your battery all the lights turn on and then they turn off. That's so you can make sure all the LEDs are there. In case you're curious in the numbers of the different badges that are out here, different types, different colors to denote the different people. This is always something that we've done at DEFCON and it makes it fun also if you're trying to collect badges, like how can you trade with people? What can you do after the conference to build up your collection? Some of the problems we had, no development ever goes perfectly. That would be amazing if everything worked the first time. We ended up making two revisions of the board before we went to production because we really wanted to make sure that everything was gonna work. And not working with flex circuitry before, usually what happened is you get your board back. If there's a problem, you can modify the circuit board. You can cut traces, you can solder components on, but with a flexible substrate, it's so thin that if you're trying to cut one trace on the board, you cut straight through the rest of it. So a really tricky kind of surgery that I had to do to get things working. And I only had two prototypes to work with. So it was a little bit nerve-wracking to get that working and luckily there was only a few changes that had to be done. The other thing too with flex is flex, flexes, which leads to mechanical stress if the board isn't designed right. That was a lesson that I learned early on and really scared me because the first little version you can see over here, the USB connector is kind of sticking out and there's no support along the sides. So when I plugged in the USB connector over and over again, it would kind of flex on the board and then the board would stop working. And I'd go and like, oh, this is bad, not good. And so I worked with Neil, one of the DEFCON artists to refine the shape of the board to give the USB connector more stability so it wouldn't flex and that saved us. But this is stuff that was just challenges that we had to deal with. It's all sort of a blur too. It's funny because I look at these slides, I'm like, wow, that was, I don't even remember that. Like, this is such a crazy project. The timeframe for this again was like really tricky. So battery life is always a question, right? Is the battery gonna work? I always like to design badges and projects that are very simple and use as minimal amount of functionality as necessary. With a project like this, I wanted to try to stick with a coin cell. All of my other badges have used the CR2032 coin cells and it's something that is very tricky because when you have electronics running, you have LEDs, you have a lot of power consumption, you have to do all these tricks to make sure that your battery is gonna last the length of DEFCON. For this particular badge, I've done some calculations and I think it's, if we have the active state for 24 hours the battery will last and by active I mean displaying LEDs because normally it's gonna be sleeping for the most part. So we should be able to get through the conference. We'll see what happens over time and that's part of the fun, right? When we get these things out into the world when they're actually being used, what's gonna happen, what are people gonna do? But it is interesting that a sleep mode for this badge is only four microamps. It's like sipping power, barely doing anything at all and then it wakes up to do its functionality. And here's a little graph also of showing as the system powers up when all the LEDs come on and then it dips and shows some LEDs and then the sleep mode is really far down. So then how do we interact with this badge? What's the whole point besides plugging it in to do things? There's some accessories that we've designed as well. And the first one I've been calling a breakout board. It's a tiny little board that will actually connect to that FPC connector. So then you have easy access to solder to that connector and add things to it. These are going to be in the hardware hacking village. I need to go over there and drop them off. So a bunch will be there. I'm also doing two badge hacking workshops. So whoever has signed up for those will get one. And then you'll probably see some sprinkled around DEF CON. We made a few hundred of them. So there'll be enough for people that are interested in hacking hardware. And this just makes it easy to start doing other things with it. We thought that would be fun. Also, if you're familiar with the SAO add-on, the badge add-ons that people have been doing, making little blinky light things. This breakout board also serves as that SAO connector. So you can plug in different things to it that will hang off the side of your badge. So we just thought that would be fun to do. And then we have the programming shield. This is kind of the other side of the badge. Where if you have the badge, but not the programming shield, it sort of doesn't do as much as we wanted. So these shields have already been handed out to some different villages, different contest areas. There are some other things that you have to find around the event. But the purpose of the shield is you would plug your badge into the shield. There would be some communication and then a specific light would turn on depending on what task you've completed. This was a separate little project that I had to build also to write some code for this thing to make sure that it could communicate properly to the device. We go into more detail of a lot of this in the badge hacking workshop and then I'll post some expanded slides with even more detail of things later on if you're interested in really getting into this stuff. But really just kind of briefly is this device is a shield that plugs into a standard Arduino microprocessor module. And it has a level translator to convert the five volt signals from an Arduino to the three volt signals that we need on our badge. That's an important one. If you're gonna hack on this thing, you wanna make sure that the voltage levels are actually correct. Because if you're sending five volts to a three volt system, you could maybe release the magic smoke of the badge. And this board, if you look on the upper right, there's some dip switches, some switches that we can turn on and off. Those end up setting the state of, do we want to set an LED? Do we want to clear an LED? And there's another state as well, which I'll talk about shortly. Ah, okay, so demonstration time. I'll just show you the process of this and you'll get familiar as you go to the different areas to do this. So here's a, let's see, oh there, you can see me, okay. So here's a shield. I can't see me, so if I'm out of the frame, you tell me. I'm gonna turn it on. Little battery powered system too, because a lot of the villages are outdoors. So we have a little battery power here. And then I'm gonna try to do all of this with holding the microphone also. So here's my badge, which currently I have a few lights on. Kinda hard to see. So I'm gonna take this and plug it in here. Now you normally won't have to do this. Whoever's running the contest or the village will plug it in for you. But you plug it in and you can't see it because it's on my side, but there's a little status light that was orange. I plugged it in, it turned red, and then once the communication was done, it turned green. So now I can just unplug it. It happens really fast. And now another LED is turned on. If you complete a one root, there's four LEDs per root of this tree, then one part of the actual top, the branches of the tree turn on. And the whole concept for us, we thought let's plant a tree and let's grow the tree as we go through DEF CON. So that's the demo portion. So the remaining mode of this shield is something really cool that we said, okay, not only do we wanna have individual people build their own tree, let's see if we can have something for the entire community to plug their badges into and see how the community as a whole has kind of been learning and been building throughout DEF CON. So if you look behind you, there's this giant case, the shipping container back here. That's an art installation made by some very talented artists that is essentially a virtual tree inside of this container. And as you change your state of the badge, as you light up different lights, you can go into this container and virtually grow this larger tree and do some really cool interactivity with your badge. So I highly encourage you to do that and visit over the conference and see how that's changed. See how things have changed in there based on what you're doing. Because then it's your individual badge, but then it's as a community, what can we do? How can we see what happens there? And this setup, the artists can explain more about it when they're there, but you have your badge that plugs into an Arduino which communicates to a Raspberry Pi that then does all of this amazing stuff. So it's really this really neat interactive artwork that's called the Tree of Promise. So yeah, some resources for the badge, all of the development documentation, a version of these slides are up there now. Again, I'll post a different one, more expanded later on. Source code is there, test procedure. Everything that you need to experiment with this badge and hack on it and grow with it and build on it is gonna be there if it's not already. So feel free to go there. And I do wanna mention too, the last time I designed a badge was DEF CON 18, an electronic badge, and I kind of retired. And when the dark tangent said, hey, let's do more badges, I was like, oh wow, it's been a long time. Sure, like that sounds fun. I sort of forgot how hard it is, you know? And it's really a big struggle to get this done in time and very stressful. And I need to thank my family who is actually sitting over here and they came to Beijing with me, first time at DEF CON, to experience everything here and experience the community because they dealt with me every single day coming in from my office, either complaining or being happy or stressed out or whatever. And you know, it is just like everything else. It really is, there's a lot of people behind the scenes that you don't really think about that are important. So anyway, thank you to my family for dealing with me. And thank you to all of you for coming and hopefully experimenting with the badges. And I believe we maybe have time for questions if anybody has questions here. If not, I'll also be wandering around, I'll be in the hardware hacking village, but feel free to, anytime you see me, come up and ask questions and I can explain whatever you need to know. So with that, thank you, enjoy the conference and yeah, see you around. All right, thank you very much. That was Joe Gran for our first talk. We're gonna start the normal speaking schedule now, so there'll be a break and then the next speaker will start at the top of the hour. Thank you very much. I'll see you all around DEF CON. I hope we have music.