Little Box of Christmas

A good while ago, I made The Little Box of Poems. This is a box that prints a random poem every time you push a big red button. Inside is an Arduino microcontroller and a thermal till roll printer, and it inspired Carrie Ann Philbin’s Little Box of Geek. (I also made a Raspberry Pi-powered version too.)

As it’s Christmas, I’ve decided to make a seasonal version. This one prints really bad, random Christmas cracker jokes:

Here’s how to wire it up:


And here’s the Arduino code – it’s based on the Poem code, so the variables have rather odd names. If you want to find out how to add bitmap graphics, like my Christmas tree, Adafruit have a guide here. I used Photoshop and Processing to make mine.

 Little Box of Christmas
 by Giles Booth

 not for commercial use
 if you modify this code for edcuational or charitable use
 please credit Giles Booth and/or @blogmywiki in printouts

const int buttonPin = 2;     // the number of the pushbutton pin - doesn't change
int currState = 0;           // set variables to hold the state of the button
int prevState = 0;

#include "SoftwareSerial.h"
#include "Adafruit_Thermal.h" // you need to download this and put it in your Arduino library
#include "tree.h"              // Christmas tree picture
#include <avr/pgmspace.h>     // I have no idea what this does

int buttonState = 0;     // variable for reading the button status
int printer_RX_Pin = 5;  // This is the green printer wire
int printer_TX_Pin = 6;  // This is the yellow printer wire

Adafruit_Thermal printer(printer_RX_Pin, printer_TX_Pin);

void setup() {
  pinMode(buttonPin, INPUT);
  Serial.begin(19200);   // this is the baud rate of your printer - may vary
  pinMode(7, OUTPUT); digitalWrite(7, LOW);

void loop(){
  // read the state of the button:
  currState = digitalRead(buttonPin);
  if (currState != prevState)   // if something has changed, do something
  if (currState == HIGH) {
  else {
    // if you want something to happen when the button is released, put it here
    // such as a beep, or a display saying 'your poem is on its way'
prevState = currState;

void printPoem(){

  // put greetings here  
  char* myTitles[]={"Merry Christmas!","Happy Christmas!","Season's Greetings!","Joyeux Noel!","feliz navidad!","God jul!"};
  // put 1st lines of joke in here
  // they must all be on the same line, in double quotes, separated by commas
  // use \n for a new line and \" to escape a quotation mark
  char* myPoems[]={"What does Santa suffer from\nif he gets stuck in a chimney?", "What kind of motorbike does\nSanta ride?", "Who delivers presents\nto cats?",
"What never eats\nat Christmas?", "What's brown and sneaks\nround the kitchen?","What do you get if you eat\nChristmas decorations?"};

  // put punchlines here in order
  char* myAuthors[]={"Claustrophobia!","A Holly Davidson!","Santa Paws!","Turkeys - they're\nusually stuffed!","Mince spies!","Tinselitis!"};

  int poemChoice = random(7);  // choose a random poem number between 0 and 6


  printer.printBitmap(tree_width, tree_height, tree_data);    // print Blog My Wiki logo    
  printer.println("The Little Box of Christmas");
  printer.setSize('S');     // Setting the size adds a linefeed
  delay(2000);   // 2 second pause to help prevent multiple presses     
Posted in Arduino | Tagged , | Leave a comment

Can’t afford a Hemingwrite? I have an idea…

I LOVE the idea of the Hemingwrite. It’s like a portable typewriter that allows you to write distraction-free whilst still saving your work electronically and backing it up online. It has a proper keyboard and – crucially – an eInk display (like Kindle or Nook electronic book reader) so you can use it outdoors in bright sunlight, and save power.

I love it. I want one so much it hurts, but I can’t afford one (though I did chuck $5 at their Kickstarter because I think it’s such an incredibly great idea). So I got thinking – how about making my own? Initially I thought – RaspberryPi. But eInk displays are hard to find – Adafruit’s are tiny and expensive for the size. Then I remembered my rooted Nook. This £29 e-reader can, it seems, be modded to work with a USB keyboard. I’ve not done it yet, but at the very least I could use this with an existing Android simple word processor. Or – and I know nothing at all about developing Android apps – a simple word-processor that backs up into the cloud… a cheap & cheerful British alternative to the Hemingwrite – the WoolfWrite!

Somebody has an even more cunning idea, however…

Posted in Android, computers, literature | Tagged , , , | Leave a comment

Zeros and Ones, episode 10 (or 2).

Posted in Uncategorized | Tagged | Leave a comment

Zeros and Ones

Posted in Uncategorized | Tagged , , | Leave a comment

The Imitation Game vs Enigma

Bit late to this but finally saw The Imitation Game this weekend. Really rather disappointed – I think Enigma (also about breaking the same cipher in Bletchley Park in WW2) is the better film. I just wasn’t convinced by the awkward friendship between Turing and Keira Knightly’s character. The scene on the lawn where she says something like “I think you’ll find if you move those equations over here…” was worthy of Acorn Antiques at its cringiest. Although based on a work of fiction, rather than fact, Enigma‘s central relationship, also awkward, is more believable and just rings true.

Charles Dance’s cartoon commander could have marched up to Turing’s machine and said “I want that machine orf, and I want it orf now” in an homage to The Hitch-Hiker’s Guide to the Galaxy. I can imagine one of Turing’s colleagues tearing off a strip of paper tape, turning to the camera and declaring “FORTY-TWO? We are going to get lynched…”

The real star of The Imitation Game is Alex Lawther. His portrayal of the schoolboy Turing was stunning. A great future surely lies ahead for this amazing young actor.

I understand why they skipped over the real electronic computer Colossus, built at Bletchley Park to break tougher German codes, but there’s a cracking story to be told about the unassuming Post Office Engineer Tommy Flowers who built it. He too can claim to be the father of the digital computer.

And finally, the last word on Charles Dance:

Posted in cinema, computers | Tagged , , | 1 Comment