Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 2.12 KB

README.md

File metadata and controls

33 lines (24 loc) · 2.12 KB

CodeBox

A little password protected box that teaches school kids the importance of cryptography. Add a sprinkle of web sockets with a pinch of JavaScript and whole lot of lights and you get a project which is a whole lot of fun with some prizes at the end

Introduction

CodeBox is a game where children follow the worksheet to figure out the password to open the box. The game begins with the teacher showing the webpage (http://codebox.stevenjamesgray.com) where the children can quickly register their teams and start guessing the code on their own laptops or mobile phones. We project the page on the main screen in the room so that everyone can see the current state of the game and see who is guessing what. We also setup and laptop or an iPad at the front of the room to allow players who don't have a phone to play. All players can see each other’s guesses in real-time on their own devices as well as on the projected screen. The game ends when the box is opened 3 times and all the prizes are distributed.

Installing Dependencies

boxServer.js

  • npm install socket.io optimist

boxController.js

  • npm install optimist serialport socket.io-client

Running the Box Server

This is the socket server that tunnels the requests from the webpage to the physical box in the front of the room. To run the server then type the following:

  • node boxServer.js --key=keyToOpenBox

The small red dot on the webpage will turn green when the server is connected. Change domains in index.html to point to your domain/server as need be. Change the port number if needed - default is 8888.

Running the Box Controller

The box has a small front facing servo attached to the clasp of the box which turns to open and close the box. This script tells the arduino which is attached to the raspberry pi to turn the servo on the serial port specified inside the script. To run type the following:

  • node boxController.js --port=/dev/ttyACM0 (whatever your arduino serial port is)

Surprises

Many surprises await you in the repository; you just need to find them!