For something useless, the useless box is actually pretty entertaining. I designed a so-called "useless Box" that has a finger pop out of a small box when the user flips the switch. But the finger will push the switch back in the opposite direction, causing it to go back inside the box. The initial design had the finger immediately come out of the box, hit the switch, and then retrieve back in the box. after adding some code to the arduino metro-mini, I was able to make the box do several neat tricks. This project involved the use of transistors, limit and toggle switches, a dc power supply, and arduino c programming.



We start off with several circuit diagrams, one for the simple design (left), and one for the Advanced design with tricks (right)



Wiring & construction (simple Design)
for the simple out and back design, no arduino was necessary. The circuit schematic above shows that wiring the motor with the switches can create configurations that allows the motor to run forward in one, backward in a second, and stop completely in a third.



Final Product (Simple Design)



wiring & construction (advanced design)
For the advanced design, I didn't have to rely on the switches as much as i had to for the simple design. As you can see in the image, I took out 4 of the 6 connections running from the toggle switch to the breadboard. Because we are now using an Arduino, we only need to read the state of the switches, and the code can do the rest. 
I also used pmos and Nmos Transistors in order to control the direction of the current through the motor (and thus effectively the way the motor turns). Along with the arduino, the transistors help to adjust the current flow, or lack thereof, depending on the state of the switches and or the trick being implemented.



code used to operate advanced box
The setup involves declaring the pins to be used on the arduino as well as setting some up as Pullup resistors to avoid floating values. We also declare which trick we are going to conduct in the setup
The main loop continuously checks for the state of both the limit switch and the toggle switch to determine whether or not the finger should be stopped or performing the trick.
To the right are various functions and helper functions for the tricks.



tricks in action



What I learned
When working with transistors you must ensure the sources, gates, and drains  are wired properly as to not create any short circuit that could damage the transistor. You can easily tell if something is wrong if the transistor heats up. That is why it is always best to insert the transistors last.
study the circuit diagram several times before wiring and coding your circuit. It's important to really understand understand the circuit design and why and how it will work. this makes the construction process much faster and helps with debugging.
using an arduino allows you to make more complex mechanisms, but it's important to decompose. many of the actions the finger does in the tricks rely simply on several variations of three lines of code. creating helper functions is key!


A Note from Umar
I avoid simply placing my computer science projects on GitHub. I personally believe that GitHub doesn't do as well of a job as showcasing the process of constructing a computer science project as a portfolio would. Therefore, I aim to display all my personal and internship projects on this site, showing not only my code but also my thought process in constructing the program.

You may also like

Back to Top