Mood Badge

This is my first PoC for the BSides London 2019 badge - a Mood Badge. This page is a placeholder as the writeup will be long, as the road to this was long, winding and full of surprises and some magic smoke. But it’s all about the journey! I will tweet them out as they come…

TL;DR: What is it?


That is: the Bill of Materials, top row from left:

Mainboard row:

Bottom row:

Plus one assembled BSides London 2019 badge. I do not have any deal with Adafruit, they just make cool things with Arduino libraries on which I have a lot to say but that will come later.

The idea and theory of operation (not quite practice, it’s a PoC after all!)

Mode 1

You may be aware of a fantastic (for people like me who are not really good at this whole talk-to-people skill) thing becoming popular with (infosec) cons: you can tag yourself with a coloured tag (I’m sorry but I’m not sure whose idea this was, I will update it when I find out):

I thought, therefore: how about being able to switch the tags during the day? I might feel okay for the first hours and then just want to hide away (and that is me, every time). The badge can, then, display three colours and you can switch between them at will.

Second thing, quite important for, again, people like me: personal space. The badge will start flashing when you get too close to me (~400mm in the current version). To save the battery, it will also dim the matrix as you move away from me in 15 brightness steps until around 1200mm when it switches it off.

Mode 2

You might sometimes want to extend beyond the green colour, destroy all OPSECs and just should HELLO IT’S ME to everyone. In this mode, the badge will scroll “Meadow BSidesLDN2019 Ellis”, in two colours - because why not.

Mode 3

The air can get stuffy on cons, for various reasons and with various things. In this mode the badge will use the gas sensor to measure the air quality (or an approximation of, it’s not calibrated) and display the result in the range of 1-24 on the LED matrix using three colours, one line per one value: green 1-8, yellow 9-16, red 17-24.

Mode switching

The first idea was to use the gesture sensor: it can sense up-down and left-right movements, so it can switch colours and modes… but the library leaves much to desire so had to drop it and use the momentary switch. It’s not the best idea as the badge and the sensor itself is picking a lot of noise - it works fine on my desk but when I’m wearing it it has a life of its own. WiP!

How do we switch between colours and modes though using one switch? Rotating them is not ideal as displaying text takes few seconds, and it’s really bad UX - yes, it’s a PoC but that doesn’t mean it has to be annoying. But we have three ‘modifier keys’ available:

How? The distance measurement is running all the time, so we have one variable that has three states available to modify the touch sensor function. You ‘use modifier keys’ then by adjusting the distance the badge is measuring by pointing it at various things and touching the sensor. So:

The software

…has been in my head for the past three weeks, but was written on Sunday evening and through Monday so it’s quite horrible - but I will make it better before showing it :)

I have used Adafruit libraries for the sensors and the matrix; gas sensor is just a voltage output so that is analogRead() with some scaling, touch sensor is digital output so that’s digitalRead() with some debouncing. I have made up my own bargraph function as Adafruit has one… but not for this display so had to patch something together, quick and dirty.

If you feel intimidated by all this - please, don’t! I will explain everything, this is just a quick overview.