Entry 2: "Rapid" Prototyping

A project log for Building a Conference Badge: LIWho 2023

A Tamagotchi-style game-playing badge with a scavenger hunt and AI-driven interactive fiction... how much more 2023 could it be?

jorj-bauerJorj Bauer 08/10/2023 at 13:550 Comments

In 2022, the return of LIWho was announced and I unpacked the goodies I'd stored in 2020. Now, what was the problem again? Right - I ran out of program space. It could play a simple pattern-matching Simon; Whack-a-mole, where it keeps lighting up lights for you to hit buttons; and Magic Square, a game from the 1980s Merlin where you tried to light up all of the lights. I had some concept of Tamagotchi in it, where it nagged you to play Simon occasionally; and a bit of social interaction where you could "introduce" badges to each other with special button-press sequences. But I couldn't really tie it together without more program space; these were just disjointed bits of code that were kinda fun on their own - and probably would have been fine - but weren't enough for me.

So I spent a few months building and rebuilding bagdes with different processors. The two likely culprits were the ESP8266 (oooh, wifi!) and the ATTiny 1606 (a beefier and more modern '84a).

The problems I needed to solve:

  1. Noise immunity. The serial port docking protocol, and programming pins exposed on pads, meant occasional hangs or reboots. I played with an ad-hoc I2C bus for docking and reprogramming via bootloader, but it really didn't help at all.
  2. Code space. I had ideas for other code to write, but couldn't shoe-horn it in place.
  3. Power. Up til now, I'd been running everything directly off of a CR2032 battery. The lights dim as you play; I kept looking for LEDs that ran at lower voltages to get the brightest possible experience. It felt like a race to the bottom.
  4. Improvement of the Tamagotchi and social aspects. These existed, but didn't really feel like part of the experience.
  5. More knowledge about SMT LEDs. I picked some basically at random for the charlieplex display, and needed to understand more about available parts.
  6. More (some!) experience with reflow soldering. I'd been soldering these together by hand, and knew that wouldn't scale up to the hundred badges I wanted to produce.

LIWho 2022 came and went (and we did not attend), so I set my sights on solving all of those things for the 2023 con.

January, 2022: an ESP8266 prototype. Space for two batteries (or a AAA battery pack) on the back, and the ESP-12F mounted on the back as well. The first prototype where I tried out SMT switches.

At the top is a boost supply, built around the MCP1640. I knew the ESP-12F would need a more stable supply to work well, and as a bonus it got me bright LEDs through the battery's full life. (I also replaced the mono-colored LEDs with different colors by area - white at the top, blue on the right, yellow on the collar, and green down the skirt. Because why not?)

First ESP-12F prototype

This certainly had a ton of programming space, and the possibility of direct Wi-Fi communication with centralized APIs. I thought a little about switching to an ESP32 to use BLE for badge-to-badge communication, but wanted to tame the battery life issues first: this thing was a monster, and needed at least AAAs to run for any significant period. Even with WiFi disabled, I never got close to the runtime I needed: at least 3 days, 4 for safety. (My best efforts got to about 20 hours if I remember correctly.) The biggest problem was that, without an external interrupt, I couldn't wake from deep sleep. I did design an external interrupt prototype which sort of worked, and might have gotten to the power consumption I wanted, but the parts cost really started to skyrocket.

Now, I've not mentioned the half a dozen changes while playing with the three boards I got in that order - reducing current usage by swapping resistors; trying different kinds of LEDs; playing with different serial port configurations. With the 12F it still wasn't really fixing any of the problems except for storage space. I just had new vast areas of potential problems. Combined with the increasing cost, I decided to put the whole thing down for a month.

When I picked it back up, I hacked in an ATTiny-1606. The first step is always getting the Charlieplex LEDs running, so here you can see the color LEDs doing their thing:

(As a quick aside: this isn't as insane as the first ESP-12F test I did, which held the 12F on with a dozen enameled wires. It was a total mess, but proved that I'd be able to run a 12F before I spent money on prototype boards.)

There wasn't much to change from here, though - it worked, and was substantially like the original '84a board. The biggest improvement being that the more modern programming interface ("UPDI Serial Programming") is a 1-pin affair that has full debugging capability - which means that I could do away with the whole docking protocol, and have the dock put the chip into debugging mode. And better noise immunity.

This was it - I felt like I might actually be close. And in hindsight, I was right on top of it. I replaced a couple of SMT parts with bigger packages to make assembly easier; changed the silk screen; and with a swap of the processor, this prototype is exactly the same as the final version.

Dalek Agatha, before she got her name