← All talks

[BSL2023] The X Badge - Behind the Scenes / Anniversary Cake

BSides Lisbon · 202330:13235 viewsPublished 2024-03Watch on YouTube ↗
About this talk
Behind the scenes of our amazing Badge created by Pedro Umbelino (aka kripthor) At the end we celebrated our 10th anniversary.
Show transcript [en]

one two hello bide oh it's great to be here 10 years it's good to see friendly faces again and and keep this community going today I'm going to talk a bit about the making off of this device that you probably have on your neck and how it all started essentially it was a simple conversation Morrison asked me if I want to do it and I said yes of course maybe I I responded maybe uh too quickly because it it turned out to be a carousel of emotions throughout all this process throughout the months so first I was happy then it started to be a challenge then I solved it and then I stabbed myself in the eye several

times uh and this pair hit me and eventually eventually we had something that was close enough enough to our uh initial conversation so some of you might know this project flow that I sometimes present when I I'm talking about Hardware projects um it's my flow it doesn't have to be uh it's not a universal truth so but essentially it all starts with some kind of motivation and the definition of of the process of the project that you want to BU build in this case it was a hardware badge then there's some research involved how how it's going to to to come together and the the design of the PCB um and then there's the easy part

which is sourcing the parts where are you going to buy them uh where is it going to be made uh you know full disclosure China because of course uh then you test then you Loop the the loop process might Begin Again in motivation because you just threw everything out the window or you just Loop some parts of the process and some of these steps might not occur in this order um so yeah motivation was obvious I I I I I like to be involved in Hardware projects I like to be involved in in in bides of course uh and uh um I wanted to do something cool since last year the badge didn't have any you know blinking

lights so what I've started to think about is how can we take advantage of having a badge that uh actually allows to connect people and uh what I feel and what I feel that most of us all in conversations feel is since co uh you know disappeared uh people are starting to get together and they really want to you know be together again and talk about security and the conferences that I go are always full and sold out and this year apparently it sold out like a couple of months ago already and um I wanted to you know uh contribute for people to connect and to be together and uh and I had some ideas and how to

design a badge that will contribute to that exchange of of of connections between different different folks so and in the end everybody will be happy and making new contacts and you know throwing up rainbows um but before we go further let me just introduce you a couple of folks one of this is Augustus de Morgan so in 1866 he said something like whatever Happ what whatever can happen will happen uh this sounds very familiar with something that nille musculine said everything that go wrong will go wrong now you might noce as Murphy's laws it's not completely clear that this was uh said by Murphy uh and I always think uh this this was the original quote was

from Murphy but apparently not but then there's the finagles corollary anything that can go wrong will and at the worst possible moment so please keep in this in mind throughout this presentation so anyway so the motivation was done uh definition was done uh so that's it's time to do some research I had some ideas like I said so it's going to you know there's a PCB PCB problem is kind of solved I work with J cpcb for my you know hobby projects I know they they they they work well they they ship fairly fast and they they have decent quality on their on their production line so that that problem was solved I just had to design the the actual PCB I

know that the badge this time will have some kind of brains right and the brains was the ESP 32 S2 I chose the S2 because it it had low power consumption it's you know sp32 it's quite powerful you have Wi-Fi you have something cool to you know bring with you home and just play around if you wanted there had to be some kind of of user interface some screens some buttons something that you could play around while you were at the conference of course and uh s a power source I want this to be uh you know uh independent of being connected to somewhere so I I need to figure out what power source uh would I use in this case

it's the the the blue super cap thing that that you have going on that sometimes it's it'ss up a bit but you know I have all those things figuring figured out so I went into the design phase and I will show you some of the designs that that I was able to do so my first step my very first prototype uh was the the one upper on the up so one of the cool things about the SP 32 S2 which someone someone was asking me is why there's no uh chipset that uh is used to communicate via USB it's because the sp32 does not need it you can connectedly direct directly connect it to USB that's pretty cool you just need

uh to connect you know some wires and it will just magically work so after playing around with this very basic example I I went to the the second prototype which which was me testing pageon p n is a library that does all sorts of different communication uh and protocol types you can use it to communicate via uh LED for example via sound via radio it's pretty cool if go Google it go online it it does uh lots of different stuff on on very low power microcontrollers if you want uh but if you if you if you look at this wires here uh they are there for a reason and the reason was this first prototype that

I manufactur the the uh the the the PCB uh I sold it myself but when I ordered the the the board I I switched the data plus and data minus from the USB so this is one mistake every time I make a mistake like this uh I have to reorder another board I have to wait like a couple of weeks for them to come and I have to test all all things all over again so I'm going to talk a lot about uh things that I did wrong uh one of my friends uh that some of you know called arz yon uh says that in these types of conferences we we talk about our wins

but we don't talk enough enough about the things that we screw up but it's by screwing up that you learn uh otherwise you won't learn from from your mistakes right so I didn't because this mistake I already had had this exact mistake in a previous uh project that I have and I repeated it so third time is the it's the charm I redesigned the the actual layout of of the USB component uh in in my favorite Eda Eda uh I dropped the the actual USB connction Conor because if I can make it a bit cheaper and and I did on every part that I use just reduce parts that you don't need so it gets cheaper and

cheaper the the end device and if you notice here on on the bottom uh the sizes are different the reason these sizes are different it's because the the VCC and ground lines are on the sides and when they get inserted in your device they they receive power first before the data lines uh are activated right and you might notice that that is not what's happening here they are all at the same level which means I just connected it uh upside down so I I screwed up again so I had to you know uh for my testing I have to figure out how I could test the the the final version of the device kind of uh with the with

the lines switch but so far so good things were going great I was able to test the firmware I'm not going to talk a lot about the firmware because we don't have time and I realize I'm the last talk between you guys and be size Lisbon so I I will try to be fast um so sourcing the parts that's easy sourcing and Fabrication uh I sourced the parts that I needed this is my first complete um prototype that was actually ordered and assembled uh by jlcpcb in China it as you you might find some differences between your device and this one this one has a pretty cool screen all the you know power and and U um

resistors and everything that's needed to power this this OLED screen so it should be like uh integrated in one uh device for some reason I thought it was a good idea to left this ones uh which was the OLED module that you can see on your device and it turns out to be good good decision and we'll show you I'll show you why why a bit later so this was the first prototype type so awesome I have the parts I have the manufacturers of the parts I figure out the fabrication process I just have to eat you know produ 600 and and send them back to me so this is where things started to go

really really bad so first of all the buttons that I was testing they were out so the fabricate the the manufacturer does not make them anymore so I had to choose uh different buttons that were size compatible well that's you know that's doable so one problem solved took me one week emails back and forth with the guys but we we figured that out second problem the OLED screens uh were just enough for 300 devices and they will take 45 days to be resupplied uh this was back in September we didn't have 45 days to have you know to wait for this uh OLED you know shiny screens so the decision was was made okay the in the in the original

prototype that I was working on I was working on with a with a module so we you know order modules there was not exactly the same module but we could find 600 modules so it's a risk because when you're using something that you haven't tested before but maybe you can get away has the same pinout has the same specifications should work but you never know so so far so good problem solved couple of more weeks wasted in emails back and forth finally uh they just said that it's going to be impossible to actually provide uh 600 esp32 S2 and then I got really sad there was no time to redesign the board or to use another

microcontroller and Order and test it and Order 600 again and spend all those guys money on something that's essentially a brick and I didn't want to do that uh things were stalled a lot of emails exchange there's this guy making pressure to the manufacturers to deliver sooner that was not possible apparently uh esp32 S3 which is the newest s uh series chips for for expressive uh was pin for pin compatible and that's something that we found maybe if we order them and just you know order the 600 pin for pin compatible should mean that should work we had to risk it and there was absolutely no guarantees that this will work at all so eventually we just decided to you

know we have to you know take the step and order the manufacturer process to start uh it should work but there's no guarantees mean meanwhile I order uh one or two but uh so I can test it by myself but they will also take a lot of time so this was kind of uh you know uh a step into the into the unknown so anyway this guy is a happy hero is andry Deng I don't have time to explain all the different emails that we had to exchange between uh you know the time period of around two months uh I'm sure he he has nightmares with about the the email exchange as much as I do uh but it was a

really really um Champion for our C inside GC PCV um so this is how it ended the fifth generation of of prototypes for for the badge arrived that's me with the two weeks ago in my uh you know uh working clothes uh receiving uh 32 kilos of of of Badges and taking a quick photo before running out to my computer and put it put it and try to flashh it and see if the OLED screen would turn off on if everything would work it didn't at first compile because pin for pin compatible doesn't mean that the libraries are compatible and and you can just run the same code I faced some issues in the end we we were uh able to

make it work there are some errors and mistakes that I made first of all all of you guys have probably noticed that this hits a lot when charging it does so because I I I just connected the the super cap straight to the to the voltage controller so it just sucks up all the juice that it can so one of the advantages it charges really fast but uh it gets really really uh hot it this device sadly will discharge until it's dead and that's why you are seeing my kid taking them out of boxes and using every single device that we had with a USB port charging all the 600 so they don't get to 0.0 before the Super cap

dies it turns out not all super caps can be discharged up to zero I did not know that information before choosing the super caps and it's not obvious on the on the on the spreadsheet but if you you know if you have an electronic engineering background you probably know this but super or capacitors in general should be able to be fully discharge and charge apparently no so your device will die unless you you continue to charge it and finally because of my LCD the two lateral buttons that you see uh to the sides of the screens are actually just one button how that happened well when I was redesigning the board uh in Eda uh I

figure out that one button was connected to io1 io0 and the other to IO 34 or something and that make no sense so I redesign it so one button is IO Z the other button is io1 makes sense but I copy Cy pasted the the lines so it's not obvious when you look at it but if you go they if you go and examine the the the lines the supply lines uh they they are in the same net the the the net is the same name what this means is when it gets Auto rooted and translated into copper pets eventually they will connect at some point so it's just one button the advantage is is one of the buttons

you know uh uh gets damage you have the other one so you can use anyway in the end uh what you got in your in your neck is a US esp32 W Street has 4 megabytes you have Bluetooth low energy you have Wi-Fi there's USB there's also W W Port that you can see broken out on the side of the ESP the two pins you can use it for debugging uh there's also a lot of uh of can see a lot lot of iOS that are broken out if you want to use it in a different project there's a reset button you know one button and one extra button there's a 128 per 32 pixel OLED there's

one Ultra LED that Ultra LED was designed last minute just in case the L OLED screen was not working at least we we know for sure that we could blink at least one LED so you guys won't won't be too sad so there was a blinking anyway there's one touch interface on the pad wire to and yeah uh the firmware stuff there's I think this is has to be like another talk there's a lot of tricks to make this work to make it consume less power to be able for the the the timings to be able to work for the pageon actually Library transmits the information uh your body actually acts as a wire so if you hold two two of the

two of the badges uh together the information flows through your body and in into the other badge so I I found that is pretty cool anyway that that's that's for another talk and uh maybe Bruno can talk a bit about the uh our backand and how we come to design such a awesome awesome backand so after all this uh I did the back end so it was first easy part and the one that I didn't do much work because I use cat GPT for everything you see on the front office so the the scoreboard was just asking chat GPT to do stuff in HTML and and and uh and uh JavaScript so it's like 99.9% including

the small icons that you see there uh with the exception of the r roll which was Pedro's idea um and the back end is like Python and more cat GPT to to do the things works like four end points of an API and not much more uh so I tried to do as little as possible uh and make sure that this worked it seems to be working sort of and we'll see tomorrow what happens so yeah so just just to wrap it up I managed to get my primary objective is you you know I'm still married uh this was a huge challenge for for me and and and and my family at at home and the secondary objective you

have a badge that you know blinks hopefully uh you can meet new people because of it and you can take it home and fill with it uh I just want to thank um uh I I want to thank Bruno and I want to thank HD here and besides lison for putting this challenge uh in front of me it was really really fun to to do it uh I want to thank uh bits side for supporting uh the work that I did and supporting the the badge of course uh to all the guys at the flash party you know who you are flashing 600 badges is is not easy at all there was some help involved uh and some of them I can I can

see your faces here and of course uh I want to thank uh uh my daughter and I want to really really thank my beautiful wife Tanya she's not here I hope I hope she was but without her support and uh you know insisting us to charge all the badges at home and stuff like that and all the hours that she didn't get to see me uh this was not going to be possible at all thank [Applause] you please don't don't leave yet we are going to hopefully soon have uh a birthday cake if anyone comes in with it like now it's a good surprise I don't have internet typical if you have any questions we

have a few minutes before beer anyone no great I don't know maybe tell some jokes something any questions there's there's there's a question there raise your hands in the

middle so is it true that there is a function called the soulmate one and if so how how does that work yeah so uh every single of every single badge has one soulmate and just one so every one of you has a soulmate that will give you a lot of points if you find who's your soulmate it's random we don't know who the soulmate of the other person is so that's one one of the incentive so you get a lot of points but you also have a lot of points if you go to sponsors the sponsors badges have different points so you can NE them for you know connections yeah I'll just give a heads

up because there was a question previously because on the scoreboard that's actually at the time I saw there were three people with soulmates which is the heart two of them was obviously Pedro and LU they won't count for the for the prizes okay don't worry it was to test and there's one more we have no idea who it is and someone is saying but how can it just be one soulmate well it's like in life sometimes one soulmate recognizes the other and the other doesn't so if when you cross the bed it's it's really and when you cross the badges and if you try it sometimes it happens one actually counts and the other doesn't so

that's probably what happened we have no idea idea we don't know whoever has the badges the only way and tomorrow it's what we'll do if your ID comes up on screen you'll have to show your badge that's the only way we can actually know it's you um so that's probably the the reason why so keep trying to find your soulmate who knows more questions uh we have here what's the price for in the end we have a lot of prizes real nice stuff so I don't know we have books we have uh well we have hoodies from besides Lisbon 2023 which are exclusive to Winners tomorrow uh we have stuff but if you're doing for the

prizes for the fun and the URL it's dashboard not board yeah it's dashboard you can use badge. Biz lb.org or dashboards besides lb.org any more question it's slow because it uses uh a modem anyone no I think we don't have okay so birthday time thank you sorry sorry have one last one how cheap did you make it as much as I could the valid okay let's try another prompt more expensive than your ticket and and it's not a joke it's real

okay so it's just a final tip as you as you noted the USB might not be just for charging just for you so you know use at your own risk let's get the cake on stage guys where's Jorge people want to have beer and cake and

food

for

me

e

thank you thank you for staying for more five minutes okay so can we have the besides Lisbon team on stage please we have a surprise for everyone so I remember that someone was talking about surprises so this is one of them not the team of course but ah there you are I was looking for you

too

yeah now we can we can show you the surprise and as you know this is the 10th anniversary we had some ups and downs uh there was I don't know if you guys remember there was a pandemic at some point but as you can see this is a true team we stood together and we are back get someone else on stage come on yeah yeah ah of course o oh my god really you may know this person this artist from our t-shirts and from the posters that we have upstairs so without further Ado please give it up for the team of besides Lisbon and 10 [Applause] years [Applause]

so as some of you may know Bruno and Thiago were the ones that started this journey and I think it's more than fair if you guys Cut the Cake it's award it's so cute [Applause] and we have more cake outside so thank you all for coming and we hope to see you outside also we have beer we have lots of food please take care of it and we also have cake and we hope to see you tomorrow as [Applause] well