NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Sensors, Actuators, and Robotics » Cheaper Alternative Servos?
February 02, 2011 by missle3944 |
Hi, I am very interested in controlling a servo with my nerdkits MCU, but the servo that you guys recommend costs $15. I'm just a High School student that cant afford a micro servo for almost $20 I found some much cheaper alternatives to the servo on hobbyking.com that look to be just as good. I had this one in mind but I don't know if it meets up the specs of the MCU. Also, feel free to make any suggestions. Sincerely, Missle3944 |
---|---|
February 02, 2011 by missle3944 |
Sorry, I forgot to put a period (.) in between 20 and I. So please dont get confused if it sounds like I think it is 20 dollars -missle3944 |
February 02, 2011 by Rick_S |
That servo would work fine, other than its extreme small size. It's only about 1" x 3/4" x 5/16". If tiny is what you need, it will work fine. Rick |
February 02, 2011 by missle3944 |
Hi Rick, Thanks for the quick reply. Anyway I did not realize it was that small. I guess I don't need anything too big. I'll probably purchase it then. -missle3944 |
February 17, 2011 by devinsbusiness |
I have purchased LiPo batteries from hobbyking.com. What a bargain! I will warn you though. The stuff you purchase from them is coming directly from China to you, so the shipping can be expensive ($40 worth of batteries cost $20 to ship) and it will take a while to get what you order. I think my batteries took around 3 weeks to get to me. That aside, they have decent stuff for very low prices. Good Luck, Devin |
February 18, 2011 by missle3944 |
Hi, I just wanted to get back to you guys on the servo. So far it works really well and I hope to get 1 more because it was such a good buy! If anyone would like to view the video that I made on the servo it is right here! |
February 18, 2011 by Ralphxyz |
missle3944, enjoyed your video. Since you are getting number value feedback you "should" fairly easily be able to extrapolate degrees. What is the value returned when looking straight ahead? What is the value returned 45˚ to the left? What is the value returned 45˚ to the right? Can you get 180˚ if so what is that value? Ralph |
February 19, 2011 by missle3944 |
Hi Ralphxyz, Well it seems hard how I would be able to get degrees from the servo. At 180 degrees I get 4450 farthest and then at 90 degrees I get 3100. Would I have to create an equation to just convert the servo position to degrees. -missle3944 |
February 19, 2011 by Ralphxyz |
Probable with what you have said so far you could do a if() statement:
There will need to be much refinements but that would get you started. You probable want to use a switch/case statement instead of a bunch of ifs. Potential you could have 360 conditions, so you either need to settle for less or dig in to learning C. You might be able to use a for() statement to cover the various conditions. For now get it working with the if statement or even the case/select. Let's see what you can do. Ralph |
February 19, 2011 by missle3944 |
Hi ralphxyz, Before I made the video I thought about 180 diffrent if statements and how long and inefficient that would take. I am thinking more along the lines of using a mathematical equation to do that. It sounds like it would be darn hard though. -missle3944 |
February 19, 2011 by mongo |
It seems that the values change with different servos. Some may work at the initial settings but others might not. I had to adjust the values in order to get my Futaba servos to respond properly. It's not all that difficult. |
February 20, 2011 by Ralphxyz |
missle3944, so just start with Front, Left, Right and Back and get your code running. Then you can start refining it. Of course when you get stuck (not if) we'll be here to help out. But I want to see something working first, you had said in your video that you were confused by the numbers so let's see if you have made sense of them and can use them. Ralph |
February 20, 2011 by missle3944 |
Ok I'll start out like that first and I'll see what comes out -missle3944 |
February 20, 2011 by rkuykendall |
Missle3944, I would say follow your first thought on coming up with an equation that will convert the numbers into degrees. It won't be as hard as you think. You will need to come up with more than just the two points of reference to get it done though. I would imagine that the points would plot linearly. Look up linear regression and see if you can't get it figured out. The if statements would be imho really really ugly code, but if you decide to go that way may I recommend a slight change. You don't want to use == in your if statements unless you are truly going to use 360 of them, this would cause them to run only if you are at that exact value. What you would want to do is determine the size segment you want to use and then use something along the lines of
adjusted and repeated for your segment size and your observations. But again I would highly recommend using an equation to convert. |
February 20, 2011 by missle3944 |
Hi rkuykendall, Thanks for your good reply. I researched linear regression and it seems to be very hard. I get the concept of it but the equations look killer. I dont really get the if statement you posted. Do you mean that if it comes within being smaller than 4451 and bigger than 3775 than it will be 180? If you walk me through the linear equation I think I will get it. Right now I am only in geometry and physics and the only thing I know about graphs is y=mx=b and y-y1=m(x-x1) |
February 20, 2011 by rkuykendall |
I just did a search myself and the wikipedia page is pretty intense, a lot of theory you probably don't need. Try this page instead, it's much simpler. As you can see you will get the equation of a simple line y=c+mx where x and y are you variables, c is a constant that is the y intercept, and m is the slope of the line. And fortunately there are quite a few online calculators that will fit the data for you. First of all you need see if the linear model will be a good fit. I would recommend making several more observations, possibly at 45 degree intervals, using either full right or full left as your zero point. Plot these and see if generally you can draw a straight line through them. If so then you will most likely get a good fit. Feed these data pairs into one of the calculator and see what you come up with. Also you understood my if statement exactly. I'm not a c programmer so I'm not sure the syntax is exactly correct, but that is logic. Also I forgot a semicolon, which I seem to do quite frequently :) |
February 20, 2011 by rkuykendall |
Looking around and doing some research it seems like the proper syntax for the if statement might be
|
February 21, 2011 by Ralphxyz |
Now we are getting somewhere but I have a few questions. missle3944, you have only given us a value for 180° (4450) and a 90° (3100) reading? Is that 90° to the left or to the right? So what do you get on the other hand? If you get 7750 that will be a nice linear progression but I somehow do not think that is what you are going to get. What do you get at straight ahead? This is why I asked for Front, Left, Back and Right? I may be wrong but I do not think you will see 8888 when you are just turned a bit to the right, though that would be really neat if you did. So let us know what you get. Ralph |
February 21, 2011 by missle3944 |
Hi, oK I think I messed up on the measurements because my servo only goes 180 degrees or half a circle... |
February 21, 2011 by rkuykendall |
You're fine, just make new observations. You could also look up hobby servo PWM protocol which will give you a lot of the theory behind this setup. You seem to understand most of whats going on since you were able to modify the code to run at different speeds. |
February 21, 2011 by Ralphxyz |
I was wondering about that also, I do have a continuos motion servo that rotates 360˚. Like rkuykendal said you are doing good, now what numbers are you getting for straight ahead, left and right. I have a similar project for my weather station, the weather vane (wind direction) might use a Magnetic sensor Module I believe that also will just return a number. Also I just found some continuous turn potentiometer from a ebay vendor I would get a linear number from that also. In other words when you get your code working to delineate position, I'll cop it, if you publish it, which I am hoping you will. Once we see your numbers for straight, left and right we should be able to set directions in code. You are really doing great. Ralph |
February 21, 2011 by rkuykendall |
Actually after looking at the code, watching the tutorial video again, and doing some reasearch I understand what's going on here. The comments under the pwm_init function really did the trick. Missle3944, if you think about just a little more I'm sure you'll have a big aha moment and everything will fall into place. Keep in mind that it's all about timing and the width of the pulses, hence pulse width modulation :) If you just can't figure it out and get frustrated post and I'll try to spell it out. |
April 04, 2011 by Ralphxyz |
So missle3944, how did you ever come out with this project? I'd like to see what you ended up doing. Ralph |
April 04, 2011 by missle3944 |
Hi I am hoping to reapply ths to one of my projects because i just broke my wrist snowboarding and i hope to use my nerdkits to aid me. Once i get back from snowbardi g ill start working on my project |
Please log in to post a reply.
Did you know that you can use a transistor to interface between different voltage levels of digital logic? Learn more...
|