



![]()




You and your team have some goodies to hide from peeping eyes. You want to only allow your team members to get to them! To protect your secrets, you’ll build a a Treasure Chest that only you and they can open. This calls for a digital lock and a code that you will create to open the chest—that only you and team members know. Also, you must be able to lock and unlock the Treasure Chest. When the lock is opened, have a surprise happen, like a sound playing, lights flashing, or both! . A shoe box or anybox with a lid, can serve as your Treasure Chest.


Specifications (What the design has to do)
Constraints (things that limit your solution)
Google Doc. Indicate what the specifications are that the design must meet and constraints on y our design.
Materials
Shoebox
Glue Gun
Duct Tape
Hummingbird micro:bit
Hummingbird rotation servo
Scissors or box cutter
Hummingbird output devices for the surprise
Treasure Chest, Page 2
Criteria 1 – Beginning 2 – Developing 3 – Proficient
One design presented with little or no explanation.
Alternative Designs
Code uses three or fewer button inputs, no added features.
Digital Lock Code
Latch only works with help (e.g., pushing it by hand).
Digital Lock Latch
Includes a picture of the final build and code only.
Final Design
Tested once with no explanation.
Test and Evaluation
Reflection
Mentions little or no learning from the project.
Two designs shown. For example: Design A uses a pipe cleaner latch; Design B uses a string. A short sentence explains which one was chosen.
Code uses four or more inputs. Example: ABAB sequence unlocks the latch reliably.
Latch opens automatically with the servo. Example: Pressing the code moves the dowel to release the lid.
Includes a picture and one sentence. Example: ‘The servo lifts the dowel so the lid can open.’
Tested a few times with summary. Example: ‘It worked after three tries, but the servo sometimes stuck.’
Identifies two learning points. Example: ‘We learned how servo motors work and how to write simple button code.’
Treasure Chest, Page 3
Three or more designs are shown with clear reasoning. For example: ‘We chose Design C because it used fewer materials and worked more smoothly than A or B.’
Code uses four or more inputs and triggers a surprise (e.g., LED flash or sound). Example: Code ABAB plays a sound when unlocked.
Latch both locks and unlocks automatically. Example: Pressing the code rotates the dowel to lock and another sequence unlocks it.
Includes picture, explanation, and one improvement made. Example: ‘We changed the angle of the servo arm to make the latch open more easily.’
Tested repeatedly and fully explained. Example: ‘We tested 10 times. It failed twice when the dowel got stuck, so we adjusted the angle.’
Detailed and thoughtful. Example: ‘We learned how to translate rotational to linear motion and how to debug our code using the test feature.’

There are many ways to construct a treasure chest. One choice is to use a shoe box as the chest and find a way to lock it. You won’t be using a padlock, but rather, you will enter a digital code that opens the treasure chest.

You will need a hinge for the top. One easy way to make a hinge is to use duct tape. In the picture below, part of the top has been cut so duct tape can be applied and then taped to the back of the box.

Figure1:ShoeBoxwithonesideofthetopremovedforapplyingaducttapehinge.
Treasure Chest, Page 4
The material from the top of the box can be used to make a hasp. A hasp is the part that swings over a latch to hold something shut like the flap you see on a treasure chest or toolbox that you could put a lock through.

Figure2.Shoeboxtreasurechestwithhasp.
Next, you will need to create a latch;a pipe cleaner is one choice. You will need some flexibility in the hasp.

Figure3.Shoeboxtreasurechestwithhaspandlatch.
Treasure Chest, Page 5
Google Doc. What are your initial thoughts as to what you want to happen when you enter the code to unlock the lock? Think about the sequence of actions the computer must make, step-by-step, as the code is entered. Check the specifications to see if you are addressing them.
Treasure Chest, Page 6
KSB 2: Position Servo

The position servo rotates an arm based on the code that you provide. It could rotate a dowel, which can be used as the locking device.
Here is information from BirdBrain Technologies on how the position servo functions.
https://learn.birdbraintechnologies.com/hummingbirdbit/snap/program/9 -1

Google Doc. Take a screenshot of the code you wrote to rotate the servo arm from100 degrees to +100 degrees in the counterclockwise direction. You may want the rotation to occur slowly, requiring delay as the serve arm rotates.
Treasure Chest, Page 7

Refer to Figure 3 and imagine that a dowel is used in place of the straw. How could you move the dowel to unlatch the treasure chest? Can you design a way to connect the position servo to the dowel? Where would you locate the position servo?
Since the servo arm rotates in an arc, the connection between the arm and the latch it is connected to needs to be flexible to allow smooth movement. One possible solution is indicated in Figures 7 and 8.


Treasure Chest, Page 8
Google Doc. Upload a picture of your initial design with the arm attached to the servo and the code to have the servo rotate.
Treasure Chest, Page 9

The micro:bit has two buttons on it, A and B (see Figure 9). These can be used as inputs to the Hummingbird controller.

Figure9 TheAandBbuttonsarelocatedonthemicro:bit
Figure 10 illustrates an example of Snap! code that uses the Micro:bit Button A to turn on an LED.

Codeusingmicro:bitButtonAtolightanLED Treasure Chest, Page 10

You can program the A and B buttons on the micro:bit to act as a code, for example, ABA. When the person wanting to open the Treasure Chest presses this sequence, the dowel will rotate and the box can be opened. Here are the programming elements you will need to use (see Figure 11).

Since you’ve experimented with the servo, you already know where you want the arm to be. When the green flag is clicked, the servo should move to the position where the dowel is in the hasp and the Treasure Chest is locked. When creating a code, the more complicated it is, the harder it is to hack. For instance, a simple two-button code like AB has only four possible combinations ( AB, BA, AA, BB). The number of possible combinations is 2 raised to the power of combination. With two buttons and two presses, there are 22 or four combinations. If you make the code ABA, the number of different possible combinations would 2 3 or eight possibilities.
Let’s say you want the code to be ABA. So Micro:bit button A is pushed, then B is pushed, than A is pushed again, and the servo rotates opening the Treasure Chest. After the first two inputs AB, there needs to be a slight time delay for the next input to be registered.
Treasure Chest, Page 11

Figure12 CodeforABAcausesServotoactivate,rotateandopenTreasureChest.
Google Doc. Upload your code that causes the servo to activate and rotate.
Chest, Page 12

Make a few sketches and include brief explanations of how several different designs would work. How do you want the latch to open? What do you want the surprise to be? How complex do you want the code to be?
Google Doc. Upload your sketches and explanations of how the different designs will work.

Which alternative design did you like best? This is the optimal design. Why do you think so? Please explain.
Google Doc. Upload your explanation of your optimal design and a sketch of it.

Now you need to put everything together and create a code, that when entered, will rotate the servo and open the Treasure Chest. Often, as you write and test code, you need to make changes. Take a photo of your initial code solution and paste here.
Google Doc. Take a picture of your final code and upload it.
Treasure Chest, Page 13


Now it is time to build your complete Treasure Chest, including the code, the servo, and the locking mechanism. Take a photo of your final design and paste it below.
Google Doc. Upload the pics of the Treasure Chest and a pic of the code.
Did your solution work as intended and meet the design specifications? Briefly explain why it did or did not. Describe how you tested the design.
Google Doc. Explain your testing procedure and whether your design met the specifications or did not. I nclude any code changes, structural changes to the Treasure Chest you made so it better met the specifications.
Google Doc. What are your ideas about how to improve your design?
Reflection

What did you learn? The servo arm moves in a rotary motion, yet the dowel needs to move horizontally, or nearly so, to open the latch. What surprise feature did you include when the Treasure Chest successfully opened?
Google Doc. Upload a response to the questions above and any other thoughts you may have.
Treasure Chest, Page 14
Criteria 1 – Beginning 2 – Developing 3 – Proficient
One design presented with little or no explanation.
Alternative Designs
Code uses three or fewer button inputs, no added features.
Digital Lock Code
Latch only works with help (e.g., pushing it by hand).
Digital Lock Latch
Includes a picture of the final build and code only.
Final Design
Tested once with no explanation.
Test and Evaluation
Reflection
Mentions little or no learning from the project.
Two designs shown. For example: Design A uses a pipe cleaner latch; Design B uses a string. A short sentence explains which one was chosen.
Code uses four or more inputs. Example: ABAB sequence unlocks the latch reliably.
Latch opens automatically with the servo. Example: Pressing the code moves the dowel to release the lid.
Includes picture and one sentence. Example: ‘The servo lifts the dowel so the lid can open.’
Tested a few times with summary. Example: ‘It worked after three tries, but the servo sometimes stuck.’
Identifies two learning points. Example: ‘We learned how servo motors work and how to write simple button code.’
Three or more designs are shown with clear reasoning. For example: ‘We chose Design C because it used fewer materials and worked more smoothly than A or B.’
Code uses four or more inputs and triggers a surprise (e.g., LED flash or sound). Example: Code ABAB plays a sound when unlocked.
Latch both locks and unlocks automatically. Example: Pressing the code rotates the dowel to lock and another sequence unlocks it.
Includes picture, explanation, and one improvement made. Example: ‘We changed the angle of the servo arm to make the latch open more easily.’
Tested repeatedly and fully explained. Example: ‘We tested 10 times. It failed twice when the dowel got stuck, so we adjusted the angle.’
Detailed and thoughtful. Example: ‘We learned how to translate rotational to linear motion and how to debug our code using the test feature.’