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 DEFCON China. Like DarkTangent just mentioned, badges have always had a special place in the DEFCON 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 DEFCON 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. 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 DEFCON China really was to bring the community together and then let you walk around. And as you experience DEFCON, 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 DEFCON. 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 would 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 DEFCON 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 symbolized this growth as you experience DEFCON. 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 appear 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 process is 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. It started in this educational environment that has 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 too beginner, it's too basic. But that was our point, is to have a platform that's custom but, again, will 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 is already done, that base level development work. So an Arduino is based on a... On an AppMail part, this one is the ATmega328P, 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 going to plug into things. Our LED driver. Because we have 32 LEDs on here, and we only have a single 3-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. Ah, 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. Ah. 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 was a little bit tricky. The most important thing is the flex cable. The lozenge cable. What I've learned is the flex cable, re-applied up on one side, on the other side, so that If we do this on the side, the flexible printed circuit connector has a very specific thickness 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 micrometers, like very, very, very thin, precise thickness. And also, 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. 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. And we ended 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 batteries 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 other 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 com port. 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, 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 going to 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 is 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, 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 there is a single panel. And each one has to go through these different steps. So the middle one here is the silk screen. And then the picture on the right is what it looks like after the silk screen, 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 necks to make sure that they actually do what they say they're going to 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 now. that as well and what we did is created little programming stations with the Raspberry Pi little Linux based module and that has USB support so what this does is will configure the USB chip that's on here it's an FT 232 USB to serial adapter it'll can 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 had to refine their process a little bit then the lights would blink on power up so you would know oh the accelerometer is 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 your battery all the lights turn on and then they turn off that's you can make sure all the LEDs are there in case you're curious in the numbers of the 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 DEF CON and it makes it fun also if you're trying to collect badges like how can you trade with people what what can you do after the conference to to build up your collection some of the problems we had no development ever goes perfectly right that would be amazing if everything works 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 to get things working and I only had two prototypes to work with so it was a little bit nerve-racking 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 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 here I had to plug it into the USB connector and it would kind of flex on the board and then the board would stop working and I go and like oh this is bad not good and so I worked with with Neil one of the DEF CON artists to refine the shape of the board to give the USB connector more stability so it wouldn't flex and that that saved us but this is stuff that was just a you know 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 that was such a crazy problem. project the time frame 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 CR 2032 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 DEF CON 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 you know 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 the as the the system powers up when all the LEDs come on and then it dips and show us some LEDs and the sleep mode is is really far down so then how do we interact with this badge what's the whole point besides you know 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 through 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 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 they'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, and it 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's 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 5-volt signals from an Arduino to the 3-volt signals that we need on our badge. That's an important one. If you're going to hack on this thing, you want to make sure that the voltage levels are actually correct, because if you're sending 5 volts to a 3-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. 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 going to turn it on. A 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 going to try to do all of this with holding the microphone also. So here's my badge, which currently I have a few lights on. Kind of hard to see. So I'm going to take this and plug it in here. Now, you normally won't have to do this. Whoever is running the contest or the village will plug it in for you. Let me 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 I, and 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. Okay. So I'm going to go ahead and turn it on. If you complete a one route, there's four LEDs per route 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, that's the demo portion. So the remaining mode of the shield. Is something really cool that we said, okay, not only do we want to 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, and, 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, you know, your individual badge, but then it's as a community, what can we do? How can we, how can we see what happens there? And this setup, the artists can explain more about it when they're there, but it's a, 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, 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 going to be, is going to be there if it's not already. So feel free to go there. And I do want to 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. Hey, let's, let's do more badges. I was like, Oh wow. It's been a long time. Um, sure. Like that sounds fun. Uh, I sort of forgot how hard it is, you know, and it's really a big struggle to, 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, uh, because they dealt with me every single day coming in from my office. And I think they're complaining or being happy or stressed out or whatever. Um, 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 that are important. So anyway, thank you to my, 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. Alright, 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, and I'll see you all around DEF CON. I hope we have music.