Skip to content
No description, website, or topics provided.
Other HTML
  1. Other 85.9%
  2. HTML 14.1%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Fritzing Exports
build
componentsCode
puzzleCodeWithLights
README.md

README.md

ArduinoPuzzleBox

The goal of this puzzle is to manipulate and explore the box to turn on all the lights! The app uses various sensors and an Arduino to control 12 red LEDS. Every sensor must be utilized in some way to solve the puzzle.

Puzzle Box

How it Works

The project uses an Arduino Uno to control 12 red LED lights, and read from a tilt sensor, an ultrasonic distance sensor, a 2-axis joystick, and a push button, plus a lot of jumper wires (male-male, male-female, and female-female). All this is powered by a 9 volt battery with resistors to help protect the lifespan of the LED lights and the functionality of the button and tilt switch.

The Setup

how it works

Tutorial

You Need:

For the electronics

  • an arduino and necessary components (listed below)
  • jumper cables (I used aproximately 40 male-male and 40 male-female)
For the box
  • foam core (I used black)
  • hot glue
  • a precision knife
  • a metal ruler or square

Arduino Parts List

Part Type Properties
1 Arduino Uno (Rev3) - ICSP type Arduino UNO (Rev3) - ICSP (w/o icsp2)
1 Ultrasonic Distance Sensor (hc-sr04) variant hc-sr04
12 Red (633nm) LED color Red (633nm); package 5 mm [THT]; leg yes
1 Thumb Joystick 2-Axis
15 220Ω Resistor package THT; tolerance ±5%; resistance 220Ω; bands 4; pin spacing 400 mil
1 Tilt Switch package THT; tilt mechanism Mechanical Ball
1 Pushbutton package [THT]
1 Battery block 9V voltage 9V
1 Half-Sized Breadboard sticky foam on the bottom

Step One - The Code

Arduino

Testing

Testing

Testing

Testing

Testing

Upload the code to the arduino via USB. Please use puzzleCodeWithLights.ino under the directory of the same name. You can use the Arduino IDE (availible at https://www.arduino.cc/en/Main/Software). I used version 1.8.2 when making this project. If you wish to test if any of your components are working, which I recommend you do before installing, you can use your own code, your own code, or the examples that come with the Arduino. (These examples can be found under file: examples in the Arduino IDE). Please note that you cannot upload code when there is something plugged into pins one or two of the arduino, so if you are using those pins, temporarily remove them whenever uploading the code and then plug them back in once uploaded. These pins are also used for serial communication with the computer so if you are using them for other reasons make sure to remove all serial communication in your code.

Step Two - Building the Enclosure

unfolded box

  • Decide how large you want your box. I chose 15x15 cm squares. Remember that you will have to wire all your components together when the box is mostly built so leave yourself room to work if you need it.
  • Measure six squares in your choice layed out like the picture above (Like a cross with four squares up-down and three squares across)
  • Use a precision knife to cut out the box. (I find that it takes at least two passes with the knife and that the knife dulls quickly so be careful)
  • On one side of the box score score the lines between each box. Be careful not to cut through the foam entirely. Aim for either one pass of the knife, or just through one layer of the paper and most of the foam in the core. This will allow you to fold the foam core
  • Cut out holes for any hardware that needs to be outside the box
    • Cut two round holes for the ultrasonic sensor. If you measure and cut carefully that could be enough to hold the sensor in place!
    • Cut a small hole for the push button that will serve as the reset button where you wish to place the reset button (I chose the top)
    • Cut a hole for the joystick on the top of the box
    • Poke two small holes for each LED on the top of the box
  • Attach any components that will be difficult to install later. (Make sure to leave room to add wires later when the box is formed. I used a combination of extra foam core and hotglue to secure the push button and the joystick)
  • Use hotglue on the inside or outside seams of the cube to hotglue all but one panel into a cube
    • Fold one panel 90 degrees and secure with hotglue on the fold. (I did both the inside and outside seams for extra stability)
    • Repeat until there is only one square not secured into the box so you have an opening to install the box and turn on/off the Arduino

Step Three - Installing the Arduino

installing

installing

installing

how it works

  • Assemble your project inside the box. Use the circut diagram as a guide. Remember that all components need power and that the LEDS, push button, and tilt sensor all require resistors. I used the breadboard to connect to the resistors, but you could solder these instead
  • Start with the parts that are the most difficult to get to in the box. I started with the reset button followed by the LEDS
  • If you are using a breadboad, use the sticky foam to install it on the bottom of the box. This is a great place for the tilt sensor to live as well.
  • Additionally you can secure a holder for your arduino board at the bottom of the box.
  • I also created a small housing for my battery with leftover foamcore and hotglue so that the battery could be replaced, but would not disturb anything inside the box when the box is tilted or in transit.

When you are finished, close your box (my front panel fit snuggly into the openeing and stayed shut on its own, but you might have to build a hatch or something if this is not the case.) The last step is to enjoy your box!

You can’t perform that action at this time.