Skip to main content
Electronics and hackery

Reverse swear box

By July 18, 20165 Comments

Most swear boxes work the wrong way round: you say something naughty, then you have to put money in the box as penance. This is the opposite – press the button and this device generates a random swear word for you to use in conversation at your leisure. Technology, eh.

It’s not a new idea: a few years ago I came across this beautiful “Four Letter Word” clock made with delicious old fashioned nixie tubes:

flw1

Designed and built by Jeff Thomas, Peter Hand, and Juergen Grau. More information here.

I wanted to make something quick and simple as a birthday present for a friend, and I had four little LED starburst displays sitting in a box, so some sort of random word dispenser seemed like a good idea. Designed a quick circuit in Eagle:

Screen Shot 2014-05-20 at 07.36.07

Download schematic and layout: FourLetterWord

The schematic in Eagle is pretty messy and tangled. I often find that if I’ve got loads of connections to make to a microcontroller, it’s not until I’m laying out the board design that I can see the way things should be connected.

This is the perfect example: I’m connecting two identical starburst displays to the microcontroller in a multiplexed fashion. In an ideal world you’d connect the anodes of the displays together, segment A to segment A, seg B to seg B and so on, leaving just the cathodes of each digit to be connected separately. This makes the software a little simpler – pin D3 (say) on the microcontroller controls the same segment on all the digits:
Screen Shot 2014-05-20 at 08.06.23

On a single sided PCB, though, routing the connections like that gets really tricky – you end up with loads of connections that have to jump over others so they end up on the right pins.

The alternative is to design the circuit so it’s easy to route (even if that means segment A on one display is connected to segment F on the other etc) and then sort it all out in the software.

Screen Shot 2014-05-20 at 08.06.36

Hence the relatively neat looking PCB design:

Screen Shot 2014-05-20 at 07.36.25

Note that there’s an error in the design / layout – I didn’t realise until too late that two of the microcontroller pins I wanted to use (A6 and A7) wouldn’t work as digital pins, so I had to use some wires to connect them to some free pins on the other side of the controller. Live and learn.

HFLW-IMG_0219

With the PCB milled out and populated, I hacked a rectangular hole out of a random wooden box I had knocking about, and stuck a switch and a button on it, and squished a bit of foam and a CR123A battery holder in.

HFLW-IMG_0223

CR123A batteries are great for this sort of project – they only run at 3 volts, but that’s enough to drive LED displays without needing to add current limiting resistors. Helps that the display is multiplexed, too; though it looks like all the displays are lit up simultaneously, they’re actually taking turns, one digit at a time. Stops the LEDs from burning out – at most they’re on for 25% of the time.

The software’s pretty simple – there’s a list of about 45 swear words chosen at random. Proper randomness isn’t easy for a microcontroller (or a computer) to do on its own, so I measure how long the user has pressed the button, in microseconds, and use that value to help choose a word.

HFLW-IMG_0227

Press the button and an animation sweeps across the display, with each letter of the word coming up one at a time like a fruit machine.

HFLW-IMG_0216

HFLW-IMG_0233

Download software: FourLetterWord-Arduino code

It’s surprisingly hard to come up with lots of 4-lettered obscenities, so there are some strange ones in there. My favourite is “MILK”…

5 Comments

Leave a Reply to Reverse Swear Box Curses (For) You | BH Cancel Reply