Shitty Amateur Electronics - Part 12: The Conference Mood Badge

After making my standalone Arduino board and realising that the Arduino is overkill for most applications I started to look into more specialised, smaller chips. It's not surprising that the ATMega328 chosen for the Arduino is so overpowered though, as it's meant to be a teaching platform, to do many things at once, to introduce people into concepts. There's a lot of memory and flash RAM and the Arduino infrastructure makes things nice and easy for you.

I'd had a few ideas for some stupid little gadgets that would run on the smaller ATTiny chips after looking around the internet for some ideas and inspiration. Something arty, maybe a little silly? But also... maybe useful? I ended up going down the rabbit hole of reading about conference badges. Not the OTT types that DEFCON make though - those were out of my league. But a simple thing with some lights and buttons on it? That's doable. I quickly settled on the idea of making a kind of "Mood Badge" to let people know what you were at the conference for or how you were feeling. The form factor was small and the design could be really simple.

I ended up sketching out some ideas in, of all things, MSPaint. You use what you have to hand. The idea would be to have 3 LEDs (red, yellow, green) and indicate whether you wanted to talk to people, to be left alone, or whether you were with friends. There'd be a single button to toggle between the three. The battery had to be small enough to keep the battery light and relatively flat. There had to be a hole for a lanyard. And finally, a switch to turn it on and off to save the battery. It looks quite nice - not very complex but it doesn't need to be.

Interestingly, I approached this project a little differently than I think you're supposed to. I designed the schematic and PCB before I had even written a single line of code, rather than breadboarding it and writing some code and *then* testing it. I could only really do this because the circuit was so simple. ATMegas require a power and a ground - that's it, assuming you're using the internal oscillator. And I can for this project - accuracy of timing is not required in any way. You can see the lines out to the button and the LEDs (through resistors - the button uses an internal pullup in the IC). There's a small decoupling capacitor for the IC, and a larger smoothing capacitor next to the battery.

Battery life was a consideration, of course. I wanted this thing to last a fair while, and that is another reason for using a small IC as opposed to a larger one. There'll be more on battery life as we look at the code on the badge, but for now I can say that I tend to run LEDs a little less brighter than most, and with a 3.3V supply I settled on 330 Ohm resistors, which kept them bright enough to be seen in a dark hotel bar at a conference.

I had a fair idea of how I was going to lay this out by now so I just went straight into making the PCB and getting it sent off to JLCPCB for fabrication. I decided on the standard CR80 card size, just on the off chance it'd fit into some kind of holder. I tried to place the components on the back of the badge in such a way as to not be in the way much on the front. You'd need to put a label or sticker on the front, or wipe with chalk or those weird wipe-off pens. For the battery we're going with the standard button-type CR20xx batteries, so if you want a thinner badge you can go for a CR2020 or CR2016 (same diameter, just shorter when laid flat). The battery placement is suboptimal. Those things are heavy and having the clip on one side makes it hang at an angle. Something to fix for v2.0? I also dropped a capacitor that was a bit overkill.

With the boards arriving on my doorstep two weeks later (cost me about a tenner for 5 boards shipped) it was time to turn my attention to the code. I just wrote this blind before I even made up the circuit on a breadboard, but I got it all working just fine with an Arduino Uno. Like, the only issue was a change to the button code to stop reading it when it clicks back up as well as when you push it down. I was feeling pretty confident about it all, so I placed an order for some battery clips and some ATTiny85s and breadboarded it up with one of those as well. Still worked.

With that I was feeling confident enough to solder one together - and it didn't work. I thought the chip was dead. I tried to desolder it. I broke it off. Into the graveyard with that board, saved for memories and stories later. So I flashed a second chip and soldered that together instead - that worked fine. I think I wasted £1 on an IC and broke a PCB that was working fine and just had a bad solder joint. Woops. Still - progress.

One other issue I fixed was a track I stupidly left connected in the wrong place. Nothing a quick breaking of the track wouldn't fix, though. I was stoked when it all lit up.

I'll go through at the code in the next blog and also talk about picking the right chip for the job, plus talk a little about the addiction to code optimisation that I developed while thinking about just how small and cheap I could make everything.

Comments