Shop OBEX P1 Docs P2 Docs Learn Events
Using the NARO servo — Parallax Forums

Using the NARO servo

HShankoHShanko Posts: 402
edited 2012-11-18 12:43 in Propeller 1
Back when the QuickStart board was made available I also ordered a few other parts. One was the Parallax sold Naro sub-micro servo. But other than a one-page sheet listing several servos, I don't see any other documentation.

I'm a newbie on servos, so have no idea what other circuitry is required to control this part. Is there a schematic for a Prop 1 to drive it?

I note it has a 3-wire header for the interface, but does not seem to have any 'Pin 1' marking. Or does it matter?

And is there any thing on the OBEX for this tiny servo?

Comments

  • ThricThric Posts: 109
    edited 2011-12-21 18:21
    Servos are very cool little actuators and this website gives an explanation much better than i can: http://www.societyofrobots.com/actuators_servos.shtml

    To drive a Servo motor all that the Prop has to do is send a PWM signal to the signal wire of a servo. This can be easily done using the Servo_32 object; http://obex.parallax.com/objects/51/. The length of the pulse defines which position the servo is at, in a range usually from -90 degrees to +90degrees.

    Because servos run at a higher voltage then the propeller its important that you add a 4.7k resistor in series with the signal line.
  • HShankoHShanko Posts: 402
    edited 2011-12-21 19:39
    Thank you Thric.

    I now have my homework and reading assignment all in one.

    A resistor in series with the signal line? I have no idea what is in that small-bodied servo, but I imagined a power driver so some sort would be required between the Prop and servo. OK, lots for me to get acquained with. Thanks again.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-12-21 19:45
    The series resistor is necessary only when the device connected to the Propeller is outputting a signal to the Prop. In the case of a servo, it's unnecessary, since the servo does not output a signal.

    BTW, a (Futaba-compatible) servo's wires are color-coded: black = Gnd; red = Vcc, white = signal.

    -Phil
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-12-21 19:54
    HShanko wrote: »
    Thank you Thric.

    I now have my homework and reading assignment all in one.

    A resistor in series with the signal line? I have no idea what is in that small-bodied servo, but I imagined a power driver so some sort would be required between the Prop and servo. OK, lots for me to get acquained with. Thanks again.

    The servo has its own power driver. That's one reason they're so popular in hobby robotics.

    Phil listed the colors for Futaba servos. Other brands might varry a bit in color but the middle wire is always Vcc, ground is either black or brown and the signal is usually white or yellow.

    Look in the "demo" folder for a demo of the servo driver Thirc mentioned.

    Servos are and easy way of getting a microcontroller to move things in the real world. You're in for a treat!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-12-21 20:23
    As far as wire order goes, IIRC, Airpax servos are different. (Are they still in business?)

    -Phil
  • HShankoHShanko Posts: 402
    edited 2011-12-21 22:48
    Thanks to Thric, PhiPi, Duane for 'showing me the way' to begin. Very helpful. I downloaded/printed/red the .pdf. Yes that was a very clear introduction. Also downloaded Servo32, version 7, which I hope to look at tomorrow.

    I have no plans except to learn something of servos. Probably will use a QS board. Hopefully the servo doesn't require too much current from the USB port. May be a while before more questions.
  • ChazChaz Posts: 18
    edited 2012-01-02 14:29
    I am also working with this servo, but I am developing my own program because I am using a hex inverting buffer. I am not very experienced with Spin yet so I could have made a very simple mistake so here is my code below:

    TestServo.spin

    CON

    servo = 8
    invHigh = 0 'inverted because of hex inverting buffer
    invLow = 1 'inverted because of hex inverting buffer

    VAR

    byte position
    long servoMultiplyer
    long milliSecond
    long period
    long pulseWidth

    PUB pwm

    position := 30
    servoMultiplyer := (0.0000055556*clkfreq) 'cycles/degree came from half a millisecond divided by 90 degrees because the servo has a range of 180 degrees over 1 whole millisecond
    milliSecond := (clkfreq/1000) 'cycles/milisecond
    period := (clkfreq/50) 'cycles/period
    dira[servo] := 1
    outA[servo] := invLow

    repeat
    pulseWidth := ((1.5*milliSecond) + (position*servoMultiplyer))
    outA[servo] := invHigh
    waitcnt(pulseWidth + cnt)
    outA[servo] := invLow
    waitcnt((period - pulseWidth) + cnt)

    Any help would be greatly appreciated. I am trying to get degree control of the servo and so far my success has been limited to specific values of the multiplier "1.5" for the pulseWidth. For some reason 1 and 2 work really well but nothing else. I would love to look at this on an oscilloscope but mine is currently not working. I think there may be an error in the waveform this program is using but since I don't have access to an oscilloscope I thought someone may see something I am not.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2012-01-03 08:43
    Why not use Servo32v7.spin in the library that comes with the Prop Tool?

    John Abshier
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-03 11:50
    John, I'm pretty sure Chaz is using an inverter so Servo32v7 wont work without some modification.

    After looking at Servo32v7, I can see changing it to an inverted signal is beyond my present abilities.

    Maybe it wouldn't be too hard for someone else.
  • DaveJensonDaveJenson Posts: 375
    edited 2012-01-03 12:13
    Chaz: Why the inverters?
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-01-03 12:57
    Assuming there are some extra inverters on that chip, just pass the output back through another inverter, and it will revert back to normal polarity. Easier than changing code and then maintaining a separate version.

    -- Gordon
  • PublisonPublison Posts: 12,366
    edited 2012-01-03 15:59
    The question to the OP remains, why the hex inverters ? The propeller will drive Analog or Digital servos directly.

    Why complicate matters. As John A. said, why not use Servov7.spin?
  • ChazChaz Posts: 18
    edited 2012-01-03 17:09
    The reason I am going for inverters is to restrict the amount of current draw from the propeller. I will be controlling four or possibly five servos and four electric speed controllers. If these will not pull too much current from the propeller then I would like to do away with the inverter. Does anyone have know how a electric speed controller interprets the signal and how much current that will pull? This was the main reason for the inverters.

    Thanks,
    Chaz
  • PublisonPublison Posts: 12,366
    edited 2012-01-03 17:21
    Chaz wrote: »
    The reason I am going for inverters is to restrict the amount of current draw from the propeller. I will be controlling four or possibly five servos and four electric speed controllers. If these will not pull too much current from the propeller then I would like to do away with the inverter. Does anyone have know how a electric speed controller interprets the signal and how much current that will pull? This was the main reason for the inverters.

    Thanks,
    Chaz

    Chaz,

    All your servos and ESC's should be powered with a supply separate from the Propeller, (of course with common grounds).

    The outputs from the propeller can directly control the servos and ECS's, even though it's only 3.3 Volts, most, if not all servos and ESC's will work from this voltage. No need for buffering.

    The ESC's are not drawing current from the Propeller. They are drawing the current from the battery connected to it. The propeller is just providing the appropriate (3.3 Volt) signal to tell it how much power to apply to it's outputs,(motors).

    Same with the servos. They are powered from a separate source, and the signal is from the Propeller.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-01-03 17:28
    Chaz wrote: »
    The reason I am going for inverters is to restrict the amount of current draw from the propeller

    A simple resistor will do this, but if you need true isolation and full protection you can use an opto-isolator. You have the option of wiring it for an inverting or non-inverting signal.

    An inverting buffer offers no more protection than a non-inverting buffer, which is also available. You might as well use a non-inverting buffer if doing so will simplify the software.

    -- Gordon
  • PublisonPublison Posts: 12,366
    edited 2012-01-03 17:38
    I believe we have hijacked Harley Shanko's thread.

    Sorry for that.
  • HShankoHShanko Posts: 402
    edited 2012-01-03 19:01
    To All or Anyone,

    Don't worry, I don't feel it was hijacked.
    There was too much happening in the past weeks.
    Hopefully I will soon get something working.
    I've been following what's been posted here. Helpful for me beginning in a new area.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-01-03 21:07
    Oops! Hadn't realized the questions might not have been fully answered.

    Though this page is for the Parallax Standard servo, the information applies equally well to the GWS Naro servo:

    http://sites.google.com/site/parallaxinretailstores/home/parallax-standard-servo

    The diagram shows connecting to a QuickStart. The example uses the Servo32v7.spin object, which is on the Obex, but for your convenience is already in the download for the QuickStart code.

    The Naro that Parallax sells uses the Futaba connector and color coding, as Phil points out. Pin 1 is white, or signal, and is physically denoted on the connector with the little notch.

    There are some examples for the BASIC Stamp (and maybe Propeller) that show a series resistor inline on the signal pin, but such a resistor, if used, is intended to prevent damage to the controller should the servo be damaged and draw excessive current through the signal line. This is very rare, if it ever happens at all, and shouldn't be an issue with any modern servo.

    -- Gordon
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-01-03 21:17
    HShanko wrote: »
    Hopefully the servo doesn't require too much current from the USB port.

    Gotta be careful here as powering the servo through the QuickStart connected to USB can pose a danger to the USB port (though your PCs ports are probably protected, why take the risk).

    The KickStart example I mentioned above shows how the servo should be connected, using a separate battery supply.

    Note that the Arduino example does indeed draw power through the USB connection. This is permissible because the Arduino incorporates a resettable polyfuse that trips if current demand through the USB exceeds 500 mA. That's the typical current cap for USB 2.0.

    -- Gordon
  • ChazChaz Posts: 18
    edited 2012-01-03 22:29
    Thank you for everyone's help. I have the Servo32v5 up and running perfectly. I am using a separate 1 amp 5 volt regulator and it seems to be working well for powering the servo's power pin. I did attempt to use a 9 volt battery at first to power the 5 volt regulator but it could not supply the current needed so the servo gittered back and forth but once I plugged it into my 9 volt 1 amp wall adapter it works perfectly.
  • HShankoHShanko Posts: 402
    edited 2012-01-04 15:31
    Today I tried Beau's Servo32v7_RampDemo on a QuickStart board. I was pleased that it ran OK in RAM so I could 'scope channel 1 (P0). (I don't have the i/f wired in yet for the actual servo. Thank you for this gem, Beau.

    To be able to see it really working, I added a repeat before the first SERVO.Set and a repeat(800000) after the last SERVO.Set instruction. That let the signal slew from 2ms to 1 ms to 1.5 ms and repeat. Else the 'show' was over before I could scope what's happening. I also substituted instead of the last SERVO.Set a SERVO.SetRamp to smooth out the 'snap action' that was occuring in the original source.

    (gripe) Unfortunately, using Parallels/Windows on my iMac, something has gone really bad. It takes like almost an hour for me to get the PropTool launched; the HD is constantly cycling the head, doing what I don't have the slightest idea. And I have to quit Parallels/Windows to use the iMac side after that. So is might painful to get much done without getting very impatient. Thus, to access the PropTool again means I have to go through that long launch each time. Makes me feel like someone took my iMac away and stranded me on 'PC Island' when the PC is an ancient PC running in molasses. (/gripe)
  • courtenscourtens Posts: 101
    edited 2012-11-17 13:01
    Duane Degn wrote: »
    After looking at Servo32v7, I can see changing it to an inverted signal is beyond my present abilities.

    I feel the same way ... beyond my abilities. But must be doable! Can anyone help? I would like to us my inverter, and would really like to not add another IC inverter just to be able to use Servo32v7. Maybe the Author: Beau Schwabe can help?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-11-18 09:02
    courtens wrote: »
    I feel the same way ... beyond my abilities. But must be doable! Can anyone help? I would like to us my inverter, and would really like to not add another IC inverter just to be able to use Servo32v7. Maybe the Author: Beau Schwabe can help?

    Why the inverters? Are they already on the board? As has been mentioned a couple of times in this thread, a resistor is enough to make sure the servo doesn't draw too much current on the signal line.

    I usually use servos with just a wire between the servo and Prop pin.
  • courtenscourtens Posts: 101
    edited 2012-11-18 12:32
    Duane Degn wrote: »
    Why the inverters?
    I am using all the I/O pins of my QuickStart board in this particular project, and I do not want to start figuring out my current draw on the propeller chip (max current draw must be limited to 300 mA.)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-11-18 12:43
    courtens wrote: »
    I am using all the I/O pins of my QuickStart board in this particular project, and I do not want to start figuring out my current draw on the propeller chip (max current draw must be limited to 300 mA.)

    Servos don't draw current on the signal line. The link I used above shows a QuickStart driving 32 servo with direct wire connections. No resistors or anything else. If you are worried about current draw (which you don't need to be in this case) you can use a resistor on the line as mentioned previously.

    The demo I mentioned uses all 32 Prop I/O pins.

    I often use a separate power supply for the servos as I did in the 32 servo example (the center wire powers the servo). When using a separate power supply make sure the two supplies share a common ground connection.
Sign In or Register to comment.