Ok so I am working on a little project to make a robotic arm. I want to put a camera on this arm and use it to film insects with. I am a wildlife cameraman and this arm would allow me to get some really cool and dynamic shots.
What I have done so far: I have built an arm that can carry the camera. It is powered by 6 stepper motors. These are all wired to individual DM542T stepper motor drivers which are powered by a 24v DC power supply that is plugged into the wall. Here is a diagram of how it is wired together. I did not make this diagram , rather Chris Annin who designed this robot. I’ve merely modified some things to make it suit my purposes.
The arduino and the servo motor is powered by a separate 5v power supply.
The arm is controlled by an xbox one controller that is plugged into an arduino mega via a usb host shield. I have written some code that will move the arm when I move the joysticks/press buttons on the controller. Left hat forward is track forward. Left hat back is track back. Right hat forward is up (because look inversion is weird) right hat back is down etc.
The focus motor is a servo motor that I strapped to the lens and is controlled by the xbox controller triggers. One is pull focus back the other is push focus forward.
Everything is plugged in and works relatively well. See this short video demo.
The problem that I have is that when I try to do several things at once like track forward, look down and pull focus the robot will get very slow. Several things have led me to believe that this is a clock speed problem with the arduino. It just can’t handle reading the information off of the controller and writing the information to the motors in real time. This blog post and this forum post both supports this conclusion, as have several others that I have come across.
Here are some of the possible solutions that I have considered, but they would involve a fair amount of time and money to execute as well as some major changes to the robot/code and so I just wanted some feedback before going down any roads.
1) Multiple Arduino’s. Use 2-3 megas attached to 2-3 motors each. The problem with this is that I don’t know if I can get multiple wireless receivers to read information from the same xbox controller. Does anyone know if this can be done?
2) Use a computer with more processing power. Like a Raspberry pi. I already own one of these. But I worry that there is no easy way to transfer the code from the arduino to the pi. Especially considering the hardware involved.
3) Optimize the code. My code is pretty simple. I am after all a wildlife cameraman not an engineer so there could be a lot of things I could tidy up. I’m not sure how to post pages of code on reddit. But if you think this would be useful, I could find a way to get it online.
My question is this; Do you think that it is a clock speed problem? If so, what solutions do you think are possible? If not what else could it be?