Shop OBEX P1 Docs P2 Docs Learn Events
servo controller help - Page 2 — Parallax Forums

servo controller help

2

Comments

  • TtailspinTtailspin Posts: 1,326
    edited 2012-01-22 22:38
    Go! erco Go!
    Holy cow, just how many servo's can one poor little BS2 handle?
  • ercoerco Posts: 20,256
    edited 2012-01-23 13:02
    al1970 wrote: »
    Your formula may be true for the BS2; I don't know, I never used one.

    @al1970: Per Duane, Mike's spot on here. He was talking specifically about a BASIC Stamp 2, a fairly slow single-threaded uC. Mike speaks from his vast experience with a BS2.

    I suspect the cheap servos I used in my video may have contributed to my apparent success. The pulse rate they are getting is surely well below the recommended 50 hz. I'm sure someone will 'scope the outputs of my program and post the refresh rate before I ever get around to it...

    I found out from my CR thread at http://forums.parallax.com/showthread.php?135382 that cheap servos actually perform better in some situations. I'll have to retest with some higher quality servos and see if my results change. It's possible that better servos are more demanding and may glitch before the cheapies do. Wouldn't that be something...?
  • Martin_HMartin_H Posts: 4,051
    edited 2012-01-23 13:30
    It's a neat demo Erco, but I suspect it will fall over if you were to try to couple it with sensor reading or calculation.

    Also, is using a propeller with the Obex servo controller object cheating? It's not a servo controller!
  • ercoerco Posts: 20,256
    edited 2012-01-23 13:52
    Hey, it's doing 8 calculations and 8 comparisons per loop! I'll add more if you want. Is THAT what you want, to see the Stamp FAIL? :)

    And yes, anything newer than Y2K is cheating! BS2s, relays and plywood hearken to an earlier, more innocent time...!
  • ercoerco Posts: 20,256
    edited 2012-01-23 19:46
    Strange happenstance: my test setup works exactly the same without a common ground between the batteries. 9V powers the BS2 HW board and a 6V gel cell for the servos. Something in the air I guess...
  • Martin_HMartin_H Posts: 4,051
    edited 2012-01-24 06:08
    Not connecting the ground is like crossing the streams. Who knows what will happen!?
  • ercoerco Posts: 20,256
    edited 2012-01-24 08:26
    ServoNet has become self uh-WAY-uh...
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-01-24 10:08
    Erco,

    You can speed up the loop between pulses by about 3ms by converting your IF/THEN statements to a formula... that would allow a few more servo's. :-)

    BTW) The DO/LOOP has no timing difference than a GOTO... I just prefer DO/LOOP's
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    W0=400
    W1=469
    W2=538
    W3=607
    W4=676
    W5=745
    W6=814
    W7=883
    x CON 5    'step
    j CON 400  'minimum pulse width
    k CON 550  'delta pulse width
    DO
    PULSOUT 0,W0+j
    PULSOUT 1,W1+j
    PULSOUT 2,W2+j
    PULSOUT 3,W3+j
    PULSOUT 4,W4+j
    PULSOUT 5,W5+j
    PULSOUT 6,W6+j
    PULSOUT 7,W7+j
    W0=(W0+x) // k
    W1=(W1+x) // k
    W2=(W2+x) // k
    W3=(W3+x) // k
    W4=(W4+x) // k
    W5=(W5+x) // k
    W6=(W6+x) // k
    W7=(W7+x) // k
    LOOP
    
  • ercoerco Posts: 20,256
    edited 2012-01-24 10:49
    Thanks, Beau! I knew I wouldn't have to wait long for some jeen-yus to improve my code. Will try it when I get a chance.
  • Spiral_72Spiral_72 Posts: 791
    edited 2012-01-24 13:20
    Erco! That's incredible man! Eight servos. I think eight is the number you give me when I "Calculated" a maximum of ten a couple months ago. So now we know for sure :)
  • ercoerco Posts: 20,256
    edited 2012-01-24 15:16
    @Spiral: Mi scuzi, senore. You no understand.

    I haven't finished. No one cued the fat lady to sing. Eight servos are demonstrated, but that number is not a demonstrated limit. In fact, Beau just cut 3 milliseconds from my routine and there's room for expansion. Now the fun begins!

    I just have to find by big bag o' servos, they are temporarily misplaced in my robot lab. The victims of a hurried Christmas cleanup.

    Stay tuned!

    BTW, where's Duane and his QS servo driver? :)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-25 07:18
    erco wrote: »
    BTW, where's Duane and his QS servo driver? :)

    I've been looking for humidity sensors, I misplaced in my robot/chemsitry lab. I found them yesterday less than two feet from where I'm sitting now (there's a lot of stuff within two feet of where I'm sitting).

    Plus as a relatively new Cubmaster, I've been modifing our Nerf Vulcan to use LiPo batteries to use at our Pack Meeting tonight. I've got this cool gizmo to monitor the voltage of each cell of the LiPo that will be attached to the side of the gun as a space age power monitor. (It's pretty darn cool, if I do say so myself. (thanks erco!))

    I've got to finish programming the game software. By game software, I really just mean code that will countdown a time on a display made with six of these 7-segment displays.

    I did write some code that should oscillate 28 (to start with) servos. Each servo can have independently set endpoints and oscillation frequency. I figure it will be easier to demonstrate this code when my recent order of servos arrives from HobbyKing. I received an email from HK ten days ago saying the servos had been shipped.

    I'll post pictures of the coutdown display in a new thread today or tomorrow.
  • ercoerco Posts: 20,256
    edited 2012-01-25 09:13
    Duane Degn wrote: »
    I did write some code that should oscillate 28 (to start with) servos. Each servo can have independently set endpoints and oscillation frequency.

    Well now you're just showin' off!

    I'll try to get the Stamp running 29 servos later on... for starters. ;)
  • Spiral_72Spiral_72 Posts: 791
    edited 2012-01-25 11:21
    erco wrote: »
    @Spiral: Mi scuzi, senore. You no understand.

    I haven't finished. No one cued the fat lady to sing. Eight servos are demonstrated, but that number is not a demonstrated limit. In fact, Beau just cut 3 milliseconds from my routine and there's room for expansion. Now the fun begins!

    ten is my calculated maximum for the BS2px sir. Don't even try for more than that. It's against the fundamental laws of the universe.
  • ercoerco Posts: 20,256
    edited 2012-01-27 00:08
    erco wrote: »
    Strange happenstance: my test setup works exactly the same without a common ground between the batteries. 9V powers the BS2 HW board and a 6V gel cell for the servos. Something in the air I guess...

    That was hinky; tonight I was working with just one servo of the eight plugged into the board and it would not respond to servo commands. All eight servos worked fine if I loaded the multiservo program. But one servo wouldn't work. I lost a bunch of time solving that problem. Turns out, I had left the common ground wire disconnected, the gel cell ground (- terminal) only went to the servos. Somehow, it still worked fine with the noise of all 8 servos, but not running just one. All 8 servos were still plugged in, but not receiving any command signals. Strange vibes.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-29 15:44
    I received a box of servos from HobbyKing yesterday.

    I don't have 32 servos that are all the same size. I'm going to use 16 medium servos (HX12K) and 16 small servos (HXT900). I wired them up last night while watching TV with my wife. Man, that's a lot of wires!

    I'm putting the finishing touches on the demo program now. I'm adding some features I thought would be cool to the demo.

    I should have a video up tomorrow (at the latest, I might get it finished tonight).
  • ercoerco Posts: 20,256
    edited 2012-01-29 16:57
    SO YOU'RE THE JOKER WHO CLEANED OUT ALL OF THE HXT900s! :)

    http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=662

    I've heard that these are "da bomb" for 9g servos and went to order some this weekend and they're on back order. :(

    I'll have to wait & stock up. I have tons of dollar servos, but the way I'm gluing directly to them to build my arm means it will be extremely difficult to replace one if it ever strips out. Thus, it would be smart to start building with the best.

    Looking forward to seeing your multiservo Prop experiments!
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-01-29 19:45
    erco,

    Surprised i haven't seen an updated video with 8+ servos'... by looking at the scope, and the 3us shaved off, you should be able to run 12 servos before you run into "OFF time" problems.
  • ercoerco Posts: 20,256
    edited 2012-01-29 20:14
    You'd be surprised how much one or two sick babies can slow down my critical tech projects!

    Typing 1-handed with a cute but sick Amy on my lap now!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-29 20:19
    I just had 32 servos oscillating.

    One problem I'm having is the Prop resetting (yes, it has a separate power supply) and with servos attached to the I2C lines, it doesn't reboot correctly. I have to plug the servos in after the program is running. I'm adding one of those DIP switches to the breadboard so I don't have to keep unplugging the wires. The QuickStart's header is kind of crowded right now so it can be difficult to get the last couple of wires connected.

    It does look pretty darn cool to see all those servos moving.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-01-29 22:42
    erco,

    sorry, I hope the little ones are feeling better soon.


    Duane Degn,

    I'm confused, isn't there already a servo 32 driver for the Propeller? :-)

    Heck, why not 144 servos from one Propeller, and 1 cog?

    http://forums.parallax.com/showthread.php?84187-Will-the-servos-Parallax-sells-work-from-a-pulse-directly-from-the-Propeller&p=583652&viewfull=1#post583652
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-30 06:31
    erco,

    sorry, I hope the little ones are feeling better soon.

    Me too! I hope Amy and her sister are feeling better.

    Duane Degn,

    I'm confused, isn't there already a servo 32 driver for the Propeller? :-)

    Yes, but I've never actually seen a video of the Propeller driving 32 servos at once. Now that I've done it, I know why. It's a royal pain to wire up that many servos. I'm going to be really mad if there turns out to be a bunch of 32 servo videos already made.

    The video is uploading as I type this. I figure I'll post it in a new thread in the Propeller forum with a link to it from here.

    Because my insanity has its limits! Besides, erco has forbidden me from making a robotic centipede (I think he's really just using reverse psychology since I can't get the idea of making a robotic centipede out of my mind). When you see the video, you'll notice I've got the rippling wave motion down pretty well.

    I'll also bow out of the 144 servo challenge because I'm running out of servos! I doubt I have 144 servos counting continuous rotation versions and servos installed in airplanes, helicopters and robots.

    When I post the video, I'm going to ask for ideas of what people would like to see 32 servos be able to do. I personally would like to be able to have the servos swing as if a pendulum were attached to it. I'd like to be able to set the amplitude and pendulum length independently for each servo. I don't think I have the time to compute all 32 positions in 20ms. As it is, my current demo program can take 15ms to adjust endpoints, periods and phase of all 32 servos. I'm not sure if there is time to perform trig functions on each servo position at 50Hz. Of course I could always throw more cogs at the problem.

    Wow, the upload is complete. It should be here now.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-01-30 07:15
    Duane Degn,

    lol! - nice! ... of course I had to give you a hard time.

    Care to post any code?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-30 07:55
    Care to post any code?

    I've posted some in the Propeller forum. So far, I've just posted one method. I'll post the rest shortly. I don't think I have any code I wouldn't be willing to post to the forum. I'll post this "dirty" version and hopefully add a cleaned up version later.

    I'm hoping to come up with a good servo demo that will show off what the Propeller can do (at least with servos).

    Edit: In case anyone here missed it, I linked to my 32 servo demo in this post. Here's the link again:
    http://forums.parallax.com/showthread.php?137597-QuickStart-Driving-32-Servos-(Video)
  • ercoerco Posts: 20,256
    edited 2012-01-30 08:14
    Awesome job, and you have the sinusoidal wave going already. Fantastic! It is really neat to see that many servos in motion. Is this using one cog or more?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-30 08:40
    Thanks erco.
    erco wrote: »
    It is really neat to see that many servos in motion.
    I think they sound cool too. Not as good as clicking relays though.
    erco wrote: »
    Is this using one cog or more?

    The main loop is running in one cog and Beau's Servo32v7 object is running in a second cog. I used a third cog while debugging to send servo positions to a terminal window. The problem with using 32 servos is there aren't any pins left for any other input or output. That's why I started out with 28 servo, so I could debug and reset the Prop when I wanted to.

    I didn't show it in the video, but it would be easy to have a diminishing amplitude on the servo movements with the "rippling effect". I think you and Gordon had mentioned this need when making a robot snake.

    Let me know what you'd like to see 32 servos do while I still have them set up.

    BTW, when I was attaching all those servo horns, I used a cool little servo tester to hold three servos in their center position while I attached the horns. (Just how many times do you have to be right?)
  • ercoerco Posts: 20,256
    edited 2012-01-30 09:23
    Gordon mentioned the decreasing amplitude, but I'm not so sure, especially for the short snake I'm considering building (8-10 servos).

    This long S5 snake doesn't look like it's decreasing much, it at all: http://www.snakerobots.com/S5.html click on pics for video download, or see at http://www.youtube.com/watch?v=cJuNe50uuzk
  • ercoerco Posts: 20,256
    edited 2012-01-30 11:50
    Yo Duane, I just ordered 2 lots of these servo extenders @ $1.38/5 pc, you may want to stock up too, since we share the same affliction: servo-itis! Might help clean up your 32x wiring a bit. :)

    http://www.ebay.com/itm/5x-150mm-RC-servo-Extension-Cord-Cable-wire-lead-JR-R-C-/220752252054?pt=Radio_Control_Parts_Accessories&hash=item3365dc0c96
  • dbpagedbpage Posts: 217
    edited 2012-01-30 13:51
    You can use Parallax ServoPALs to keep the servo pulse train going while the BS2 is making decisions or doing something else.
    http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servo/List/0/SortField/4/ProductID/481/Default.aspx

    I prefer using the Parallax Servo Controller
    http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servo/List/0/SortField/4/ProductID/595/Default.aspx

    But I have had success with the Linxmotion SSC-32
    http://www.lynxmotion.com/p-395-ssc-32-servo-controller.aspx
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-31 10:49
    erco wrote: »
    SO YOU'RE THE JOKER WHO CLEANED OUT ALL OF THE HXT900s! :)

    I'm innocent, I tell ya! I only ordered 8 in this last order.
    attachment.php?attachmentid=89130&d=1328032112

    I didn't think HobbyKing could run out of their HXT900 servos. That's like Parallax running out of Propeller Chips Basic Stamps.
    erco wrote: »
    I've heard that these are "da bomb" for 9g servos and went to order some this weekend and they're on back order. :(

    I'll have to wait & stock up. I have tons of dollar servos, but the way I'm gluing directly to them to build my arm means it will be extremely difficult to replace one if it ever strips out. Thus, it would be smart to start building with the best.

    Do you have a good source for cheap servos? I looked around on eBay last night for a while and best I could find was $2.50 a servo. You know, if you type "servo" into eBay's search window, you get hundreds of pages of hits and that's displaying 100 items per page.

    I think the HXT900 servos are a very far cry from "the best", but I've been pleased with how they work and I do agree with the asessment that they are "da bomb". I think you can tell from some of my videos, they do have a pretty good range of motion (it looks like a full 180 degrees).

    With this last addition of 8 mini servos, I think I'm up to a total of 24 of these (and I ordered the other 16 a while ago so HK had plenty of time to make more (it's not my fault!)).
    erco wrote: »
    Looking forward to seeing your multiservo Prop experiments!
    Other people might not realize this is code for "build a robot centipede".

    The ripping motion of the servos in the 32 servo demo would look really cool on a centipede.
    erco wrote: »
    Gordon mentioned the decreasing amplitude, but I'm not so sure, especially for the short snake I'm considering building (8-10 servos).

    This long S5 snake doesn't look like it's decreasing much, it at all: http://www.snakerobots.com/S5.html click on pics for video download, or see at http://www.youtube.com/watch?v=cJuNe50uuzk

    I'd like to see a comparison between a robot snake using a constant amplitude and one with a decreasing amplitude. I wonder if the S5 snake would look better with a decreasing amplitude.

    Anyway, it would be easy to have it either way with the code I wrote for the 32 servo demo (patting myself on back).
    erco wrote: »
    Yo Duane, I just ordered 2 lots of these servo extenders @ $1.38/5 pc, you may want to stock up too, since we share the same affliction: servo-itis! Might help clean up your 32x wiring a bit. :)

    I'm not so sure if I need those or not. The problem I often have is needing an extension a different length than that the extenders I already have. I finally purchased a bunch of crimp on servo connectors from Servo City to make my own extenders. But for that price, I'd gladly buy premade extenders (if I could get them in the exact length I need and when I need them). I suppose I ought just buy a bunch a different lengths and save myself from the hassle of making my own.

    Another problem I have with the premade extenders is I don't always want all three wire going to the same place. In the 32 servo demo, I wanted the power and ground to connect with power and ground rails and I wanted the signal wire to connect with the QuickStart board's I/O pins.

    I'll have to admit, if I were building a robot instead of a servo demo, I'd want to be able to plug the servo connector into some sort of socket and not have a bunch of individual wires running all over the place. Which reminds me, "clean up your 32x wiring a bit"? Well, . . . (thinking of cool comeback) your robot has splinters (oh, oh, I've got it) termites!

    You wouldn't know from my recent posts but I actually have work to do.
    578 x 62 - 5K
Sign In or Register to comment.