Jorge Larach Final Project: Mixed Techniques

Process
I started working on this project right when classes resumed after Spring Break. I had been messing around with small projects for my microcontroller (MCU), which I bought mainly to keep up with my Embedded class with Dr. Nickels, and thought it would be cool to do something with servo motors. My first attempt ended with me completely frying my 
MCU after I connected the servo directly to it, which is apparently a big no-no in electronics. By the time my new MCU and external battery pack arrived, I had decided to make a useless box. The first step, and definitely the hardest part, was calculating the proper timer values to generate a pulse-width-modulation signal of 50hz, which is what the servo expects to properly function. 

Two servos, battery, breadboard, and MCU

After I got the servos working, I focused on implementing an SPDT toggle switch using edge-triggered interrupts and internal pull-up resistors, which made things very confusing. I struggled quite a bit with debouncing the noisy signal from the switch, which I later realized was because of the alligator clips I was using (I ended up soldering wires directly later).
Switch added to circuit

Once the switch was working, I wrote a few functions in the code to convert any given angle between 0 and 180 degrees into a signal that makes the specified servo rotate to that exact angle. At this point, I had some working servos, and a switch that could trigger them to move to any angle, so I grabbed an old shoebox from under my bed and threw together a prototype. To make the original prototype (not pictured) work, I had to use tape, a shoelace, a Zippo lighter, one of the laser cut rulers the Makerspace gives out, a rubber band, and my phone case. At this point, I decided I wanted it to look and sound like there was a party happening inside the box, so I included an older project from February that cycles through every possible color on an RGB LED by applying an algorithm I stole off of Wikipedia that converts any HSV value to an RGB value, and iterates over the range of possible H values (0 to 360). For the music, I tastefully went with Fetty Wap's Trap Queen, which I downloaded from Youtube as an mp3, cut everything after the first minute, compressed in Audacity to an 8-bit unsigned WAV file, imported it as a huge array to my project, and output an element once every 125us to an 8 Ohm speaker I bought on Amazon.
Early April prototype with all components included

I wanted to keep procrastinating figuring out the arm servo and how the attachment would actually flip the switch back down, so I got on Fusion and started designing the shape of the final box to laser cut. I measured the exact dimensions of every component in the box, and came up with a layout that would minimize space while still keeping it functional. I found that everything could fit in a box that was 6 inches in width, 7 inches in length, and 5 inches in height (taller than it needed to be, but it made the dimensions look less awkward), so I cut that out and started assembling it. Later I realized that when the lid was closed, you wouldn't be able to tell there were lights and music playing, so I went back and cut out some holes on each side. 
Final box design in Fusion

Once the final box was cut, I understood that I had to face my demons and finally make the arm attachment. I realized I made life harder on myself by making the box 5 inches tall, so I cut out some foam blocks and hot glued the servos on top. I originally intended to 3D print the servo attachments, but after being harshly reminded the reason why I despise Fusion's Create Form environment with the fury of a ten thousand suns, I switched to making the attachments out of balsa wood. I pencil traced an outline on a small piece, and used the band saw to cut the rough shape out. After a lot of testing and sanding, I whittled it down to the right shape. I did the same thing for the lid servo's attachment, but it was a lot easier because it was just a solid rectangle. I put the box together with tape, and it was finally functional! 
First working version

Even though it worked, it still needed finishing touches, so a few days later I went back and begrudgingly designed and 3D printed a "PARTY BOX" label which I hot glued to the front, I engraved an image of what a party-attendee might look like to the inside of the lid, I hot glued two metal hinges I found in the Makerspace to the lid and the back wall, fixed every component in place with hot glue, and finally wood glued all the walls together.
Final box!

Result
I'm really happy with how it turned out. Once the box was finished I was able to program some routines so that its not the same thing happening every time you flip the switch. Like sometimes the lid slams over and over, or sometimes the arm fakes you out a few times and then flips the switch down. The switch solder hasn't broken yet, and I still haven't gotten any wires caught on the servos. Visually, the only thing that bugs me is some of the super glue I used for the battery and the label; it left some weird flakes and stains on the wood when it dried. I also spent some time trying put the hinges on the inside of the box, but that didn't work out because I didn't realize the lid wouldn't fit perfectly on top. Also, the settings I used for the label print weren't precise enough to properly show the exclamation marks, so now it looks like there are three vertical bars on either side of the label, which isn't that bad. Also I think the label is a little tilted.

Reflection
I registered for this class so that I could learn to use the awesome equipment in the Makerspace before I left, and that's exactly what I did. In the end, I ended up using hand tools (for the servo attachments), the 3D printer (for the label and the MCU case), and the laser cutter for this project, leaving out only the CNC mill, which I'm not terribly upset about. This was my first time making a circuit like this, and in the process I made a bunch of mistakes and fried a few components, but I'm really happy I ultimately got it to work. There's a few things I wanted to do with this project that I never figured out in time, so if I ever come back to it, or make something similar in the future, this is what I want to accomplish:
1. Design new patterns/routines.
2. Have a "power" switch in the back, which physically cuts power to motors and turns off music and lights through software.
3. Figure out how to power the MCU with the battery so that it doesn't have to be plugged in to a computer to work.
As it is right now, even if the box is unplugged from a computer, the battery still drains little by little, which is kind of annoying. One time the servo motors inexplicably stopped working from one day to another and I spent hours debugging until I realized the battery could just be dead, so implementing a switch that physically cuts the power would be great to implement someday. I'm glad I did this!

Box almost done

Label design in Fusion


Function headers

Test engravings for the most important part of the project
















Comments

Popular posts from this blog

Lizzie Edwards Project 2: Laser Cutter

Introducing Katherine Behrens

Introducing Dr. Wilson Terrell Jr. (Dr. T.)