Author Topic: PULSOUT with servo  (Read 3221 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
PULSOUT with servo
« on: October 20, 2007, 05:46:33 PM »
I am using the PIC16F616
I modified two HS425BB servos for continuous rotation and I cannot get them to go counterclockwise. Every pulse that I give makes the servo spin clockwise ( but at different speeds based on the pulse).

the servos and microcontroller are powered by a 5V 1A regulator.
What can I do to make it go counterclockwise????


' PIC BASIC Program
Define OSC 8

symbol servo1=portc.3
symbol servo2=portc.2
x var byte
b var byte

pause 20
x = 50
b = 250
main:
pulsout servo1,x
Pulsout servo2,b



goto main
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline creedcradle

  • Full Member
  • ***
  • Posts: 92
  • Helpful? 0
  • Physics Robotics
Re: PULSOUT with servo
« Reply #1 on: October 20, 2007, 05:53:11 PM »
is it 1 in pic basic means 1us?

if that is so then from 1us to 1000us that is a clockwise
LEARN TO SHARE and SHARE TO LEARN!

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: PULSOUT with servo
« Reply #2 on: October 20, 2007, 05:55:58 PM »
A 1 in picbasic represents 10uS

is it possible that a servo only turns in one direction??
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline creedcradle

  • Full Member
  • ***
  • Posts: 92
  • Helpful? 0
  • Physics Robotics
Re: PULSOUT with servo
« Reply #3 on: October 20, 2007, 06:03:10 PM »
then 50x10=500us = clockwise
250x10=2500us - this is beyond 2ms,

so try 200x10 =2ms: this should reverse the servo

remember for standard servo : 2ms means counterclockwise and 1 ms is clockwise
standard refresh rate is 20ms but other servo has 20-30ms refresh rate.
LEARN TO SHARE and SHARE TO LEARN!

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: PULSOUT with servo
« Reply #4 on: October 20, 2007, 06:07:31 PM »
No dice,


does the Hs-425BB go backwards at all??

any other things I should try???
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: PULSOUT with servo
« Reply #5 on: October 20, 2007, 06:13:23 PM »
If I were to open up the servo and reverse the wires going to them motor it would go backwards, right??

Also, would I need to reverse the wires on the pot also to make it go in reverse?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: PULSOUT with servo
« Reply #6 on: October 20, 2007, 06:19:22 PM »
The servo must go both ways.
the unmodified version can go -45 degrees and +45 degrees (forwards and backwards)

what speed crystal are you using on the pic, and is pic basic calibrated for this speed?

http://www.servocity.com/html/hs-425bb_super_sport_bb.html
« Last Edit: October 20, 2007, 06:20:49 PM by paulstreats »

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: PULSOUT with servo
« Reply #7 on: October 20, 2007, 06:24:54 PM »

Thanks paul

when i set the oscilaltor to 4mhz it worked!

thanks a lot!!!!


I'm guessing that the servo cannot run of a PIC set to 8mhz even if the program is set to be run at 8mhz.

Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: PULSOUT with servo
« Reply #8 on: October 21, 2007, 05:28:11 AM »
IF you are running the PIC at  8 mhz then a 1 in the pulsout represents 5uS instead of the 10us it represents in a 4mhz PIC.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: PULSOUT with servo
« Reply #9 on: October 21, 2007, 07:02:40 AM »
another thing you may want to check is that the port pin you are using is definately set to low before you run the pulsout command. the pulsout only toggles the port twice, so if the port pins initial state is high, it will pulse the pin low for your desired time. I had a bit of trouble with this once, it took me ages to work out why it was working properly.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: PULSOUT with servo
« Reply #10 on: October 21, 2007, 07:13:22 AM »
Thanks,

I'll add that to my program.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here