hello ,
I’m trying to make my own Digital Compass Modules as shown here
https://www.youtube.com/watch?v=sBKHdt0OdPg
I have done almost everything , my problem is in the part that make the servo rotate
I don’t know how to make the servo rotate according to the HMC883L
can you help me with this ? show me the part of the code for the servo ?
Thanks,
Code ? For what platform, PIC, Arduino, ???
You might want to read this …
http://arduino.cc/en/reference/servo
But be aware most hobby servos advertise a 0 - 180 degree range and actually do a little less. You can get wider range servos but I doubt they will do a full 0 - 360 degrees.
code for Arduino
I have read the page - and it didn’t help
my servo is 720 degrees (for sure) , but for start I want to see it work like post in the youtube channel
Aaah I forgot about sailwinch type servos. If yours (a link might be nice as we here can’t read minds) is a typical analog servo, then it works like a typical 0-180 servo. Except that a 180 degree command will get you 720 degrees. And a 90 deg command gets you 360 degrees. So all you need to do is use the standard library as shown on that page and map the 0-360 degrees of compass angle into the 0-90 degrees of servo command. To restate the obvious, the servo command is the compass reading/4.
If your servo uses an extended pulse width to get the 0-720 degrees of motion, then the same logic as above applies and you can command pulsewidths, in usec, instead of degrees.
See if you can follow the example here.
http://arduino.cc/en/Tutorial/Knob
http://en.wikipedia.org/wiki/Servo_%28r … Connection
http://www.servocity.com/html/how_do_servos_work_.html
this is the servo I have
http://www.ebay.com/itm/121173284235?ss … 1439.l2649
I have read all the information in wiki and servocity - I get the theory. but when I try to use it , I get loss
even when I tell the servo to move to 22 - it make 2 circles.
I don’t know what I’m doing wrong
is there no why I can see the code that was used in the youtube? - just to see the part of the servo ?
thanks ,
even when I tell the servo to move to 22 - it make 2 circles.
Let's see if that makes sense. First off let's see what servo you have. The link says ...
Sail Winch Servo 55g metal gears 10.63kg torque 6 Turns travel
So it’s not a 720 deg servo, it’s a 6*360 = 2160 deg. A 22 deg command is 22/180 = 12.22% of a normal servos full range. 12.22% of 2160 deg is 264 deg, not even one turn. But then again each degree of command is 12 deg of rotation (ideally), and this servo might us a wider pulsewidth (than normal) for it’s turns.
So your command is about correct, certainly not 2 turns of command. Given the reviews I read over at HobbyKing for the 4 turn version of this servo (SW5513), it may well be that yours is broken. It seems to have quite a high failure rate.
http://www.hobbyking.com/hobbyking/stor … g_0_9.html
so from what you are saying - (just to see I understand )
if I tell him:
servo.write(13) - it need to do 1 full turn ?
also - is there any way to be sure it doesn’t working well?
some test code that show the store that it doesn’t work correct?
Thanks,
david1234:
servo.write(13) - it need to do 1 full turn ?
I don't understand what you mean by the above. Are you trying to say you did a test and that when you commanded 13 deg you got 1 full turn ?
is there any way to be sure it doesn’t working well?
I would use the .writeMicroseconds() command and determine both the smallest command the servo will accept and then the largest. Then write a program that goes from the smallest time to the largest in steps of 100 usec and note the rotation at each command. It should be a nice linear relationship and show ~ 6 turns (if you bought a 6T servo). If it doesn't then it's broken.
BTW what it supplying the (? 5v ?) power to the servo ? I hope it’s not the Arduino regulator. It’s not powerful enough for this type servo.
I’m using en external power supply (5V 1A )
I’m trying to to do as you told me
but I did:
Servo .writeMicroseconds(n)
n=1000 - did 3.5 turn CW
n=1100 - did 2 turn CW
n=0 - did 5 turn CCW
no logic …
Hmmm … OK let me think about that. Perhaps you should make a list of position vs command for n = 700 to 2300 in steps of 100 usecs.
What Arduino do you have ? And what have you selected as the target/board type in the Arduino IDE ?
I have mange to find that
writeMicroseconds(n)
n=550 → some kind of 0 position
n=630–> going ~180 degrees
n=690–> going ~360 degrees
I’m using Arduino Ethernet (without POE)
Sounds like it’s a lot more than a 6 turn winch. Continue to find out what usec commands get you 1 turn, 2 turns, 3 turns … etc up to a pulsewidth of 2500 usecs. Send that data to the vendor and tell him it’s not working like a 6T winch should.
Ideally a 2T winch is all you need. That way you’re guaranteed to get a full 360 degrees of rotation and it’ll have better resolution than a servo w/more turns.