Hi guys. I'm extremely new here. This is my first dive into arduino, animatronics, and servos/actuators. Sadly I don't come from a background in electrical engineering, but I do have a few years of experience with programming so I should be able to handle Processing.
Anyways, I need help with this new project I'm attempting. I don't build RC vehicles or robots (yet), but I do make costumes. I need to use an arduino to control both a linear actuator and a servo motor. These will actually be integrated into a costume - lifting and spinning a sword scabbard around my back.
The intended functionality is to be able to flip a switch/press a button which will tell the microcontroller to send a signal to a Electronic Speed Controller (usually used for RC motors), which will command the linear actuator to extend and lift the scabbard up. Next the arduino will tell another servo to spin the scabbard 90 or so degrees clockwise. A second button press should reverse the process (spin the scabbard 90 degrees counter-clockwise and then retract the linear actuator shaft back downwards).
I know Linear Actuators with PWM exist, but for price, speed, and power reasons, I'm going for a Firgelli S model which comes with only 2 wires - power and ground. This is why I need the ESC. I researched a lot before coming here and was able to create a schematic around the Arduino Leonardo. I hope someone here will be able to check my work and see if the wiring makes sense/is feasible. I'm sure I made a few mistakes/oversights. I have no idea whether this thing will work or explode. I don't even know if the Leonardo is the correct choice for the task. Lastly, I know next to nothing about wiring and electrical components, so this schematic (if you can even call it that) is pretty ugly. Feel free to laugh at it, I know I did. But I'm here to learn and that's what counts.
Looking forward to hearing your ideas/thoughts/suggestions.
Edit: Sorry, the schematic has an arrow pointing to the Leonardo saying "Servo Battery Power." That should read "Battery Power" only - I'm planning to use a battery to power the Arduino. Should have nothing to do with servos for this particular detail.
Any drawing explains it a lot better than words. So the drawing is very good.
The wiring is okay. That should work.
Could you post a link to the linear actuator ? (just copy the url in your text).
A few notes:
- The Arduino Leonardo is specific for emulating a mouse or keyboard. The Leonardo Uno is the easiest board to start with. Since you wear it, you could use a Arduino Nano, or even a 'wearable' Arduino board.
- The power for the servo can be created from the 12V with a DC/DC converter.
- The power for the Arduino could perhaps be the Servo power, or you could use a second DC/DC converter. You could start by powering the Arduino with the 12V (without DC/DC converter).
- I'm not sure what the 220 Ohm is doing. A pushbutton is normally used with a 10k pull-up resistor to the 5V and the button to ground.
- The button will bounce. You need a debounce in software.
- If you have the components, start with the servo. The Arduino has a Servo library included. You should be able to get that running without problem (after you tried the 'Blink' example).
- Did you mean "Processing" as in "Processing" ( Arduino Playground - HomePage ). I don't know what that has to do with this. The Arduino uses normal C++ coding.
Hi Erdin. Thanks for the fast and informative reply.
Here is a link to the linear actuator: http://store.firgelli.com/L16_S_Linear_Actuator_p/l16-s.htm
You can find the technical data sheets on there too. I will use the longest stroke with the fastest gearing configuration.
I have lots of questions!
The reason why I wanted the Leonardo was because it connects via USB directly into the computer. I'm trying to simplify as much as I can to make things easier for me. I also considered the Arduino Micro, but since it has such a small form factor, I was afraid I might break it by being clumsy while working with it.
You mentioned that I could probably power a few of these components with the same battery. Could you teach me how that would look wired up? I'm not sure how I would construct the circuit. Currently I'm using 3 total batteries (the 12v, 1 for the servo, and 1 for the Arduino) so any reduction would be helpful to keep the weight/size of the entire package down. Even reducing the need down to a total of 2 batteries will make me happy. Which parts do you think use up the most energy? I don't have enough experience here to know what I'm doing.
About the 220 Ohm Resistor - I was just following some tutorial for a button I saw. I will note the changes you have mentioned. In addition to the 10k pull-up resistor going to the 5V and one coming from the ground, would I need 1 extra wire running from the button to a digital pin so that I can read what's going on with the Arduino to process it in the code?
Thanks for mentioning the bounce issue. I came across this in my research and will make sure the code takes care of it.
Processing - I heard that one from one of my teachers at the university, hah. I'll have to bring that up with him someday. I haven't written in C++, only Java. But the code I've seen so far seems easy enough to understand and use.
Also...is there a reputation or "thank you" system built into these forums so that I can +1 you?
That actuator is 12V and maximum 650mA (stall current).
That is not a lot. About every driver can do that.
I read : "The –P actuators have no built in controller". Do you want to make the controller with the Arduino ? Or will you use it only with a full stroke in both directions ?
The Leonardo and Micro are specific for Keyboard and Mouse emulation.
For you first project, I would suggest the Uno or perhaps the Nano.
The Nano is a small Uno, as the Micro is a small Leonardo.
It is not a big deal, but the Uno connects easier to a PC.
You could do this: Connect all grounds. Use a single 12V battery to the linear actuator and to the Arduino board. Use a DC/DC converter to 5V or 6V for the servo.
Like these: dc-dc for sale | eBay
It helps to make a drawing with a single long horizontal line as ground. Draw all components above that line, starting with the battery on the left. Don't try to make the drawing less wide.
For the button, go here, pighixxx.com
and open: "ABC – Arduino Basic Connections (ver1rev0)"
The first drawing on the left is the button with 10k resistor.
A few pages lower is the Servo motor.
Java is very close to the Arduino C++. The Arduino has many libraries included, and users have made libraries. So programming an Arduino is sometimes mainly finding the right library.
Under the name on the left is "Karma", but I don't care.
Thanks again for the reply. All of this is extremely helpful/useful/relevant information.
To be honest, I will most likely only use the actuator with a full stroke in both directions. However, being able to make adjustments to the stroke length might come in handy. If something doesn't fit/move right, being able to adjust the stroke length would save me. That is why I want to use the Arduino to send PWM signals and control the length of the stroke.
Uno it is then! Thank you!
With the information you have given me I will make another drawing and report here when I'm finished.
I see the Karma rating but I don't see any button or link that'll let me boost you.
retrolefty - ah, nice catch. that makes sense... PWM controls the speed of things like computer fans. hmm.
That basically removes the need for the ESC entirely then. I thought incorrectly that the ESC could control the position of the actuator's shaft. Not sure why I didn't realize that mistake. The actuator extends when powered, and retracts when the polarity is reversed. In that case...does this mean I have to find some sort way to reverse the circuit's polarity via Arduino & some special component to get the actuator to retract (not sure if it exists, but I'm sure there's something out there)?
Changing the speed at which it moves is not important to me because I will be using it at full speed.
Thanks for the reply.
I'm really curious now. A standard servo has 3 wires - the 2 DC power wires and one for PWM. I know that servos have built in potentiometers. If the PWM wire is to relay signals for the speed, how does the positional data get communicated to something like an Arduino?
-- I don't see a green karma plus symbol. Is there some type of rule that disallows newbies from +karma-ing others (perhaps to prevent artificial bumps I guess)?
Reversing polarity = H-bridge
So you need a motor driver with H-bridge.
For example a driver module or a shield with the old L298.
Or a driver module with mosfets.
Those H-bridge motor drivers can also control the speed with PWM, whether you need it or not.
The servo does not require just any PWM.
It requires a specific timed pulses. The timing will determine the angle/position the servo will go to.
The servo will do that with its maximum speed.
In theory that signal with timed pulses is some kind of PWM signal.
To move a servo slow, do this: Go to angle 10 degrees, wait 10ms, go to angle 11 degrees, wait 10ms, go to angle 12 degrees, wait 10 ms........
It's silly, but that is how it is done.
First off, let me say thank you for all the help guys.
Seems like the linear actuator part of this build is making everything a lot more complicated.
I've opted to drop it for another rc servo. They have so much more support and require less tinkering. I'll use a longer arm to get the amount of linear displacement that I need. The movement wont be perfectly linear, but at least it'll be faster than the actuator. I think it'll be fine.
I see that you guys seem to have a lot of experience with servos. Could you check my math for power?
Let's say the power a servo offers at max voltage is 250 ounce/inch.
Multiply that by 1 lb/16 ounces to get = 15.625lbs/inch. This means that a servo with this power rating can push 15.625 lbs with a 1 inch arm.
If I were to use a 4 inch sail arm, I would divide 15.625 by 4 to get about 3.9 lbs. This means that the maximum amount the servo will be able to lift with a 4" long arm is 3.9lbs? Is that correct?
Also, any recommendations for servo brands? Good prices for durable, dependable units.
I'll make another drawing for this new plan now and post here when I'm done. Will try to limit myself to a single 12v battery. Thanks guys.
I wish it was that simple. In practice it could be different.
The way I handle this, is to buy a few cheap items and learn along the way how to use it. Once I know what I need, I buy good quality.
This list can be sorted by torque, All RC Servos - Servo Database
A cheap 166 oz/in torque servo is for example the MG945. It is 6 dollars on Eby.
The specificiation: TowerPro MG945 Servo Specifications and Reviews
But you have to keep in mind that the MG945 family is perhaps the worst servo made, according to this review of the MG995, Review: Towerpro/Hextronic MG995 servo
I don't know which ones are good quality, but these dual ball bearing brushless motor servos look very promising, http://www.futaba-rc.com/servos/brushless.html
Want a simple way of adjusting actuator stroke... just add a motor run time,, eg if runs for 5 seconds will be 75% of stroke .
PS an easy way to control the actuator is with two relays , one to swap polarity over ( move in or out) the other to turn the power on/off to the actuator.
PS.... a little tip,, to make the actuator stop quicker, when you turn the power off , short out the actuator terminals , this acts like a break..
all the best