← All talks

Badge Talk

BSides SLC · 202024:33200 viewsPublished 2020-03Watch on YouTube ↗
Speakers
Tags
StyleTalk
Mentioned in this talk
Tools used
Hardware
Concepts
About this talk
Title: Badge Talk Presenter: Waylon Grange
Show transcript [en]

all right cool hey thank you very much as you can see obviously in these pictures the badge doesn't look like any of the other badges at least that I've seen I know we've done something like this or not we but people have done kind of wristbands before but I think this one's kind of very different I didn't mean for it to look like a medical banner that's kind of I don't know like this whole virus thing it kind of applies but I know I'll talk a little bit more about are you uh are you ready to go yes I am you can't hear us you can't hear me hold on a minute let me okay you're good we'll do some you Bryce

keep going okay so you can hear me yeah you're good all right okay cool so I'll just keep going um I kind of want to give a little background on what led to this badge so this is a picture of me the one on the left no specifically this is me at Def Con and that is all my badges I was wearing at Def Con and I kind of felt a little like mr. t right with all my like bling going on there and like you know I mean the rock is heavy and then some of those other badges and all their batteries started to add up I kind of felt like a backpacker my neck just you know just

hanging on me there so that was kind of one inspiration I wanted to do something lighter than the the usual neck chain one of those badges I got there was the DEF CON China badge which is really kind of cool it's a flexible PCB badge with these little lights that'll blink on the side and I thought that's really cool I want to try to do something with flexible PCB but I'm not sure what and then the the third kind of designing factor that I wanted to hit was based on last year's badge so I'm not sure as many of you were here last year but in my talk I described how I totally screwed up and ordered a processor when

I went for the final fab I had a wrong part number and that basically ended up with me ordering the processor that was one third as powerful as what I designed everything for which led to some really crazy two weeks of reprogramming and redesigning to try to get everything to run on a really tiny processor and that was really painful at the time but after breeze sights was all kind of done and I kind of had a chance to breathe I was like man that was kind of fun squeezing as much as I could out of a processor I felt kind of like one of the Biggest Loser coaches and but like four processors all's right like no you

have to do this on this little bit of energy or power or whatever you have and I kind of wanted to do that again but this time instead of on a lower processor I wanted to do it on power I wanted to run on as little power as possible so those were my three rail designing goals flexible PCB something not heavy around the neck and very low power so I was just kind of chewing on those and I came across one of these Dick Tracy convicts and I was like oh that is it that's what we're gonna do so that's kind of what I designed this around I don't know if you've seen this video on Twitter already but basically

in a nutshell the watch is a functional walk or the badge is a functional watch there's a text-based adventure game built into it the page it's ePaper display a 3d printed case around the size on the bottom there's some snap a snap button that we can resize or size initially to your wrist it's also a USB mass-storage drive a CD serial and there's there's a lot more going on as well on the badge that I don't want to rebuild at this time so like I said the back side there's adjustable snaps this is kind of part of the reason we decided against trying to ship everything is that these snaps require this special little tool to set the snap and I didn't

want to set the snap just based on what you tell me your wrist size is it would been easier I plan to do this at the conference after you got your badge you just kind of come over and get the snap that matches your written you know put the snap on the matches your wrist size but things didn't work out quite as planned there here's kind of the the Dynes design flow of the badge the top left is my initial prototype that I wore around for a few days my kids were very embarrassed as I wore this piece of paper pretend watch on my wrist as we win everywhere after I kind of proved that okay

initially this this might actually work I went for the prototype on the breadboard down below that was my test setup you can see my multimeter hooked up all along the way I had to be very conscious of how much power the whole system was using in that screenshot it's showing it's using three milliamps which what that's when it's typically running and then my first prototype is in the center of the screen I kind of had some mistakes that's why there's this little yellow wire afterward I had to kind of solder that to fix some of my wiring errors I have to thank conky Kidd for helping me solder or he helped me put all the SMD

components on that badge so that it I can actually have my first prototype again the two pins off the side are for measuring power usage and then the two in the end are the final production run one with the 3d case and one without the 3d case so just talk a little bit about the hardware that went into this it's based around a 32-bit stem processor that's designed to use very little power it's the whole band itself is a flexible PCB band we have an ePaper display it does have a recite a rechargeable lipo battery on it so if whenever your USB plug it in that'll charge it charge it up the watch on its own should last

about 10 days without a charge so I mean charge it every day every other day whatnot and keep the battery running just fine the accelerometer flash storage there's a real-time clock kind of wanted to talk about the flexible PCB I don't feel like that's something that's done very much oh I forgot to mention earlier questions please just throw them in the QA and then if there's time at the end I'll get to him there I just won't I won't interrupt myself so I'm going so I'll hit those at the first time at the end the name is flexible PCB I've seen it used once or twice for badges and I wanted to try it and see

how well it works it's really kind of cool right like what badges can you bend and twist like that however it does have its drawbacks and I'm not sure I would do something like this for a badge again just so you know if you're a bachelor I know you're thinking about this there's a few issues that you face one this picture in the top left or pop top right is one my early prototype rewards testing out the NFC and as I would pop and pop that off pop it on and pop it off the breadboard it puts stress on the flexible PCB which led to those traces cracking and so when the trace is cracked

I had to solder one of those little yellow jumper wires to replace the broken trace and then I'd use it and another one would break and so those three yellow wires are because three different traces on the flexible PCB just would break during the what I considered regular use so it it bends but it also breaks and so you want to kind of limit the amount of Bend or in critical places the cut type of Bend another picture another thing is the picture just below that I was initially planning to use some double-sided kind of film rubber underneath the Flex screen and the components and just kind of give that kind of padding there but

it turns out that double sided tape actually when you would bend it started pool components off the flexible PCB you can kind of see in that picture the battery leg is been has been ripped off the flexible PCB so in the end I had a determined way to keep the flexible screen moving independent of the board without the flexible screen being exposed a lot um so that battery you see in the center there that is a light bulb battery and it has it holds 40 min of milliamps so to put 40 milliamps in perspective one of those little coin cell batteries is sold six times as much as one of these rechargeable batteries and those coin cells right like you can

power an LED for like a day on them they're not very much and so to consider we have one six two that is a real limiting factor I toss initial design I toss I'll toggle back and forth between wanting that coin cell or rechargeable and like rechargeable you could recharge obviously the coin cell you could just replace after so long ultimately I obviously went with rechargeable mainly because it was just such a pain to get to that location and I didn't want everyone has to take their badge clear apart just to replace the battery so I just assumed that everybody around us has a PC they can probably charge this at least every other day so I'm gonna go

with rechargeable route first in comparison though to work on 40 milliamp hours for what I can plant on a 48 hour conference I had to really cut down my power usage so I'm I have side by side here this graph showing what last year's badge how much it used in each state and how much initial capacity I had to work with compared to this year and across the board it's you know about 1/10 it starts to drop as the different states go so just the asleep is when you're not active it's just kind of sitting there and then standby is in was not a state in the last year's batch standby is almost everything off the processor

shuts down all it's doing is keeping track of time which presented some of its own issues because when the processor shuts down all of the memory is wiped so I had to kind of stay save enough state so that as soon as you pressed a button you could return to exactly the same screen and exactly it's in place in the game you were to make it look like to the user it never turned off right but the whole processor the memory the buff frame buffer everything is wiped but to see in standby we're using that's 25 micro amps it's really it's really kind of cool to see that it actually worked in the end so the

flexible ePaper display I thought was the coolest thing when I saw it online I really I really am enameled with I don't know the right word I'm a country I really like the ePaper displays I think the coolest thing in that you can just set the display once and it takes zero power to maintain that it's very low-power and it looks very crisp and the flexible was just on top of that just even better or so I thought I only found one manufacturer that would make flexible p/e paper displays and it turns out the reason I in mind the reason that not many people do it is because they're not as flexible as they seem if I try to

do what they're showing in this picture with here I ended up with a broken display and in fact after the production I ended up with many broken displays these are all in the screen shock displays that failed some way or another and we're not suitable for the batch that became a really sore point at final stage of production is that I had to find a way to protect these better than I was and that they just not very flexible they don't take any kind of beating any touching they don't like event even though they're claimed to be flexible so when you give your badges if you don't take anything else away from this talk please take away the screens are really

really flexible are really not that flexible they're really fragile so if you press on the screen or you smash it against something it's gonna break and we really don't have a lot of extras because I went through most the extras so when you get your badge it's flexible yes but don't push it just just please be gentle be gentle okay so to help mitigate some of those flexible issues I designed a 3d print a 3d printable case here I have two videos I'm gonna show one is the design process and the other is the printing process of one of those kicked them off of the bone posts at the same time but it's kind of kind of fun I

don't do much 3d printing so this was a good opportunity to build something that I felt was slightly useful we went to a 3d printing company and have these printed after I did my test one runs and turned out that their margin of error was a lot higher than I expected so some of the frames don't fit together as snugly as I would have liked but I am releasing the STL files for this so if you'd like to print your own case I imagine all the ones that I printed fit well very well and I imagine if you print your own it would probably fit even better than the ones that it came with but even still the ones that came

with her just fine it's just kind of a perfectionist thing so the software or the firmware I used stem cube IDE to build all this which provides this really cool kind of interface on the side here you can just assign pins and it shows you graphically can this pin it's assigned to this this is what you've got left it also builds out a lot of the code or the stub code for you and so that was really nice to work with as you can see from this screenshot I'm using almost all the pins that three great pins down the bottom corner the only three pins of that processor I'm not using and then below that it

shows the flash space I'm using 92% of it and that's after pulling a lot of dialogue and game code onto the flash chip but I'm used the external flash chip and then I'm also using a lot of RAM I have to use a lot of RAM because the ePaper display takes two buffers when you're doing a partial refresh on the ePaper it takes one just one buffer you have to pass it what the screen currently is and then you pass it what you want it to be so that it can do a kind of a ping pong and come up with it so double kind of a double buffered frame for this ePaper display um after

initially building everything there was one bug that really annoyed me and that was after about a week of the watch running it would fall behind about four minutes and debugging was really painful when I would debug it while the processor is running it was beautifully keeping track of Donna time down to the microsecond it was very precise but the processor was shut off right and then turn back on and update the time and I can't debug a processor that's off there's just no debugging of it it's gone and when we come back up it was somehow somewhere it was a few microseconds behind every time we would come back up and I couldn't figure out

what that issue was well it turns out during a reinitiation as the processor would reboot it would I had it re-emitting the real-time clock and when it would Rhian it it there would be at 20 millisecond loss that occurs once every minute because it updates the screen every minute and that time compounded it you know 60 times an hour 24 times a day for seven days ended up being about 3 to 4 minutes of time loss and so fixing that one bug resolved this complete issue but finding that blog bug was extremely painful um another issue I had is during the course of the game you will unlock files or case content and that will be

available to you on a USB Drive but I want way to not have those files be available until you unlock them and I but the problem was I didn't have anywhere else to store the files like that flash space was the space I had to store these files so I needed a way to have them only appear women they were available and I was just thinking okay well I'll just you know modify the file list and only show the files that I want to be there but the problem is is a USB command a storage device doesn't speak like directory listings it speaks Rost Guzzi commands like show me this sector you know give me the contents of this sector

give me the contents of this sector so my solution for this is I actually designed a semi I don't know you I considered a rootkit but basically I'd interrupt sector calls for the file allocation table and modify the file the fat table sorry that's for the fat to only show the file listings that I wanted to appear the actual data is on the sector's but only that file allocation table is modified and if the machine doesn't know the files there then it just assumes there's no data there that is something that may come in handy during the puzzles just to know that fact that data is there but the file allocation table be mucked with so the

theme for this game is a DF I are last year's theme was kind of an attacker kind of a pen tester more the puzzles were more geared around that these puzzles are more geared around the defender I think that fits in well with kind of a Dick Tracy detective type theme so all these puzzles there there's the packet carving there's some reverse engineering I promise I'm a lot easier than last year's malware analysis disk imaging steganography there's a lot of dfi of what I would consider dfi are basic skills that are built into this I do I did kind of try to build them to challenge you somewhat but I didn't want you to have to spend they should all be

doable in one day so they should be that rough of puzzles but at least if anything they should get you an entry into dfi or if you've never done this thing kind of before as the badge is running it'll have it has a little LED on it that will occasionally blink four times and those four blinks represent your game state how far along you are they'll initially it'll just blink for red lights which kind of means you've done nothing and the goal is to get it to a vet to for blue lights when you've got four blue lights you've made it all the way through the puzzle the puzzle does kind of play into a story

that you were are kind of solving and I didn't want it to be linear I wanted it to be so that you could work on multiple puzzles at one time so this is my kind of logic chart I've kind of blanked everything out but I wanted to be like if you're stuck on one puzzles that's all right there's like five others you can be working on until you kind of narrow yourself down to the end and then it draws into one line so this chart it flows actually left to right right being the final goal that little green box says finish and any green box on the left is a puzzle that's able to be

solved from the get-go and then they just kind of chain along from there so you've gotten got multiple paths you can work until you reach the finish line I took a lot of design theme from a really old Macintosh game called deja vu I'm not sure it's worth going worth going back and playing yourself it doesn't hold up to the test of time very well but I thought it was really cool how they got so much with just a monochrome display and just the story that they were able to build into it so I took a lot of inspiration from this as well here are a few screenshots from badge gameplay a lot of these you've probably

seen in videos I didn't want to refill a lot more than RT has been revealed but as you play you will be able to find things pick up clues use items you've picked up and as like in the picture in the top right this you just this dialogue something happens you talk to this guy and he seems to a key has now added this file to your case file so then you can plug in your USB Drive if you have access to the file you can do analysis on it and then use that analysis to open up more game paths kind of toggles back and forth like that throughout the game and that's how am i

doing on time I talk can fast okay I'm about out of time so this is good alright so I have just a few items of an raishin since this won't be available I sorry one of the I don't know when the badges will be able to be handed out I'm leaving that up to the board right to the side the other ones in charge whenever that is I do plan to be there and I'd love to see how this works in person I will once this is all done post the source code and all the files the images the scripts I used to compile everything to the link below but I'm keeping that repository private until

after that date also this little badge so on the badge there's a little programming header that you just plug in to and this little green box is what I use to program it to interact with it to dissapoint debug it whatever and I have a few of those so the first so many people that are able to completely solve the badge I plan to give them one of those along with a mini breadboard and some wires to kind of help them get started and then all the code will be released so if you want to reprogram this to do something else you know go for it it has a real-time clock house accelerometer so you could make it like

a pedometer I you know there's I feel like there's a lot that can be done here and many things that I'm just not even thinking of so I'd like to hear what eventually in the future what you guys do with this so to initially set the date I have a I decided to put a switch on this and I'm glad I did there's a power switch most watches don't have a power switch right there always on I did the power switch mist so the watch is completely off until you get it that'll mean there wilt the battery won't be dead and as soon as you turn it on it'll start keeping track of time but obviously time

will be off so you set the time be an NFC n def tag and you just can format it like I did there to say date semi date : and then the date you want and the next time it reads that NFC or the next time the badge is actually on if you just press the button it will turn on or it'll just turn on the next minute but as soon as it turns on it'll read that and set the time appropriately I wanted to give us such thanks to the B side staff they've been really great trying to do the best they can with all of this really I really appreciate being able to

make these badges it's a lot of stress but I do kind of enjoy it and obviously I comforted Mike I mentioned before but he helped me a lot at least with all the hardware getting it soldered down and I think I bounced a questioner gee-off hardware design with him and I really appreciate his help on the matter so with that I'm sure there's items or questions I missed if you have any go ahead and throw them in the QA I think I see one now says if I didn't buy a badge with my ticket are those extras that will be for sale I'm not sure the answer that I believe the answer is yes that's

a question for Bryce so I will I will poke him afterward to see where ticket sales is at and maybe he can probably can have him make a comment in the slack page on that one any other questions there's one in the chat it says are we gonna get an email or something notifying us when you post it to the URL when you make your github public um I guess that's possible I I don't have access to that email list but I could definitely paste that link on to the staff and the staff could probably do that waylynn it's it's price so yes yeah we can we can push out an email another thing that I just want you know we

always push up the content on Twitter and slack channel as well and so the Twitter and slack are usually the best places to get updates right and then I'm happy to push out an email whenever that codes online so and then if we have extra badges we definitely want to get rid of them and so you know we'll talk about what that means I'm hope I'm hopeful we can have a meet-up later in the year and you know if we do that then we'll figure out how many we have working and sell off the rest of them but we definitely wanna make sure that the people who've already purchased them get them first right all right cool um

seeing if there's any I think that's it right we've hit everything okay well I appreciate your time I'm really curious to see what you think we should just stick with more of a traditional badge or I think this was a cool idea yeah thank you guys very much for attending appreciate it