Final Project: Robotic Arm
Hi, my name is Jacob. I’m a rising junior at Rae Kushner Yeshiva High School. For my starter project, I made a MintyBoost, a battery powered USB charger. I picked this project because I wanted a chance to learn about all the different electrical components involved and because it seemed like an actually useful gadget that I could build. My main project started out as a robotic arm controlled by potentiometers, but it evolved into being controlled by brain waves and blink detection with an EEG headset. I had never made an electronics project this large or involved before, and it was a great experience that taught me useful problem solving skills which would have been hard to learn elsewhere.
Here is my code for controlling the arm with potentiometers and EEG control: https://github.com/jacobstein123/EEG_Robotic_Arm
Here are my mechanical drawings of the different pieces of the arm: http://imgur.com/a/gILHV
Here is my schematic of the arm with potentiometer control: http://imgur.com/XiXPtlO
Here is my Build of Materials for the entire project: https://docs.google.com/document/d/1ZXNgu8tMQI_KZlKfIM_qPfMnl1aiPPjc0BFTvUFfVA0/edit?usp=sharing
Here are some resources that I used:
- Justin Dailey: Real-time Controlled Robotic Arm
- Make a Mind-Controlled Arduino Robot
- NeuroPy Library
The arm is made of a three part wooden base with a small turntable, and a number of aluminum bars for the arm itself. Powerful servo motors are attached to each joint of the arm, allowing the base to rotate, all three joins of the arm to move 180 degrees, and a gripper on the end of the arm to open and close.
The arm has two ways of being controlled: the first way is to use 5 10k potentiometers to control each servo. When a potentiometer is turned, it sends its resistance value to the arduino, which can interpret that information and then use my code to send a value from 0 to 179 degrees to the associated servo. This allows the arm to be easily and accurately controlled.
The second way of control which I added after I had already completed the potentiometer control is to use the Neurosky MindWave EEG (electroencephalography) headset, which can measure brain activity. This system works by detecting eye blinks through spikes in brain activity and measuring attention levels. The user can choose a desired servo and number of degrees by inputting different patterns of single blinks and double blinks. Then, once the servo and desired location have been set, the user brings their attention level up to a certain threshold and the servo will move to the set location. This was difficult to accomplish because Neurosky did not make their blink detection algorithm open source, which I was not expecting. To get around this, I wrote a Python script which would detect spikes in brain activity, measure the amplitude and length of the spike, and determine if the spike matches up with the spike caused by a blink. Once I got that system working, I wrote an additional Arduino script that would receive data from the Python script and then move the servos accordingly. The Arduino acted as a sort of middleman between the python script, which was getting the information (in this case eye blinks and attention level) from the user, and the servos which move the different parts of the arm.
Despite this being a very ambitious project, I’m proud to say that I was able to successfully complete it. Along the way, I learned invaluable engineering and problem solving skills that I probably wouldn’t have learned for many years had I not done this program. Doing this project, which was by far the most complicated engineering project I’ve ever attempted, made me realize many things about the creative and engineering process, such as the fact that many times, the seemingly smallest problems are the ones that end up taking the longest. Even though this could be very frustrating, I came away with much improved problem solving techniques. Instead of just viewing a problem as an impossible-to-overcome obstacle, I now can look at it objectively so I can isolate where the problem lies. I will apply these skills that I’ve learned here for the rest of my life, regardless of what profession I end up in.
Overall, my project was a great success and I hope to continue working on it, constantly making improvements and turning it into an even better project. Here is my final video with a clip of the EEG system right after I got it working:
2nd Milestone: Completing the final version of the arm with potentiometer control
Since my last milestone, the arm has come a very long way. I have now completed building the final version of the arm out of aluminum bars and a wood base, instead of cardboard. The base is made out of ¾” thick 11 square inch piece of wood. This is heavy enough to keep the arm stable when it moves and prevents it from tipping over. On top of that is a 6 inch lazy susan turntable with a servo attached, and a slightly smaller and thinner piece of wood is placed on top of that. The turntable allows the arm to rotate easily despite its weight.Then, the arm is bolted down on 1.5” stilts to the base. The stilts are necessary to prevent the corners of the bottom bars of the arm from hitting the base when the arm is moved.
The arm itself has three joins and a gripper. The bottom and middle joints are both made out of pairs of 7 inch aluminum bars connected to servos. One of the bars of the middle joint needed to square holes cut in it, which proved to be much more difficult than I anticipated. The top joint is made of two 3 inch bars with the gripper secured to the top of it with zip ties. Each pair of bars has a large bolt holding it together.
I had a number of problems along the way. For example, getting the turntable attached to the servo proved much more difficult than I anticipated, due to the fact that if the wheel of the servo is not perfectly centered, it could not move properly. Even after measuring it and re-cutting the wood holes, the servo is still only able to easily turn about 150 degrees instead of 180 (which is still fine for the arm). In addition, powering the arm was also more difficult than I expected. I originally wanted to power it with a 5 volt 3 amp power supply, but it didn’t work at all. The servos would shake violently and respond very slowly to the potentiometers. I troubleshooted this by trying to power it with 4 D batteries, which worked fine despite the fact that the batteries eventually got drained. I also tried using a variable power supply which worked, but I accidentally gave the servos too much voltage which ended up breaking two of them. Finally, I ordered a new power supply which is designed to work well with sources that have greatly varying current.
Now that my arm is complete, my plan is to move onto the EEG control using a combination of blink detection and attention levels to control the arm in place of the potentiometers.
1st Milestone: Getting the electrical components working
After I finished my starter project, I began working on my main project, a robotic arm. The plan is to have an arm with two to three joints that can move up and down independently and have a gripper at the end of the arm that can pick things up. The arm will also be able to rotate 180 degrees. The joints, the gripper, and the rotation are powered by a servo, a precise motor-like device which can accurately rotate to a specified location. The servos can also support the large weight of the arm and hold it in position while the arm is stationary.. After I am done building the arm, I hope to have time to implement alternative methods of controlling it, such as by measuring brain activity via an EEG (Electroencephalography) headband.
At this point, I have successfully gotten all of the servos to work and be controlled by potentiometers. To get this to work, I had to learn how to use arduino’s servo library and then write arduino code. The code works by associating some of the arduino’s digital output pins with the servos and the analog input pins with the potentiometers. The code loops through each of the potentiometers, measuring the resistance (which tells it how far the potentiometer has been turned), mapping that value to a range of 180 degrees, and then moving the associated servo to that number of degrees.
I have also started creating a rough prototype of the arm made out of cardboard. I found this very helpful because it helped me see how everything would fit together and made me realize which different aspects of my original design need to be improved upon for the final version. For example, I discovered that I need to order another servo to allow the gripper to change direction. Otherwise, the area that the arm will be able to grip will be much smaller due to the fact that depending on the orientation of the multiple joints of the arm, the gripper might be facing the wrong direction. In addition, I discovered that if the bottom servo (the one that will rotate the entire arm) is not securely attached to the base, the weight of the arm can cause the servo to be ripped out of the base and cause damage to the arm.
My plan is to now take what I have learned from building the prototype and use it to improve my original design. Then I will begin the final version of the arm made of aluminum and wood.
MintyBoost Starter Project
For my starter project, I built the MintyBoost, a usb charging device powered by two double A batteries. The device works by sending the 3 volts from the batteries through a boost converter that raises the voltage to the 5 volts necessary to power devices such as phones and music players.
The MintyBoost has a number of components such as a diode that makes it so electricity can only flow from the battery to the USB port, not the other way. The four capacitors help stabilize the output 5 volts: the two ceramic capacitors deal with high frequency noise and the electrolytic capacitors deal with low frequency noise. The power inductor stores energy and converts low voltage to high voltage. There is a 3.3K ohm resistor in the center of the board that improves the devices ability to generate higher current. There are also 4 blue resistors (75K and 49.9K) which enable certain output devices to recognize that it is a valid charger. The boost converter chip (installed in an IC socket soldered to the board) controls when the inductor is charged in order to raise voltage. Finally, the 5 volts are outputted through a USB port.
The way the actual boost converter works is that the 3 volts from the battery go through an inductor (which stores current) and then through a transistor back to ground. Once the inductor is charged enough, the transistor breaks the charging loop, allowing the power from the inductor to go through a diode and be outputted through the USB port. Once the inductor charging loop is broken, the inductor raises voltage in order to maintain its output of current. This makes it so the voltage that is passed through the diode and out the USB port is 5 volts.
I really enjoyed making this project because it helped teach me more about electrical components and it allowed me to practice my soldering. If you would like to build your own, you could pick up a kit at http://learn.adafruit.com/minty-boost.