---
# System prepended metadata

title: Final Report

---

# Final Report

### What we built

We built a variation on the arcade claw machine that is gamified instead of being a rip-off money making machine. Instead of a ceiling claw, there is a robot arm instead.

Specifically, what we built consisted of the following system parts:
1. A robot arm servo interface (6 servos) to control each servo by its degree from 0-180
2. Joystick interface to control XYZ + gripper (4 potentiometers)
3. Inverse kinematics algorithm for the arm to convert XYZ to servo joint angles in degrees, decreasing the number of joysticks/controls (and simplifiying then) so that the user can control the arm
4. Music player for "No time for Caution" and "Eye of the Tiger" and potentiometer for volume control
5. LCD display interface to select game modes, show countdown timer and score during runs, and a leaderboard
6. Break-beam sensor interface to increment the score when objects fall into the collection bin and trigger the sensor
7. PCB design
8. PCB assembly (not used during demo)
9. Breadboard wiring (used during demo)
10. Debugging printf function to print floats, ints, and strings with Serial interface
11. Safety features, integrated e-stop with a lock and acrylic display case

### Components

Here are the components for their respective project parts above:

1. 3xSG90 servos, 3xMG996R servos
2. 2xARCELI PS2 Joysticks
3. Pre-built robot arm
4. Standard TRRS Audio Jack and Speakers
5. MSP2202 TFT LCD Display
6. Adafruit Break Beam Sensor HD-DS25CM-3MM
7. KiCAD v5 software (for PCB design)
11. Mxuteuk 1NC 22mm Red Mushroom Emergency Stop Push Button



### Challenges we faced

Challenges that we faced included powering the servos, as we found that the parasitic current spikes from the servos would interfere with the display and also cause other servos to move uncontrollably. This occured because the nominal voltage across servo(s) would drop below 5-5.1V--the minimum voltage needed for the servo to hold its position under the load that the servo was under. It would dip under due to current spikes from other servos that go under a higher load resulting in uncontrollable movement. In addition, we needed to add a buck converter to maintain the voltage at a consistent 5.15 V to stop voltage fluctuations out of the servo's range, but that only works when the servos do not go too fast--any higher and the issue would occur again. A solution to this problem is to use decoupling capacitors to ensure the servos have the 5V-5.1V minimum (or buy a servo controller board with those capacitors). Or, decrease the max speed that the servos would move at or the max torques faced by a certain motor, therefore reducing the current spikes reducing nominal servo voltage level respectively.

Another challenge we faced was playing multiple songs and mixing with the midi player. Setting and manipulating the voices of the midi player allowed us to play multiple songs. The lcd screen would also sometimes flicker on and off, which is also related to current spikes.

Here is our laundry list of PCB challenges we faced:

Board size was wayy to big, resulted in a long time to recieve our board (ideal size should fit in your palm)

We did not include decoupling capacitors near the STM32 chip, so we scratched off the traces and soldered on surface mount capacitors

We used components that we found in the ECE shop, which were the incorrect ones that we had designed for (Rick has all the components you need, so start early and ask Rick for those components)

Our last nail in the coffin was trying to get the STM32 to fully reset, which we could not figure out the issue for even with the help of the all-knowing Rick. But this could be in part due to not starting earlier and following the above steps first. Always start the PCB design, manufacturing, and assembly as early as possible because it will have ridiculous problems like this for a first time PCB maker.
    
### Recommendations
    
Some specific recommendations for those who do similar project in the future include not starting the PCB design early as possible and CONSULT RICK FIRST BEFORE FINALIZING THE PCB DESIGN. 

Do not buy a large acrylic cage as it is a hassle to move around and store, ensure that the cage (could even be an animal cage) is just barely enough to cover your arm's workspace.

Make your servo code and joystick code are modular by using const structs for all your config options for each servo or joystick. We did this and it saved a lot of time when we needed to make changes to individual tuning changes.

Ensure that you have a robot arm before you start or buy one, or it will not be approved.

This sort of project in general can naturally get very expensive, so keep that in mind when getting components. 

Knowledge of power electronics and arm kinematics/dynamics will certainly help one to determine/maintain the voltage to the servos, as going outside the recommended ranges will cause mechanical failures.

Try to use a 6DOF arm, so you can actually move in all cartesian directions for easy controls.

This project also eats a lot of time, so expect to put in 50-100 hours to complete it. 

This is a microcontroller class, so put more focus on the interfacing of things rather than trying to spend a bunch of time on pure software development or mechanical hardware. You will not be rewarded for it in this class or the Spark Challenge--try to find a useful usecase for the arm as it might impress the judges more (and clean up the presentation).
    

