Sunday, July 23, 2017

Electronic Puzzle - Light Up Numbers

Completed Lighted Number Puzzle
Completed Lighted Number Puzzle

I created a puzzle that required finding the correct large (~12") numbers and placing them on the correct spots on a base. When put in the proper position, the numbers stood and lit up. I made these from some lighted numbers I found on sale at a craft supply store. The numbers included the lights and small battery packs. I cut one wire in the light circuit and put a reed switch in-line with the wire. A reed switch will allow electricity to flow when it is very close to a magnet.

Close-up of Reed switch
Close-up of Reed switch taped on bottom of number

I created a base from a small piece of wood and mounted magnets in certain spots on the bottom of the board to line up with the location of a number's reed switch. I also added another magnet for each number position that match one mounted near the from of the numbers. This pair would hold the number in place. I also weighted the backside of the numbers so they would not stand up if not held by the magnets.

I included an extra number in the room that did not light up so it would be harder to just guess the three digit combination.

It took some trial & error to find spots for the reed switches and magnets that would only activate for the correct number. This was not exact, and if you just placed the number over a magnet it would light up. In testing, some people laid the numbers on the board. I added a clue to the bottom of the base to hint that the numbers should stand up.

Electronic Puzzle - Button Box

Button Box Puzzle

I created a puzzle that required the player to push a series of colored buttons in the correct sequence to unlock a small door. I built it inside a small box with a hinged cover and latches. The inside contained four buttons - red, green, yellow and blue. Also an eight LED strip; buzzer and power switch.

The unit was controlled through an Arduino in the bottom of the box. The four buttons and the power switch were inputs and the buzzer, LED bar and door latch (servo motor) were outputs. Because of the servo motor I decided to use a plug for the power instead of batteries. I put a small hole in the back of the box and pushed the jack for the plug through there to connect to the Arduino.

inside of button box, wiring
Guts of Button Box

I stumbled upon State Machines when researching the best way to program the multiple steps to complete the game. The state machine has defined states, like having pressed 1 correct button, and a set of defined next possible steps - push another one button. That step determines which next state to move into. Not really doing it justice, but there are great online resource for using in programming and Arduinos.

I used the 'Switch and Case' commands for the implementation of my states. Below is the Arduino code used for the button box project.

Arduino Code

#include "musical_notes.h"  //Lib of sound effects
#include <Servo.h>  // servo library

#include <Adafruit_NeoPixel.h>  //used for setup & cntl of NeoPixel LED light bar
#ifdef __AVR__
  #include <avr/power.h>

#define PIN 10  //LED light bar pin

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);

//various states for program to be in
const int s_gameOff = 0;
const int s_gameOn = 1;
const int s_1Correctbtn = 2;
const int s_2Correctbtn = 3;
const int s_3Correctbtn = 4;
const int s_4Correctbtn = 5;
const int s_lose = 6;
const int s_win = 7;
const int s_won_open = 8;

const int redButton = 2;
const int greenButton = 3;
const int blueButton = 4;
const int yelButton = 5;
const int onSwitch = 6;
const int pwrLED = 8;
const int buzzer = 9;
const int ledBar = 10;
const int door = 11;
int rainbowOnce =0;
int servoOnce =0;

Servo servo1;  // servo control object

void setup() 
  Serial.begin (9600);  //setup serial monitor for troubleshooting
  pinMode(redButton, INPUT);
  pinMode(greenButton, INPUT);
  pinMode(yelButton, INPUT);
  pinMode(blueButton, INPUT);  
  pinMode(onSwitch, INPUT);
  pinMode(pwrLED, OUTPUT);  
  pinMode(buzzer, OUTPUT); 
  pinMode(ledBar, OUTPUT);
  strip.begin();; // Initialize all pixels to 'off'

void loop()
  static int state = s_gameOff; //start program in game off state
  Serial.println(state); //serial monitor print of program state
  switch (state)
    case s_gameOff:
      digitalWrite(pwrLED, LOW);  //set power LED off
      digitalWrite(buzzer, LOW);
      noTone(buzzer);              // shut off buzzer
      if (servoOnce == 0)  {
        servoOnce = 1;
      if (digitalRead(onSwitch) == LOW) {   //when power switch turns on, set program state to s_gameOn
        state = s_gameOn;
    case s_gameOn:
      digitalWrite(pwrLED, HIGH);   //turn on power LED
      colorWipe(strip.Color(0, 0, 0), 50); // off
      if (rainbowOnce == 0) {  //show a rainbow effect on LED strip once at start of game
        colorWipe(strip.Color(0, 0, 0), 50); // off
        rainbowOnce = 1;
      if (digitalRead(redButton) == LOW) {  //check for first button pressed and set program state as needed
        state = s_1Correctbtn;
      else if ((digitalRead(greenButton) == LOW) || (digitalRead(yelButton) == LOW) || (digitalRead(blueButton) == LOW)) {
        state = s_lose;
    case s_1Correctbtn:
      strip.setPixelColor(0,255,0,0); //turn 1st LED to red, indicates correct button color pressed
      strip.setPixelColor(1,255,0,0); //turn 2nd LED to red;
      if (digitalRead(greenButton) == LOW) { // check for second button pressed and set program state as needed
        state = s_2Correctbtn;
      else if ((digitalRead(redButton) == LOW) || (digitalRead(yelButton) == LOW) || (digitalRead(blueButton) == LOW)) {
        state = s_lose;
    case s_2Correctbtn:
      strip.setPixelColor(2,0,255,0);  //turn 3rd LED to green
      strip.setPixelColor(3,0,255,0);  //turn 4rd LED to green;
      if (digitalRead(blueButton) == LOW) { // check for third button pressed and set program state as needed
        state = s_3Correctbtn;
      else if ((digitalRead(redButton) == LOW) || (digitalRead(yelButton) == LOW) || (digitalRead(greenButton) == LOW)) {
        state = s_lose;
    case s_3Correctbtn:
      strip.setPixelColor(4,0,0,255); //turn 5th LED to blue
      strip.setPixelColor(5,0,0,255); //turn 6th LED to blue;
      if (digitalRead(yelButton) == LOW) { // check for fourth button pressed and set program state as needed
        state = s_win;
      else if ((digitalRead(redButton) == LOW) || (digitalRead(blueButton) == LOW) || (digitalRead(greenButton) == LOW)) {
        state = s_lose;

    case s_lose:  
    closeEncounters();  //plays lost sound effect
      state = s_gameOff;  //set program state to s_gameOff
    case s_win:
      servo1.write(0);    // Tell servo to go to open position
      strip.setPixelColor(6,255,255,0);   //turn 7th LED to yellow
      strip.setPixelColor(7,255,255,0);   //turn 8th LED to yellow;
      squeak();    //plays winning sound effect
      state = s_won_open;
   case s_won_open:
      digitalWrite(pwrLED, LOW); //turns off power LED

// sound effects programming
void beep (int speakerPin, float noteFrequency, long noteDuration)
  int x;
  // Convert the frequency to microseconds
  float microsecondsPerWave = 1000000/noteFrequency;
  // Calculate how many HIGH/LOW cycles there are per millisecond
  float millisecondsPerCycle = 1000/(microsecondsPerWave * 2);
  // Multiply noteDuration * number or cycles per millisecond
  float loopTime = noteDuration * millisecondsPerCycle;
  // Play the note for the calculated loopTime.
  for (x=0;x<loopTime;x++)   
// sound effects programming
void closeEncounters() {
          beep(buzzer, note_Bb5,300); //B b
          beep(buzzer, note_C6,300); //C
          beep(buzzer, note_Ab5,300); //A b
          beep(buzzer, note_Eb3,700); //E b      

void squeak() {
  for (int i=100; i<5000; i=i*1.45) {
  for (int i=100; i<6000; i=i*1.5) {
//rainbow light effect on LEDs
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);;

Monday, July 17, 2017

My Second DIY Escape Room - Puzzle Master

Escape Room Layout
Escape Room Layout

I recently completed my second DIY escape room. After the cool feedback and interest that I got from family about the first room, I quickly decided to make another one. This time I set it up in a different room in the house. I used my office area. It had some existing furniture that made it easy to incorporate into the new escape room. The basic layout of the room is a bookcase, small filing cabinet, desk, computer, printer, folding table and closet. Some of the puzzle clues and props include large lighted numbers, a few books, a hockey stick and thin piece of wood.

After writing these posts about all the steps and techniques that I had learned about creating a DIY escape room, I ignored most of them! I quickly came up with several puzzles that I wanted to use. A few puzzles would be more electronics based and I was interested to put the idea into place. So, needless to say, I did not come up with a good story for the room. After a couple of days I just decided that the story would be the players came back to challenge the puzzle master. I really wish I had come up with a better story, pretty weak. As I had mentioned before, I feel you get a lot more leeway with DIY escape rooms, but that should probably not be relied on as a crutch. I'm already planning my next room and it has a much better story line.

Button Box
Button Box
 I would say that the overall game plan is a few linear paths, where a clue leads to a puzzle and that puzzle's solution unlocks more clues for other puzzles.

Sudoku - Paper puzzle with certain blocks with symbols to indicate these numbers are for one of the locks.
Button Box - A box with four colored buttons, a LED light bar, and a locked door. Figuring out the order of pressing the buttons will unlock the door and provide a letter combo for a lock.
Light Numbers - Several large numbers are scattered around the room, including some inside a locked closet. A base with #? in three places is laying on a table. When the correct number is placed in the correct spot its held in-place with magnets and lights up. The number sequence is another lock combination.
Scytale - A hockey stick with a hook attached to the stick's top and a strip of fabric with a series of letters/symbols. Once the strip is attached to the stick and wrapped around the hockey stick it will provide the password to login to a computer.
Scratch Programming - Once computer is unlocked it contains a link to the Scratch programming software with a partial program open. It has a basic maze with a key in its center. A quick-start guide and notes tell players to finish the code so the Scratch Cat gets the key. It will then indicate that the directions to get to the key is also the combination for a directional padlock.

Lighted Numbers
Lighted Numbers


The basic flow of the game is as follows. Start outside the main room, where there are three similar doors, each with a color. Select my favorite color (green) and open that door to proceed in the game. The other doors have a Wrong! sign hanging inside. Once in the room, a Sudoku puzzle sheet prints out. Solving the Sudoku puzzle gives the closet door lock code. A search of the room finds a key taped under a table. The key unlocks a file cabinet, containing Scratch programming guide and the button box.
Opening the closet door reveals two large numbers and a piece of fabric with letters. Combining all the large numbers and the number base reveals that 3 of the four numbers will light up on the base. These numbers unlock one of three locks on the exit door.
Plugging in and opening the button box shows four colored buttons, LED light bar, power button, buzzer and small door. Notes inside indicate correct code will unlock door. After flipping the power switch, and pressing a correct color it will light up 2 LEDs in the bar. Pressing the other three buttons in the correct order will finish lighting the LEDs, play success tones and unlock door. This shows the letter combo for an exit door lock.
Correctly wrapping the strip of fabric from the closet around the hockey stick will reveal the computer password. Once entered, the computer will show only one icon - Scratch. Opening this displays a maze and partial coding. Finishing the coding will change the program's background image to note that the maze's direction solution is the combination to the directional lock on the exit door. This removes the final lock and the player has escaped!

Lessons Learned

I would say the biggest lesson learned from this DIY escape room was do several play tests/beta tests. I had two of my nieces (high school & college age) try out the room first. This got me really good feedback on the puzzles - which were to time-consuming, others that failed to operate. I tweaked the room to account for this. Things like creating a more filled out Sudoku puzzle and more instructions on button box. I then invited others over to go through the room and they showed some new 'gotcha' spots in the room. I did not make further changes though as the players wanted to complete for time so I gave them all the same game play. 

This further showed me that my interpretation of the puzzles is definitely skewed since I designed them. Here are a few of the changes that would have improved the room.
  • Better associate the cloth and hockey stick for the Scytale puzzle. Maybe add colored tape to cloth and wrap stick handle in the same tape.
  • Block file cabinet draw sides. The file cabinet locked its bottom draw to its top, so that they could both be pulled out togther when locked. This exposed the side of the bottom draw which allowed you to see (and take) the button box without unlocking the draw.
  • Revise Scratch printed tutorial so it only contains needed steps. Extra info was confusing.
  • Scan room for unintended items. One team found a bent paperclip and thought it was to pick one of the locks. It was not and is now broken inside the lock.
  • Story-line, story-line, story-line.

Saturday, July 1, 2017

Escape Room Inspired Kids Scavenger Hunt

After my first DIY Escape Room, my five year old niece asked for another one that she could do. Though she did go through the escape room, most puzzles were a little advanced for her and her younger sister. So I created several puzzles that I could easily setup at their house. I will provide details on the puzzles and tasks that I created. Here is an overview of the scavenger hunt.

The hunt was Finding Nemo/Dory themed. I designed it for one player at a time. I also had an older niece help the player understand the tasks. Most of the puzzles were laid out in a couple rooms with most not requiring a solving order. There was a 'treasure chest' that required solving another puzzle and that provided the key to the chest (and the ring pop prize). Also, for solving each of the puzzles the player received a piece for the last puzzle. I created a score card with each puzzle on it and the helper would check off each one as it was solved.


Match Game - Match characters from one column with names in another
Go Fish - A bowl of water with pieces in the water and a fishing rod with an attached magnet
Large 3D Box Puzzle - Took pieces of themed fabric and glued it onto different sized cardboard boxes. The boxes then were placed around the room. See finished puzzle in main picture.
Online Jigsaw Puzzle - Created a jigsaw puzzle online, using Jigsawplanet .
Seaweed Maze - Used different colored paper streamers to make seaweed hanging around a doorway
Coded Message - Created a substitution code using sea creature images and wrote coded message. See below.
Plastic Puzzle Pieces - Player got pieces of puzzle during hunt. Once all were collected, matched pieces to puzzle solution card. Finished puzzle gave combination to a lock that then provided the key to treasure chest
Jigsaw Puzzle - Large pieces puzzle of Dory characters

Sea Creature Substitution Alphabet
Substitution Alphabet

Coded Message
Coded Message

Scavenger Hunt Puzzle List
Scavenger Hunt Puzzle List

Thursday, May 11, 2017

Computer Monitor on/off with RFID Card

One of my locks (I guess that is the best category for it) was an electronics device that would turn on the computer monitor when an ID card was put on the receiver. This post will detail how this was made.

Completed RFID Reader
Completed RFID Reader

Arduino Uno Microcontroller
Velleman 4 Channel Relay Module (part # VMA400)
Velleman RFID Read/Write Module w/ RFID card and FOB (part# VMA405)
Jumper wires
12 Volt power adapter
4" Square Electrical Box
4" Square Box Cover with Rectangular Hole

If you have not heard of an Arduino microcontroller before, it is a small device that can be programmed to control and interact with physical things like LEDs, switches, motors, speakers and relays. Their are tons of online resources and many add-on kits and beginner sets. Velleman makes many nice and inexpensive add-on modules.

Three Modules Laid Out
Three Modules Laid Out

The basic operation of the device is that the Arduino monitors the RFID module signal and when that module senses a RFID device with the correct address it will signal the Arduino. Once this signal is received the Arduino will operate one of the relays on the relay module. The relay will only be activated for a second. The relay output contact was connected to the power button on the monitor. So the closing and opening of the relay acted like the pushing of the power button. The relays are rated up to 250VAC so they could also be connected to the main power of the monitor, but I felt it was safer to work with the low voltage control power instead of the main power.

RFID Module and Card
RFID Module and Card

I used the example code Velleman provides on their site for both modules as a base for my project code. You should review their write-up on the code and module. It explains how to determine the address for your RFID unit and adding it to the code. The RFID controller connects to the Arduino's ground, 3.3V (important not to use 5V pin) and 5 I/O pins. I used pins 9-13 as described in the Velleman example code. The relay module connects to ground, 5V and one I/O pin (I used pin #8). I will post the code at the end of this post.

Using the relay module for this device was probably excessive as I am just operating one device, but I already had the module. I could have used a single small relay. I'm not sure if using an Arduino output with a transistor would have worked. I did not experiment with that.

To access the power button on my monitor I had to remove the monitor's plastic case and temporarily remove the small circuit board that had the controls. I then had to confirm which points near the power button were the connections for the button. I did this by using a multi-function meter on its continuity setting and checking for the sound when the button was pressed. The connection points were pretty small and soldering to them was a challenge. I forgot to take pictures of this process.

Once I had the programming complete and everything working well, I put it together to fit inside the electrical box. I used Velcro to get the modules to all stack onto each other and the jumpers taped along the outside. I made sure the RFID module was on top as the card needs to get very close for it to recognize it. An advantage to the electrical box is that it has pre-made knock-out holes that I used to get the power and monitor wires through. A disadvantage to the box was that it is metal, so I lined the cover with tape in case it might touch the top module and cause a short.

The relay board has a small LED that lights when a relay is operated. I taped a clear marker cap over this so that it would shine through the top of the box. I then printed a picture of a commercial RFID reader and taped it on top of the electrical box. I added a small hole for the relay light to come through.

This project could be modified for many other applications in an escape room. The relays could unlock things or activate lights, sounds when one object is put close to another. There are also loads of other Arduino based projects for escape rooms all over the internet.


* edited by Velleman / Patrick De Coninck
* Read a card using a mfrc522 reader on your SPI interface
* Pin layout should be as follows (on Arduino Uno - Velleman VMA100):
* MOSI: Pin 11 / ICSP-4
* MISO: Pin 12 / ICSP-1
* SCK: Pin 13 / ISCP-3
* SS/SDA (MSS on Velleman VMA405) : Pin 10
* RST: Pin 9
* GND: GND on Arduino UNO / Velleman VMA100
* IRQ: not used

#include <SPI.h>
#include <RFID.h>

#define SS_PIN 10
#define RST_PIN 9


int power = 7;   // pin not used
int led = 8;       // pin output to relay #1
int serNum[5];
* This integer should be the code of Your Mifare card / tag
int cards[][5] = {{252,10,240,82,84}};

bool access = false;

void setup(){

* define VMA100 (UNO) pins 7 & 8 as outputs and put them LOW
    pinMode(led, OUTPUT);
    pinMode (power,OUTPUT);
    digitalWrite(led, LOW);
    digitalWrite (power,LOW);

void loop(){
            Serial.print(" ");
            Serial.print(" ");
            Serial.print(" ");
            Serial.print(" ");
            for(int x = 0; x < sizeof(cards); x++){
              for(int i = 0; i < sizeof(rfid.serNum); i++ ){
                  if(rfid.serNum[i] != cards[x][i]) {
                      access = false;
                  } else {
                      access = true;
              if(access) break;
           Serial.println("Welcome Velleman ");
* Valid card : Switch ON the LED for 1000 ms (1 second)
           digitalWrite(led, HIGH);
* Valid card : Switch ON the POWER PIN for 2000 ms (2 seconds)), the POWER PIN can activate for example a relais, controlling a doorlock)
           digitalWrite(power, HIGH);
           digitalWrite(power, LOW);
           digitalWrite(led, LOW);
           access = false;
      } else {
* NON-Valid card : switch ON and OFF the LED twice for 0,5 seconds
           Serial.println("Not allowed!");
           digitalWrite(led, HIGH);
           digitalWrite(led, LOW);
           digitalWrite(led, HIGH);
           digitalWrite(led, LOW);        

Thursday, April 27, 2017

Lessons Learned

Design and Setup
  • Come up with the storyline or concept first. Don't think of the puzzles and then try to make a story for them to fit into. You can brainstorm on puzzle and lock ideas but then put that aside while you create the story.
  • Camera in room if possible. I did not have a wireless camera or webcam to use in the escape room and so I would go in periodically to check in. Being able to watch the teams work thru it is a lot of fun, so a camera would be helpful.
  • Use a game clock. I did not have one inside the space, so I synced time with the teams when they started and gave 15 minute time updates. I think an in-room game clock would have been better. 
  • Try to have puzzles match the theme and fit into the storyline. Some of the puzzles I used were probably not a good match for the general storyline. Like why/how a Scrabble game was in a room associated with a kidnapping. I do feel that this is an area where as a DIY escape room players are going to pay less attention to that level of detail.
  • Be careful with red herrings. Using them can frustrate players as they waste time and obviously have no solution. In future rooms I'll probably only have additional props but nothing like the pucks. One alternative that I've seen is to have the red herring "solve" with a clear message that its a fake, like a blacklight message "No clue here" 
Game Play
  • Don't make your puzzles too slick or tricky. Most players were too respectful of the space and did not move, pick-up items, especially on the walls. Also notes about do/don't for an object made them ignore that object
  • Start with puzzles and clues more obvious and then make them more hidden/subtle after testing. I ended up leaving one item out in the open after two groups did not find it inside a book.
  •  Test, test, test puzzles, locks and clues - especially tech ones. I did not have any major glitches, but did have some trouble during my own walk-thru. I initially had an idea for a game clock, but after intermittent performance scrapped the idea.
  • Consider if puzzles can be skipped or solved differently. I had items that did not get used as I had expected. In one case, I hid a cell phone(actually iPod) with a hint about the Scrabble game words, but people did not find the phone and figured out the clue in the Scrabble game anyways. I decided not to re-work this piece since the game was still solvable and matched my time estimates. If I realized this earlier I probably would have re-worked something.

Tuesday, April 25, 2017

Beta Testing and Game Day!

This past weekend I had the escape room complete enough for a few beta testers. I asked some of my older nieces and nephews to come check it out. My niece came with four of her friends and broke into two teams of 2 and 3. As my escape room scenario begins outside the front door and part of it takes place inside the house, I met them in the driveway. One downside to my setup was that the second team had to wait in the driveway (more precisely in the car). They were good sports about it. One of the first lessons learned was that my 30 minute time limit was too tight. So I extended it to 45 minutes for both teams.

I also had a couple of my nephews try it out later that day. It was very interesting to see how all groups got stuck at similar spots. Also, some breezed through where others struggled. I did add a couple of 'free' hints for a couple of questions and told the other groups those same hints going forward. All of beta testers were college students. I underestimated how competitive they would be. One of the first questions was "have others solved it?", "what was their time?"

With a couple minor adjustments from these tests and their feedback I was ready to have the rest of my family give it a try. The following day we had a family event at my house so it was a perfect opportunity for the other nieces & nephews as well as my siblings to give it a try. I wrote up a short intro as well as game rules. Things like:
  • Nothing in the walls or ceilings
  • No need to touch outlets or lights
  • Respect any signs on props, they are not tricks
  • Some locks could be brute forced but you should unlock them instead
These players were more diverse in age. Some grammar school age as well as adults. It was again interesting to see everyone struggle at the same spots and other go in completely different directions. Every group did solve it within the time and most used all three possible hints.

The reactions were great. Seeing those who had already done it wanting constant updates on the current team's progress was funny. It was definitely a very positive experience and addictive for both contestants and me. I am already being asked about the next room.