The Color Lockbox

by Technetium43 in Circuits > Sensors

71 Views, 0 Favorites, 0 Comments

The Color Lockbox

unnamed.jpg

Our creation is a multi-use storage container with security features like the color key. It will store any valuables or medication and keep it secure from misuse. It works through a color sensor that detects a certain color to open the box, alongside a push sensor acting as a button to close it. It can also be scheduled to automatically open or close at a specific time via the code. For instance, my grandmother takes medicine to help with her memory, but she often loses track, takes multiple doses, or forgets to take it all together. With this new invention, we can now schedule her dose by having the box open at a specific time, ensuring consistency with her intakes. Additionally, it can also be used as a safe to keep important or dangerous items from young children who like to dig through personal paraphernalia, while still allowing instant access through a key. If the user loses the key, they can either use another object with the same color as the the key or change the sensed color in the code for different options. (The key is made with Lego, so it is easy to substitute it with another object or the user can recreate the key).

Supplies

Our machine is constructed using a Lego SPIKE Prime kit, and includes a standard color sensor, a standard push sensor, a hub, and two motors that operate the cabinet. The cabinet is housed within a supporting frame, with the top and bottom formed by two maker plates, while the sides are built using beams and connectors. The cabinet itself is also made from a combination of beams and connectors.

The Cabinet

unnamed.jpg

The cabinet consists of a 5x11x1 technic panel brick as its base, with many beams framing the walls. It also has a 1x7 technic liftarm and a 1x9 technic liftarm attached to its side, which is what the motors will power to eject the cabinet when activated by a color key.

The Frame

unnamed.jpg

The next part of the container is the frame, which is held by two Lego Maker Plates on the top and bottom. Being the perfect size for its job, we chose these pieces despite their original purpose as an integrator for circuit boards. Not to mention, they are lightweight and lack the excess thickness other technic plates have, making them an advantageous choice given the unique design. As for the sides, the bottom wall primarily consists of two motors and the push/color sensors, while the 1x11 and 1x7 technic liftarms construct the top portion. Once that is assembled, motors and sensors are wired to the hub, which is attached to the back using only two modified T-shape liftarms, allowing for easy maintenance while taken off. Lastly, the hub's exposed attachment makes it convenient to run the code and to charge the device.

The Code

Image (9).jpeg
unnamed.png

The base code of the container is extremely simple, coded by a forever loop that tells the sensors to constantly detect for action and respond accordingly. For instance, if the color sensor detects the color purple, the color of the key, it will give a command for the machine to move forward, which in this case equates to both motors turning forward, thus opening the cabinet. Next, if the push sensor detects that it is pressed, it will give a command to "move backwards," closing the cabinet. This code is to be used for regular, open-on-command use. However, if one was to use it the way I do, by scheduling the cabinet to open, the process would require a structured sequence of commands. Initially, a wait command would be set to however many seconds, determining when the container opens. Then, there would need to be a "wait until" command configured to detect the push sensor input, triggering the container to close back up.


For cyclical use, such as administrating medication only every 12 hours, a forever loop can fully automate the process. In this case, the wait command would be set to 43,200 seconds, or half a day. Contrariwise, if the scheduled is not intended to cycle, the code would need to be reset every day.