Hello, I am looking for some sample code to control a single r/c (hobby) servo from the pwm module in a pic16F628. I am making a small version of the old Big Trax toy. I have the robot part made and need to make the trailer now. I want to put an r/c servo in it that will rotate a given angle to make the trailer dump its cargo. Any help is appreciated. Thanks, Neil |
|
pic16f628 and single servo
Started by ●October 11, 2003
Reply by ●October 11, 20032003-10-11
In general, the PWM module will not run at a sufficiently low frequency for the servo. What you want is a pulse width of 1.0 to 2.0 mS with a center value of 1.5 mS repeating about 75 times per second. Look in the MiniSumo Mark III group here on Yahoo and in the Files section look at the C Samples for the MiniSumo code. The C program shows you how to control the servo. In the robot the servo rotates continuously but that is not important. What you need is the bit on frequency using Timer 0 and pulse width. --- In , "smitty505000" <smitty505000@y...> wrote: > Hello, > I am looking for some sample code to control a single r/c (hobby) > servo from the pwm module in a pic16F628. I am making a small version > of the old Big Trax toy. I have the robot part made and need to make > the trailer now. I want to put an r/c servo in it that will rotate a > given angle to make the trailer dump its cargo. Any help is > appreciated. > > Thanks, > Neil |
|
Reply by ●October 12, 20032003-10-12
Are we confusing PWM encoding for proprotional servo control with PWM modulation of a servo for acceleration control? Both PWM, but at different ends of the horse. Chad --- rtstofer <> wrote: > > In general, the PWM module will not run at a sufficiently low > frequency for the servo. What you want is a pulse width of 1.0 to > 2.0 mS with a center value of 1.5 mS repeating about 75 times per > second. > > Look in the MiniSumo Mark III group here on Yahoo and in the Files > section look at the C Samples for the MiniSumo code. The C program > shows you how to control the servo. In the robot the servo rotates > continuously but that is not important. What you need is the bit on > frequency using Timer 0 and pulse width. > > --- In , "smitty505000" <smitty505000@y...> > wrote: > > Hello, > > I am looking for some sample code to control a single r/c > (hobby) > > servo from the pwm module in a pic16F628. I am making a small > version > > of the old Big Trax toy. I have the robot part made and need to > make > > the trailer now. I want to put an r/c servo in it that will rotate > a > > given angle to make the trailer dump its cargo. Any help is > > appreciated. > > > > Thanks, > > Neil __________________________________ |
|
Reply by ●October 12, 20032003-10-12
The original question referenced the PWM module. It isn't useful for proportional control of servos. --- In , Chad Russel <chadrussel@y...> wrote: > Are we confusing PWM encoding for proprotional servo control with PWM > modulation of a servo for acceleration control? Both PWM, but at > different ends of the horse. > > Chad > --- rtstofer <rstofer@p...> wrote: > > > > In general, the PWM module will not run at a sufficiently low > > frequency for the servo. What you want is a pulse width of 1.0 to > > 2.0 mS with a center value of 1.5 mS repeating about 75 times per > > second. > > > > Look in the MiniSumo Mark III group here on Yahoo and in the Files > > section look at the C Samples for the MiniSumo code. The C program > > shows you how to control the servo. In the robot the servo rotates > > continuously but that is not important. What you need is the bit on > > frequency using Timer 0 and pulse width. > > > > --- In , "smitty505000" <smitty505000@y...> > > wrote: > > > Hello, > > > I am looking for some sample code to control a single r/c > > (hobby) > > > servo from the pwm module in a pic16F628. I am making a small > > version > > > of the old Big Trax toy. I have the robot part made and need to > > make > > > the trailer now. I want to put an r/c servo in it that will rotate > > a > > > given angle to make the trailer dump its cargo. Any help is > > > appreciated. > > > > > > Thanks, > > > Neil > > > > __________________________________ > |
|
Reply by ●October 12, 20032003-10-12
Oh, ok. I thought the PWM on the Pic would do it. I just joined the minisumomarkIII group and will see what they have in there file section once I am accepted. I might just go ahead and get a serial servo controller since I already know how to send using USART. Its just that I dont need all 8 servo connections and didnt want to pay the $27.00. Thanks for the replys! --- In , "rtstofer" <rstofer@p...> wrote: > > The original question referenced the PWM module. It isn't useful for > proportional control of servos. > > --- In , Chad Russel <chadrussel@y...> wrote: > > Are we confusing PWM encoding for proprotional servo control with > PWM > > modulation of a servo for acceleration control? Both PWM, but at > > different ends of the horse. > > > > Chad > > --- rtstofer <rstofer@p...> wrote: > > > > > > In general, the PWM module will not run at a sufficiently low > > > frequency for the servo. What you want is a pulse width of 1.0 > to > > > 2.0 mS with a center value of 1.5 mS repeating about 75 times per > > > second. > > > > > > Look in the MiniSumo Mark III group here on Yahoo and in the > Files > > > section look at the C Samples for the MiniSumo code. The C > program > > > shows you how to control the servo. In the robot the servo > rotates > > > continuously but that is not important. What you need is the bit > on > > > frequency using Timer 0 and pulse width. > > > > > > --- In , "smitty505000" > <smitty505000@y...> > > > wrote: > > > > Hello, > > > > I am looking for some sample code to control a single r/c > > > (hobby) > > > > servo from the pwm module in a pic16F628. I am making a small > > > version > > > > of the old Big Trax toy. I have the robot part made and need to > > > make > > > > the trailer now. I want to put an r/c servo in it that will > rotate > > > a > > > > given angle to make the trailer dump its cargo. Any help is > > > > appreciated. > > > > > > > > Thanks, > > > > Neil > > > > > > > > > > > > __________________________________ > > |
Reply by ●October 12, 20032003-10-12
Hummm. That is the only thing I have used it for. I probably would use a timer module to decode incoming PWM, although I have never had the need. Chad --- rtstofer <> wrote: > > The original question referenced the PWM module. It isn't useful for > > proportional control of servos. > > --- In , Chad Russel <chadrussel@y...> wrote: > > Are we confusing PWM encoding for proprotional servo control with > PWM > > modulation of a servo for acceleration control? Both PWM, but at > > different ends of the horse. > > > > Chad > > --- rtstofer <rstofer@p...> wrote: > > > > > > In general, the PWM module will not run at a sufficiently low > > > frequency for the servo. What you want is a pulse width of 1.0 > to > > > 2.0 mS with a center value of 1.5 mS repeating about 75 times per > > > > second. > > > > > > Look in the MiniSumo Mark III group here on Yahoo and in the > Files > > > section look at the C Samples for the MiniSumo code. The C > program > > > shows you how to control the servo. In the robot the servo > rotates > > > continuously but that is not important. What you need is the bit > > on > > > frequency using Timer 0 and pulse width. > > > > > > --- In , "smitty505000" > <smitty505000@y...> > > > wrote: > > > > Hello, > > > > I am looking for some sample code to control a single r/c > > > (hobby) > > > > servo from the pwm module in a pic16F628. I am making a small > > > version > > > > of the old Big Trax toy. I have the robot part made and need to > > > > make > > > > the trailer now. I want to put an r/c servo in it that will > rotate > > > a > > > > given angle to make the trailer dump its cargo. Any help is > > > > appreciated. > > > > > > > > Thanks, > > > > Neil > > > > > > > > > > > > __________________________________ > > > __________________________________ |
Reply by ●October 12, 20032003-10-12
----- Original Message ----- From: smitty505000 <> To: <> Sent: Sunday, October 12, 2003 5:09 PM Subject: [piclist] Re: pic16f628 and single servo > Oh, ok. I thought the PWM on the Pic would do it. I just joined the > minisumomarkIII group and will see what they have in there file > section once I am accepted. I might just go ahead and get a serial > servo controller since I already know how to send using USART. Its > just that I dont need all 8 servo connections and didnt want to pay > the $27.00. > > Thanks for the replys! > If you are considering using a dedicated controller you could try this. The demo servo library that comes with XCSB allows you to control 4 RC servos from PORTB bits 0, 1, 2 and 3 of the 16f628. If you only need to control one or two servos you can release the Rx and Tx pins for use with the usart. You can then use the XCSB serial library on the dedicated PIC to receive commands and control the servos that way. Total cost less than $3 The servo demo (source, executable and circuit) can be found at http://www.xcprod.com/titan/XCSB/CONTRIB Regards Sergio Masci http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC compiler |