This Project is really special. I bought a MeArm (a popular, easy-to-find, inexpensive and easy-to-assembly Robotic Arm) . After putting everything together, I started with some typical stuff such as making it work with potentiometers in order to pick up some objects. It was nice at the beginning, but I got tired of it , so I decided to move on to something cooler. What I had in mind was to make my MeArm work on its own, detecting objects by itself, picking them up and eventually dropping them to a small bucket. Me just watching!!! In other words, I badly needed some way to tyde up my table once and for all. I started by google-researching similar projects but didn´t find much, so I had to start hardly from scratch. At first glance it seemed a challenging thing to be done, and after getting down to work it turned out to be even harder than expected. The good point: I ended up learning a bunch of things about Arduino and robotics, and it was really fun. And of course, when you see the final result…well, it is worth the effort!
If you are interested in doing one of your own, I can save you most of the problems that I had (and believe me, I found a lot of them) and I can provide you with some explanations, tips and my code. With all this stuff, it should be rather straightforward to get there, so get ready and get down to it!
Step 1: Materials
Of course add your MeArm and some wire. To feed it you will need 5-7V (using batteries or a transformer)
Step 2: Connections
Here I included everything I have in my setup. If you do not want to use the pushbuttons or the potentiometers, just take them away. Since Fritzing does not supply my v5.0 shield, I draw the scheme without it.
Step 3: Built Up Your MeArm With 4 Potentiometers
I first built up the arm with four potentiometers. You won´t be using them in the final project, when your arm works automatically, but at the beginning they are capital to calibrate and tune the arm, and to find the parameters you need in your arm. Here are some links down here with very clear explanations:
In this great youtube clip by DroneBot Workshop, everything is clear. They show you how to build a MeArm controlled by 4 potentiometers:
Here some other useful links: https://cdn-shop.adafruit.com/datasheets/Pocket-S...
please follow instructions carefully, they are easy to follow but if you miss one single step you are probably going to end up moving back to square one again, so make sure everything is ok before moving up to the next step. Once you complete this part, here is my improved sketch so that you can try it out. This sketch uses the EEPROM memory, very useful to avoid the typical initial jolts of the servos when reseting your Arduino. The code stores in the EEPROM memory the values of the servo positions before switching off or reseting it, and if in the meantime for some reason you move the potentiometers, it will go smoothly to the pot position. Cool!
...and If you just want the typical basic one, here it is
Step 4: Connect Pusthbuttons (optional)
This step is optional, but I find it particularly useful while the Arm is moving and something wrong happens, you just press the help-button then , and everything stops right on time…very useful stuff in my opinion. You will see at the sketch that those pins are defined as “INPUT PULL_UP”, this way you use an internal 20K before the 5V signal. By using these buttons the code gets longer and more difficult, involving Interruptions, but everything is written down there at my code, so don´t worry much about it if what you want is just a “plug-and-play” robot.
Step 5: Time to Connect the Acoustic Sensor
Glue the acoustic sensor to your robotic arm as in the pictures. If you want to run some checks on your sensor, here I hand you this testing-sketch. That code runs several types of measures: taking (200/100/20/5/1) measures, then calculating the average value . Of course taking 200 measures to calculate the average is , in theory, more accurate, but It also takes a lot of time, and since the arm is always moving it is better to do the average over 5-20 measures at most.
Step 6: The Sketch
Now comes the software part. Before uploading the code, you are going to need the library NewPing.h. With that library you will control your HC-SR05 acoustic sensor more precisely. Once you got it, just upload the sketch and start playing with your cool MeArm robot!
Step 7: Some Final Remarks
The kind of objects that you will want to use for your project will be the small, square-like, cardoard-made ones. Don´t even try curved-cross section objects, this acoustic sensor proved to be absolutely dumb with them. Even following this tip, this HC-SR05 sensor makes mistakes every now and then no matter the distance or the conditions, and proved to be absolutely unreliable at short distances (specially under 5-6 cm) In addition, the claw is quite a simple one, and it must be almost perfectly perpendicular to the object to succeed on picking up the object. Of course all these details made the project harder than expected, but I bypassed most of the hard stuff by modifying my initial sketch. But finally I got there!!!
If you have any suggestions on the code to make it simpler, more efficient or elegant, or about anything, or you just need some more help let me know!!!
Hope you enjoyed it!!!