The Friend Conf 2021 Badge

minimum viable friend camp

The badge is built out of the following bits:

Electronics

The badge schematic

The badge schematic

This is the second (ish) revision of the board. My first pass didn't use a module for the ESP32, instead I was planning on using the ESP32-WROOM directly. The price for the boards assembled with the esp32 came out slightly cheaper (about 20 dollars per board) than buying the feathers from adafruit, I was worried that I'd mess them up and end up with not enough time to respin them. I suspect that the number of badges that I'd need to make to have it make financial sense in include the esp on the board is pretty low (like 30 or so?)... But I decided a handful was enough.

The screen backlight and piezo amp use basically the same circuit, and really simple transistor to ground so you can run more power through them than an individual gpio pin can supply.

Board layout

Board layout

I ended up messing up the first board pretty drastically, the pins to the screen were backwards. I managed to correct one manually, but I didn't want to do 2 that way, so I corrected it and sent off a second revision. I also didn't have the screen backlight circuit on the first board, so I couldn't turn the screen off. This meant the battery life was incredibly short. It still isn't great, but now it can run for a day or two depending on how often it is checking for alerts. Before, the best case was a few hours, even if you weren't doing anything on the internet.

Screen Bodge

Screen Bodge

The second revision I skipped the gold plating, so it was much cheaper. I used the first revisions outer parts for the front and back of the case, and a new board for the interior.

2nd rev board photo

2nd rev board photo

I managed to make a few more mistakes on the second revision, but they were all easier to bodge than the backwards screen. I suspect I could correct all these issues on a third revision, but the feather huzzah was still a nightmare to get on the board. It really isn't meant for surface mounting (missing castellated edge connectors). I had to cut out tiny little bits of wire so the solder would flow down through each of the holes.

The easiest part of all this was importing casey's PCB art. I'd played around with this before for another project, so I knew the file requirements and the asset pipeline. It was just a matter of lining everything up and dropping it onto the board.

Enclosure

This went pretty smoothly comparatively. Part of what made it easy is that each revision was just printed, and cost pennies. I did the mechanical design in OnShape, and I basically had 3 versions of the case design before I figured out something I was happy with. The final case design I probably printed up 3 or 4 variations on, trying to tune in the sizes of the holes for the screws and the various other things that I needed to squish in.

You can check out the 3d model in your browser. The catch with onshape being free is that everything you make needs to be public.

3d model of the enclosure

3d model of the enclosure

Then it was just a matter of priming, painting and sanding it. If I was making more of these, I would have skipped all that and just bought some plastic color that I liked.

Firmware

Here is all the firmware if you'd like to browse.

I was a bit surprised how verbose the mastodon API is, it makes it really tough to deal with in a low memory environment. I suspect the "correct way" to handle this would be to have an interstitial server that lowers the amount of bits required to send out to devices, but I really didn't want to deal with an extra authentication layer. So I just ask for a few posts at a time, and do that request a bunch of times. Apologies to the server.

The alert thing is pretty fun (see song.h) - I made a super simple sequencer, and threw on a tiny bit of phasing so the notes had a bit of movement to them. The esp32 has a few ways of getting audio out, but I just went for the PWM peripheral - it has an API that lets you set the frequency, and that goes straight out to the speaker. Nice and simple.

I would have liked to spend more time with the screen graphics, but I sorta ran out of energy. I had big plans to show an animation of spiderman dying on bootup. I suspect there is still plenty of room in the firmware for that.

This firmware is a highwater mark for the number of times that I wrote horse & piss.