PDA

View Full Version : Prop servo question...



J. A. Streich
01-25-2009, 05:16 AM
Using both the serv32 and sevo4 objects, my contunuous servo motors are pulsing noticably to the eye.... Using the BS2, to eye the wheel moved continuously (I know there needs to be a pause between widths) , but can't get the same effect on the prop (protoboard).

I've taken out any obvious waiting that I could see, but I don't know what I'm missing becaue using both I get movment about once a second. Any idea what I'm doing wrong?

Mike Green
01-25-2009, 05:27 AM
You need to provide more information. Both the Servo32 and Servo-4 objects work properly when used correctly.

J. A. Streich
01-25-2009, 05:54 AM
The code is modified from servo32_Demo.




CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000 'Note Clock Speed for your setup!!

LeftServo = 0 'Select DEMO servo to pan
RightServo = 1
VAR

OBJ
SERVO : "Servo32v3"

PUB Servo32_DEMO | temp

SERVO.Set(LeftServo,2000)
SERVO.Set(RightServo,1000)
'Note: Servo pins that will be used must be preset before running "SERVO.Start".
' This is because the I/O direction is set here and is only executed
' at the beginning of "SERVO.Start". Servo pins that aren't used will remain
' in their original direction
SERVO.Start
repeat
SERVO.Set(LeftServo,2000)
SERVO.Set(RightServo,1000)

Robofreak
01-25-2009, 06:40 AM
What a coincidence, I was just working on getting my servo to do the same today! The conclusion I came to was to simply use a cog repeatedly sending out pulses to the servo, and you set the pulses by another cog (most likely cog 0) setting a global variable.




VAR
LONG SPOS, SERVO_STACK[15]

CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000

S_PIN = 0

PUB MAIN
COGNEW(SERVO, @SERVO_STACK)

SPOS := 1_000
REPEAT

PUB SERVO
DIRA[S_PIN]
REPEAT
!OUTA[S_PIN]
WAITCNT((CLKFREQ/1_000_000*SPOS*2)+CNT)
!OUTA[S_PIN]
WAITCNT(CLKFREQ/20+CNT)




This updates the servo position 20 times per second. Hope this helps give you an idea!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Austin Bowen,

Robo-freak.com (http://www.robo-freak.com)
www.livesoundforum.com (http://www.livesoundforum.com)

"One must watch out for mechanics. They start out with a sewing machine, and end up with the atomic bomb" - A quote from someone that I saw on Addall.com

"Not only do I see the glass as half empty, I wonder if anyone poisoned the glass with arsenic" - My dad, inside joke haha

Post Edited (Robofreak) : 1/24/2009 11:45:32 PM GMT

J. A. Streich
01-25-2009, 07:04 AM
I have the same issue with your code.

John Abshier
01-25-2009, 07:06 AM
First, the call to Servo.Set in the final repeat loop is not required. You only need to call Servo.Set when you change a value. I tried the code you posted and it worked for me. Servo32 has been rock solid for me. I haven't used Servo-4. Perhaps a hardware problem?

John Abshier

shanghai_fool
01-25-2009, 07:12 AM
You need at least 15-20ms between pulses. Add a waitcnt(cnt + 160_000) to your repeat loop.

J. A. Streich
01-25-2009, 07:43 AM
Same servo run fine on a Board of Education.
The prop seems to be in good health....
The only thing I wonder is if it could be constantly resetting for some reason.... :(

J. A. Streich
01-25-2009, 08:45 AM
For the record, it does indeed seem that my prop is constantly resetting when it's not being programed.

http://forums.parallax.com/images/smilies/cry.gif

I've got the acessory kit attached, and servos on P0 and P1. Any ideas on what might cause this? Or to prevent this? http://forums.parallax.com/images/smilies/cry.gif

soshimo
01-25-2009, 09:18 AM
I had the same exact problem. I'm on a protoboard though, so I'm not sure if this is the cause of your problem. Mine was caused by the servos loading the regulator to the point where it drops below 3.3v. Since my 3.3v regulator was fed from the 5v regulator this caused the 3.3v regulator to drop below 2.7v which caused a brownout reset. The solution, for me, was to decouple the power supplies. If that's not an option, you can try to use bigger caps to filter out the voltage drops. This worked for me temporarily, but I eventually decoupled the power supplies anyway so there wouldn't be a dependency (plus after 4 servos my problems came back).

I forgot to add - a quick test is to scope the output of the 3.3v regulator. That will tell you for sure what is going on with vcc. A poor mans solution is to just check it with a DMM, you should see it noticeably drop before the reset occurs.

Post Edited (soshimo) : 1/25/2009 2:23:19 AM GMT

J. A. Streich
01-25-2009, 10:17 AM
hmmm... using protoboard (Rev. A)..

Power source is the batter pack from a BOE-BOT, with Energizer AA rechargeable batteries.

The 3.3v shows as +3.14v to +3.17v,
The +5v was showing at right around 4.11 ...

3.14 low enough to cause a "brownout" reset?

If so, where did you connect the second power source to the protoboard? Right to the pins on the servo headers or did you add your own headers elsewhere?

If not, what else could cause the prop to reset?

blittled
01-25-2009, 11:28 AM
Are you using 4 rechargable batteries? If so try using 5 to get the proper voltages. I believe that most servo motors minimum voltage rating is 5 volts and then they act unpredictably under that voltage. 4 rechargables only produce 5 volts and then there is a voltage drop through the regulators that may be causing the lower voltage. 5 rechargable batteries will produce 6.25 volts which is sufficient to produce 5 volts through the regulator.

I never tried another voltage source on the protoboard but reviewing the schematic it looks like you can use the input voltage that is present at the power jack. To do this you have to solder in a 3 pin header to the right of the regulators and place a shunt at the position that permits the VINSW voltage and place the switch in position 2. I believe this will put VIN to the Servo headers directly.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
What electronics need - MORE POWER!!!!!!!

J. A. Streich
01-25-2009, 11:43 AM
I'm already using VIN. I'll have to try to pickup a larger battery clip. The one that I'm using now works fine on the Board of Education, but that one has a single voltage regulator to get through.

JasonDorie
01-25-2009, 04:48 PM
When the servos try to move they'll pull a power spike from your supply. If you don't have a decent sized capacitor between the servo power and ground pins, that sudden draw could be enough to drop your already low power lower than the servos need.

Jason

BradC
01-25-2009, 04:51 PM
J. A. Streich said...


If not, what else could cause the prop to reset?


Do you have an FTDI chip (Prop plug or on-board USB on proto-board) connected? Are you sending any data out PIN 31?

I got caught with this yesterday playing with my new USB proto-board. My debug code sends the current time out every second, and every time it went to transmit a byte the board would reset. Common problem with the propeller stuff and FTDI chips.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cardinal Fang! Fetch the comfy chair.

J. A. Streich
01-25-2009, 09:26 PM
Jason, I can try that... is 330uF good for this?
Edit/Add: Should this be in addition to, or in place of the 1000uF that somes preinstalled on the protoboard?

BradC, II'm not using pin 31 when this happens. I have been leaving the prop plug connected, but I haven't been sending anything. Trying it without the prop plug yeilds same results...

Post Edited (J. A. Streich) : 1/25/2009 2:45:10 PM GMT

sylvie369
01-25-2009, 11:17 PM
I did have the same problem when I used an inadequate power supply with a Propeller driving two servos. Going to a bigger supply fixed it completely. Is there any way that you can try a larger power supply temporarily to confirm that's the problem? It'll save you concerns about the programming.

Philldapill
01-25-2009, 11:35 PM
The problem is definately hardware based. You said it works fine with the BOE, which implies that it has better power decoupling than your current setup. Instead of trying to just add beefier capacitors and what not, try giving your servo it's own dedicated batteries, totally independent from the propeller, except for a common ground. This way, even if the power does sag for the servo, the Propeller won't notice.

J. A. Streich
01-26-2009, 03:18 AM
Thank you all, it is indeed that battery pack isn't enough, I don't think adding a larger cap will sufficiently solve the problem. I will either be using a larger power source (9v) or sperating the two power sources. I want to keep using the servo headers I already have, so I'm thinking to attach the positive terminal to the middle pin (bottom) of header between the power and cap, and the negative terminal attach it to negative terminal of the Cap. Any issues I might have with that?

sylvie369
01-26-2009, 04:21 AM
J. A. Streich said...
Thank you all, it is indeed that battery pack isn't enough, I don't think adding a larger cap will sufficiently solve the problem. I will either be using a larger power source (9v) or sperating the two power sources. I want to keep using the servo headers I already have, so I'm thinking to attach the positive terminal to the middle pin (bottom) of header between the power and cap, and the negative terminal attach it to negative terminal of the Cap. Any issues I might have with that?


Be careful to pay attention to the maximum voltage ratings of the servos. Your power supply's voltage will be the voltage sent out at the Vin pins unless you have them jumpered to 5V. I believe 9V will damage most servos, though more experienced folks might know differently.

JasonDorie
01-26-2009, 06:39 AM
I didn't realize you were on a protoboard. The 1000uF cap is there to buffer servo spikes, so you don't need another one. :)

Jason