Software > Software

Servo Code

(1/2) > >>

Mastermime:
Hello,  I used Webbotlib Project Designer to generate some code to upload to my Axon II, however I wasn't able to add a servo into Project Designer because there was no suitable power source for it.  My hardware solution was to put a put a linear regulator inbetween the 12v pin and the servo to drop it down to 5v.  I stiil couldnt generate the files though with that servo so I thought I could just add it later. 

So my question is, how do I add it into my AVR file so everything will remain properly configure?  Also, what code should I use to control a modified servo for continuous rotation?

newInRobotics:

--- Quote from: Mastermime on November 26, 2012, 11:11:30 PM ---My hardware solution was to put a put a linear regulator inbetween the 12v pin and the servo to drop it down to 5v.
--- End quote ---
Let's say that under load servo draws 1A, You want to drop 7V with linear regulator, that equates to 7W of wasted power and probably something that Your linear regulator is not capable of. Much better to use either separate power supply (say 2 Li-Ion batteries giving You around 7.4V, or a switching regulator which will nicely step down voltage from 12V to whatever You want without overheating).


--- Quote from: Mastermime on November 26, 2012, 11:11:30 PM ---So my question is, how do I add it into my AVR file so everything will remain properly configure?
--- End quote ---
In project designer just add separate 5V power supply to keep program happy.


--- Quote from: Mastermime on November 26, 2012, 11:11:30 PM ---Also, what code should I use to control a modified servo for continuous rotation?
--- End quote ---
Modified servo is controlled the same way unmodified is. The only difference is that PWM no controls speed and not position.

Mastermime:

--- Quote ---Let's way that under load servo draws 1A, You want to drop 7V with linear regulator, that equates to 7W of wasted power and probably something that Your linear regulator is not capable of. Much better to use either separate power supply (say 2 Li-Ion batteries giving You around 7.4V, or a switching regulator which will nicely step down voltage from 12V to whatever You want without overheating).
--- End quote ---

I'd rather not add a whole other battery just for a servo.  The Hitec HS 625MG servo draws only 250ma.  Thats 2.1W wasted.  I could build a current boosting circuit using a power transistor.


--- Quote ---In project designer just add separate 5V power supply to keep program happy.

--- End quote ---
How would I add it to the AVR file or would this just cause more issues?

Mastermime:
Ok I configured the servo in there just fine.  I dont care about the speed since I'm just using the servo to pan a camera.  Could someone just post a small code snippet of what I should use?  Could I do something like this? I dont want the servo to be at max speed. I want to set to slower speed but dont know how?


--- Code: ---if (tempbyte == 'x')
    act_setSpeed(&center,DRIVE_SPEED_MAX); 
    return 0;

--- End code ---

newInRobotics:
If You are using unmodified servo there is no nice way to set speed as servo set's its own speed based on distance it has to travel, the further it goes the faster it does so. You can, however, make it run in segments, which will decrease speed.

Navigation

[0] Message Index

[#] Next page

Go to full version