Servo Code!

Show off your projects to others!
davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Servo Code!

Post by davec » Wed Aug 10, 2011 12:30 am

sierrasmith71 wrote:Do you plan to work your magic again and produce a VarSpeedServo version of this library ? I surely hope so, as I need it for my application..
Yes I will have a go, maybe next weekend though.

It's interesting that the interrupt handler for the PIC32 version of Servo is almost identical to the AVR version, I didn't know you could use the PR register in the same way as the output compare on the AVRs. That will make porting timer code a lot easier.

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Wed Aug 10, 2011 1:34 am

davec wrote:
sierrasmith71 wrote:Do you plan to work your magic again and produce a VarSpeedServo version of this library ? I surely hope so, as I need it for my application..
Yes I will have a go, maybe next weekend though.

Huge thanks in advance

David Garrison

davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Servo Code!

Post by davec » Sun Aug 28, 2011 1:25 pm

I haven't totally forgotten about this, but my attempts so far haven't worked very well. Just pasting the VarSpeedServo code into the PIC32 Servo code works for one or two servos but gets glitchy with any more at some speeds, so there is a complex timing problem in there somewhere. Anyway attached is what I have so far, see if it works for you.
Attachments
VarSpeedServoPIC32.zip
(10.21 KiB) Downloaded 310 times

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Wed Aug 31, 2011 2:10 am

davec wrote:I haven't totally forgotten about this, but my attempts so far haven't worked very well. Just pasting the VarSpeedServo code into the PIC32 Servo code works for one or two servos but gets glitchy with any more at some speeds, so there is a complex timing problem in there somewhere. Anyway attached is what I have so far, see if it works for you.

I just got around to testing your work..I have only two servos that I can use on my bench and it works just dandy! I will free a few more up tomorrow and wire up a kludge to power them and get them connected and I will report my findings.

BTW, my servos --least expensive Hitec's --don't like going 180 degrees!


David G 8-)

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Fri Sep 02, 2011 12:48 am

"BTW, my servos --least expensive Hitec's --don't like going 180 degrees! "

Sorry to report that you are correct , there is bad jitter. What I thought was a servo fault was indeed the software. It was driving them past the stops on one end. bummer!

I wrote a sketch to drive just one servo and commanded it to 90 degrees, the resultant pulse width was 3000 us! at 0 degrees it was 2100us... not good.

Just to make sure that my Open Bench Logic analyzer was telling me the truth . I wrote a sketch using the Normal servo library and it worked fine ..90 degrees was just about 1500 us.

David G. :(

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re:VarSpeed Servo Code! Looks like it does work!

Post by sierrasmith71 » Fri Sep 02, 2011 1:32 am

:o

BOY DO I HAVE EGG ON MY FACE!!

I noticed that even though I was commanding only one servo to move in my last test..the next two also moved....What was that about??? time to get the ohmmeter out, and wring out the prototyping board I built to house the servo connectors and servo power leads......yup all the signal wires are connected together??????

Wait....what are those white marks between the pads I have the servo connectors mounted to?.. UGH Dummy! those indicate that they are connected by tracks...No problem for the ground and the +5V but not good for the servo signals..all were connected together...who knows what that was doing to the poor ole micro...$%^$#@

Find the exacto , cut the tracks, reload the VarSpeedServo example...upload to the Uno32....wait......wait....wait...and yipee, the five servos I have connect, all danced together with no jitter in sight.....!!!!

I just emailed my eye doctor for an appointment.

David G. now---- :lol:

davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Re:VarSpeed Servo Code! Looks like it does work!

Post by davec » Fri Sep 02, 2011 1:41 am

sierrasmith71 wrote:all the signal wires are connected together??????
Yep I can see how that could cause problems. :)

Can you try running the slowmovetest example included with the library please? You don't have to have 8 servos connected, just one or two, but leave the TEST_SERVOS number at 8. On mine it glitches towards one end of the servo range at some speeds. Maybe I should check my wiring. :)

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Re:VarSpeed Servo Code! Looks like it does work!

Post by sierrasmith71 » Fri Sep 02, 2011 4:03 pm

davec wrote:
sierrasmith71 wrote:all the signal wires are connected together??????
Yep I can see how that could cause problems. :)

Can you try running the slowmovetest example included with the library please? You don't have to have 8 servos connected, just one or two, but leave the TEST_SERVOS number at 8. On mine it glitches towards one end of the servo range at some speeds. Maybe I should check my wiring. :)
Tried your test. Only one servo glitched at the lowest speed and it is servo dependent , move it to another channel and it acts the same..So I gather it is a problem with with individual servo.

All in all, I am please with your work..I think it's a keeper!!!!


Thanks Again.


David Garrison

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Sun Sep 18, 2011 5:44 pm

I have my application finished (two weeks ago) and up and running using the VarSpeedServo library. I have 7 servos connected and they are working without any glitches. I control them with touch input from a 340 x 240 color LCD with a touch screen.

MANY thanks to davec for his work on the VarSpeedServo Library and to Henning Carlson for his graphics/touch LCD library.

For VarSpeedServo download link: http://chipkit.org/forum/viewtopic.php ... 20#p1854
David G. :)

avenue33
Site Admin
Posts: 298
Joined: Sat Jul 16, 2011 10:19 am
Contact:

Re: Servo Code!

Post by avenue33 » Mon Sep 19, 2011 3:10 pm

sierrasmith71 wrote:I control them with touch input from a 340 x 240 color LCD with a touch screen.
Which LCD touch 320x240 screen are you using?

Image

Mine comes from :arrow: 4D Systems and I'm also using it to control a stepper motor.

As controller, I'm using the I2C :arrow: AMIS30624.

Post Reply