Introduction: Modular Puzzle
DISCLAIMER: This is a project me and a couple of others have been working on in the context of a university course. We probably haven't implemented this idea in the most optimal (or sane) way due to time constraints (and inexperience, at least on my part), so please take these instructions with a grain of salt and let us know if there are improvements to be made.
Once I have a bit more time on my hands, I'll try to rework this instructable to be more comprehensible and practical.
A picture of our (mostly) finished implementation is added to this step.
Anything relating to the project can be found in the projects GitHub repository.
The idea behind this project is to emulate the game Keep Talking and Nobody Explodes with a physical modular puzzle game. For those who don't know the game, basically one player is given a bomb which contains several puzzle modules. The player needs to solve each module successfully to stop the bomb from exploding. However the behaviour of (most of) the modules is dependant on factors outside the players knowledge. In order to solve the puzzles, he has to cooperate with a second player (who should not be able to see the bomb, ideally), that possesses a manual with detailed explanations of how the modules are solved (it's probably easier to just watch some real footage to get a feel for the game).
Our project involves a modular puzzle system that is controlled from a central control module. This control module can interface with a number of puzzle modules using I2C. We've fully (and as far as we can tell correctly) implemented the main controller as well as two puzzle modules (and a third one, that is not yet debugged correctly). However, new modules can be implemented with little effort (as long as they communicate via I2C using this protocol). Because I2C is relatively flexible (as long as there are no address conflicts), the number of modules operating in parallel is basically limitless (that's a lie. Actually, there are "only" like 120 usable addresses in I2C, although that should be way more than ever needed). Also, the protocoll can be extended easily. In fact, I added support for needy modules, that can't be solved and need periodical attention by the player, after our presentation without breaking the previous modules (well, at least it shouldn't have broken older modules, but I have not yet had the time to actually test this, which is the reason the needy-modules branch is still experimental). On the hardware side, this instructable features a explanation of how to assemble the case for this modular puzzle and the modules themself.
Step 1: Building the Case
First cut Boxdesign V2 from 3mm material (we used MDF), then cut Box_inside onec again from 3mm and six times from 5mm material. Now, cut the divider once from a 5mm sheet of the material of your choice.
Now you can glue the box together except the top part (the one with the holes inside). After the glue dries you have to drill a hole for the power adapter (depending on the size of the adapter. You should use a 5V power source delivering 2 amps).
Then take the inner 3mm piece and cut holes for the cables (connect the holes) then you can glue it inside the box. (the big hole should be there where the adapter hole is located) Then you have to glue the cables inside the box, four for each Module and two for the main module connect one cable from each module to the 5V pole of the adapter and one to the ground pole There are two Cables left for each module except the Mainmodule one of them is the SCL (Clock) and the other is SDA (Data) input for I2C. Use a 4- or 5-connector to join the cables into a bus between the modules. Connect all cables of the bus of each kind (e.g. by wiring them to 4 seperate small perf board cutouts, compare with the schematic).
Now, take the divider and cut a hole for each module inside, so you can connect the modules with the cables inside the Box. Then glue it in the inside of the box. Now pull the four Cables for each module and the Mainmodule through the Holes.
Last but not least, glue the six 5mm inside parts and the top part of the box on top.
Step 2: Building the Control Unit
The control unit is the heart and logistic center of this modular puzzle system. It contains some elements to interface with the game (like setting the timer and actually starting the game) and handles the communication with the different puzzle modules. The images show what our main controller looks like and what lies underneath the cover plate (it's a kind of terrifying measure to save time that kind of backfired on me).
Building the module is actually not all that complicated. But first, here is a list of about everything we need:
- A pushbutton (any should do but we used this one)
- A potentiometer (50k works perfectly good)
- A servo (has to work using the arduino Servo library, we used this one)
- 12 LEDs (8 for the LEDs indicating the game seed, two green and a red one for the remaining tries and one to indicate hold mode)
- A sheet of wood (we used a 20x60cm piece of 3mm MDF. The template for the laser cutter is also intended for a piece of MDF with this dimensions) for the case
- Wire and resistors (we used 180 Ohm for the LEDs
- A microcontroller (we used a Atmega328p)
If you want to use our PCB (not tested yet), some more helpful things to have are:
- a socket for the MCU (there is a good chance that the source code for the main controller is going to be updated so being able to take it out and reinstale a more recent version might be usefull)
- pin headers (the PCB already has designated spaces for those) to tidy up the wiring
- a 16MHz clock and transistors (2 22pF ones and a 100nF one) (acutally, this is important as long as you don't plan on just throwing the Arduino itself into the case as we may or may not have done)
- A laser cutter (you can obviously build anything we show here by hand, but we will supply you with a ready-to-go vector file to use with VisiCut)
- A soldering iron and other tools involved with handling the wireing of the module
- A PCB mill (alternatively, perfboard will work as well and is in fact more proven than the PCB design we supply here)
First, fire up VisiCut and cut out the template (Box_Main.svg) for the main module. Here, the red lines are inteded to be cut out, while the black lines (the clock face for the timer) should be engraved (definitely not cut! you might want to try marking it though, whatever suits your taste). The blue lines are indicating the places in the modules face plate intended for LEDs. You can (probably) also use the laser cutter for these but drilling a 5mm hole works just fine. The green dot is supposed to be the rough position of the pot. The size of this hole depends on whatever pot you use and should just be drilled.
If the box is successfully cut out, locate the position of the cases bus cable and cut a hole into the bottom plate of your controller. Then glue everything together except the face plate in which you have yet to insert the electrics and one of the long side plates in case you need to open up the box later down the line (e.g. for software updates). If you want to, you can attach the unglued side plate and squeze the nearly finished module case into it's slot, after putting the wire through the hole we cut out before.
Now you can start to insert the LEDs into the cut out/drilled holes (you maybe want to glue them in, although they do fit rather tightly) and screw in the button, the servo (the actual actuator should be in the center of the clock) and the pot.
Last and most important are the electronic parts of the module. A little warning before we get to this, because of the time constraint for the project (and certainly also time mismanagement on my side) we basically just threw a Arduino into the box, stuck wires into it's ports and soldered them to everything else. It's safe to say that that is not the best idea and I plan to redo this once I got a little more time. This is why I'll also say beforehand that the PCB we'll supply for this is not yet tested, so please be aware of this and let me know if you tested it. Now, let's actually get to the wiring.
Either use a PCB mill to get our PCB (Here are the board and schematic from the related Eagle project) or use a perf board and wire it up according to the schematic.
As mentioned above, you can also always just throw your Arduino into the box, which should work just fine. If you do this, connect the Arduinos VCC with the cases VCC and one of the grounds with the cases ground. Also, connect SDA (Data) to the Arduinos A4 (Pin 27 of the MCU) and SCL (Clock) to the Arduinos A5 (Pin 28 of the MCU). If you use a PCB or perfboard, solder the boxes bus cables to their designated pinheaders as indicated by the labels on the board (or according to the schematic).
If everything works correctly, fit everything into the case and make sure the module is correctly set up (you should be able to just plug the module in and check if everything works). If everything is okay, put the module into it's slot if you have not done so already and glue the faceplate on.
Step 3: Building a Module
Most of the module assembly depends on the module itself and is similar to how the main controller is built. We'll give a short explanation of this here by using our boolean logic module as an example.
For this module you'll need:
- at least a 20 by 32-35 cm sheet of 3mm MDF (or similar)
- a LCD (just about any 16x2 LCD that works with Arduino should do. Make sure that the hole for the LCD to be cut out is big enough. The template uses a TC1602A-01T from Adafruit as a example)
- three buttons (any push button should do. You could use the buttons mentioned in step 2)
- two LEDs (a green and a red one) + resistors (180 Ohm is okay)
- a pair of handles to comfortably pull modules out of their slots
Cut out the template (Logic_Module.svg) via laser cutter and cut a hole corresponding to the hole for the bus cable in the module slot. glue everything (except the face plate) together.
Drill two 5mm holes into the face plate (somewhere above the LCD) and insert LEDs into these (one red and one green). Also mount the LCD and buttons into their respective holes.
Now, print the PCB (this one should work, files can be found here) and wire it up as suggested by the schematic/pcb design and hook it up to the LCD, buttons and LEDs (by the way, the LED on pin 15 of the MCU is the green one). The I2C pins, Ground and VCC have to be put into the same connector used for the cases bus system and the pins of this connector have to correspond to the connectors pins as you need to plug the modules connector into the cases connector for the module to work. Let the newly made cable hang out of the hole in the bottom of this module and you are done.
You should now be able to test the modules functionallity (you need to have built the main controller first!). If everything works as intended, glue the face plate on and the module is done.
We have a be nice policy.
Please be positive and constructive.