Last year's puffy badge was both a learning experience and a reasonable success, selling out in a matter of minutes. Armed with the knowledge of mistakes from last year, Miri and I began designing another badge in late 2017, and it's looking like it will come together for DEF CON 26! Here's the skinny:
Like last year, it begins with a doodle from my talented gf Miri:
The statue head suggested a vaporwave theme that informed some design decisions throughout the life of the badge. She also designed a custom lanyard in this style that will come with the badge:
Designing the Gizmo
I wanted to keep the design present in last year's badge, which included a pre-existing chipset that users of the badge could remove and play with if they wished. Like last year, I also wanted to have it run a full-stack Linux install, because why not? ;)
I ultimately chose the PocketBeagle. While a little more expensive than some of the other options, it has a large community and a ton of pins broken out that would prove useful for maximum hackability potential.
We also chose to go with RGB rather than single-color LEDs this year, for maximum hella bling. Caveat emptor, they are bright.
Building the Hardware
Being a software guy, designing last year's PCB involved learning how to design PCBs, as I had never done it before. This year was hardly different, as a year had passed since I last designed a PCB, and I had forgotten much of what I learned… Many pages of documentation later, I had a schematic:
The sharp-eyed among you may notice that I only have one resistor per LED, rather than one resistor per color, which is how you're supposed to hook up RGB LEDs. This is because I have absolutely no idea what I'm doing. Because different colors of the LED draw different currents (or something), you can't light up red and blue at the same time. By the time I realized this, it was too late to make any hardware changes, but I fixed it in software by doing PWM on each color rather than lighting them both up at the same time.
When all that was said and done, I used Freerouter to do the hard work for me, turned the pretty pictures into silkscreen and copper layers, and faster than I knew it, Bob was my uncle:
The first revision of anything rarely works, but I got pretty close. In the first revision, I failed to hook up ground properly, so the display's backlight didn't work. I also discovered that the screen wobbled quite a bit, so I added a mounting hole for it. The hole for the lanyard was also too small.
In the second revision, I didn't give ITEAD the correct drill file and my NPTH holes were not drilled. Oops. The mounting hole was in the wrong place anyway.
The third time was the charm:
As I mentioned earlier, the main challenge was building a PWM routine to make the LEDs look right. I ended up hacking up a PWM library I found, modifying it for this purpose, combining it with an IO library from Adafruit. It wasn't pretty, but it got the job done, and used only 10% CPU. This left plenty of spare cycles to display animated gifs on the screen.
There are plenty of image viewers that will display directly to the framebuffer with no need for X, but few that will display animated GIFs, and I couldn't find any that would loop them without stuttering. The solution I ended up at was transcoding the gifs into H.264 with ffmpeg, and displaying them through X with mpv –loop-file.
I baked Plymouth into the initramfs to give a nice graphical boot screen to look at while Linux loads up. Staring at a black screen wondering what's going on isn't a great user experience.
Customizing your badge
Remove one of the batteries and plug the badge into your PC with a micro-usb cable. It will show up as a USB-to-Ethernet adapter. Get DHCP and ssh into firstname.lastname@example.org, password is temppwd. You can change the GIF it displays by modifying ~/.xsession. There are a ton of neat vaporwave GIFs in ~/mp4s, but you can of course add your own. Just remember to convert to mp4 first!
You can modify ~/fade/fade.py to change the LED pattern as well. systemctl restart fade will load the new script.
Where to get one?
We will be selling fully assembled badges, including batteries and a lanyard, for $80 each. We also have a few bare PCBs left over, which you can get for $10 each. You can build those into a fully working badge if you wish (parts list forthcoming).
We have both white and blue badges available.
We will announce on Twitter where we will be at the con selling badges, so follow us if you want to get your hands on one. We had to hand-build all of these, and we only made 65, so keep your eyes out :)
Thanks and have fun at DEF CON 26!