PWM (3.3V) unable to drive servo

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

PWM (3.3V) unable to drive servo

Postby hrzrfn » Wed Jun 05, 2013 7:37 am

Hi !

i'm using LandTiger LPC1768 board to drive 2 cytron c55r servos by using PWM signal..I have configured the PWM to work on the servos

I have successfully control the PWM by using on-board potentiometer, which is verified by channeling the PWM signal to the on-board LED (brightness changed). I have also verified that the PWM is working by checking the PWM output pin (P2.0) signal by using oscilloscope & I'm getting some signal..

however, when I'm trying to drive the servo by channeling the PWM from pin P2.0 directly to the PWM input of the servo, the servo doesnt move at all. I'm using 6v battery supply for the servo.. Is this due to weak voltage level of the PWM? Because last time I checked the PWM with an oscilloscope, I had to use 10x magnification to be able to see the PWM pattern

I'm suspecting this is because the PWM voltage level output by the board is at 3.3v only. How do I amplify the voltage level to 5v? some suggest the use of 74HCxx IC chip for immidiate solution but I realized that there are many type of 74HC IC out there. Can anyone please help me on this?

Btw, this is my first time working with PWM & servos

Thank you
hrzrfn
Greenhorn
 
Posts: 3
Joined: Wed Jun 05, 2013 7:21 am

Re: PWM (3.3V) unable to drive servo

Postby shahrul » Wed Jun 05, 2013 8:29 am

Signal 3.3V still can drive the servo. I have try servo with chipkit Max32 that the output level is 3.3V.
Maybe other problem. You try see the waveform at oscilloscope while servo is attached.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: PWM (3.3V) unable to drive servo

Postby waiweng83 » Wed Jun 05, 2013 10:23 am

Can you please take a picture of your PWM signal on the oscilloscope and post it here?
I suspect your PWM signal is not correct.

FYI, the PWM signal for servo should have pulse width between 1-2ms and period must be around 20ms. In another words, the PWM duty cycle is only 5-10%. If you connect the PWM output the LED, the LED should be very dimmed or even not turned on at all.

In your case, if you can see the brightness of the LED changed, I suspect the PWM signal is not in the correct format to drive a servo.


*P/S: The servo can be driven with 3.3V signal perfectly. For R/C application, the servo is driven by a receiver which most of them only has output signal at 2.8 - 3.3V.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: PWM (3.3V) unable to drive servo

Postby hrzrfn » Wed Jun 05, 2013 4:28 pm

hi all..thx for your reply..

I've tried attaching the servo while checking for PWM at the osciloscope...it seems that the waveform is still there,just that the servo doesnt move

anyway here I attached the pic of PWM signal with setting at osciloscope 5volt/div at vertical and 1ms/div with 10x magnification at the horizontal part

on the code part, here is some initilization to the PWM that i've made

CODE: SELECT_ALL_CODE
LPC_SC->PCONP |= 1 << 6; // enable power for PWM1
  LPC_SC->PCLKSEL0 |= 1 << 12; //select peripheral clock to = CCLK
  LPC_PWM1->TCR = (1<<1); //--- Reset counter
  LPC_PWM1->PR = 0; //no prescaling
  LPC_PWM1->PC = 0;
  LPC_PWM1->IR = 0; //clear interrupt
  LPC_PINCON->PINSEL4 = (LPC_PINCON->PINSEL4 & ~(0x3 << 0)) | (0x1 << 0); //selecting PWM output pin
  LPC_PINCON->PINMODE4 = (LPC_PINCON->PINMODE4 & ~0x3) | 0x2; // neither pullup/down resistor
  LPC_PWM1->MR0 = 20000;  /* set clock cycles for PWM*/
  LPC_PWM1->MR1 = 1500;
  LPC_PWM1->LER = (1 << 0) | (1 << 1); //Apply changes made at MR
  LPC_PWM1->MCR |= 1 << 1; // interrupt on match0.Reset timer on Match0;
  LPC_PWM1->PCR = (1<<9); //enable the PWM1 output
  LPC_PWM1->TCR = (1<<0)|(1<<3);


TBH i'm not quite sure on the clock and the prescaling part :?

on the while loop part

CODE: SELECT_ALL_CODE
while(1)
        {
          ADC_StartCmd(LPC_ADC,ADC_START_NOW); // Start conversion
          NVIC_EnableIRQ(ADC_IRQn); /* Enable ADC in NVIC */

          LPC_PWM1->MR1 = adc_value; // adc_value = value read from potentiometer ADC conversion. value range 0-4096
          LPC_PWM1->LER |=  (1 << 1); //Apply changes to MR
        }
Attachments
photo.jpg
PWM with potentiometer at max (MR1-> adc_value = 4096)
hrzrfn
Greenhorn
 
Posts: 3
Joined: Wed Jun 05, 2013 7:21 am

Re: PWM (3.3V) unable to drive servo

Postby waiweng83 » Thu Jun 06, 2013 11:47 am

From the display of the oscilloscope, the period and pulse width of the PWM signal is incorrect.
Please make sure the period is 20ms and pulse width is within 1-2ms.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: PWM (3.3V) unable to drive servo

Postby hrzrfn » Tue Jun 11, 2013 1:41 am

Hi.. Thx for pointing out where my mistake is

Sorry for silly question, but what is the period of the pwm signal that i've posted? I've set 1ms/div for x-axis with 10x magnification at the osciloscope.. The 10x is confusing me wether i should divide the 1ms by 10
hrzrfn
Greenhorn
 
Posts: 3
Joined: Wed Jun 05, 2013 7:21 am

Re: PWM (3.3V) unable to drive servo

Postby waiweng83 » Tue Jun 11, 2013 11:03 am

hrzrfn WROTE:Hi.. Thx for pointing out where my mistake is

Sorry for silly question, but what is the period of the pwm signal that i've posted? I've set 1ms/div for x-axis with 10x magnification at the osciloscope.. The 10x is confusing me wether i should divide the 1ms by 10



I'm sorry that I don't know as well cause I never use that type of oscilloscope before.
But I'm sure the signal is not correct from your picture because the ratio between the pulse width and the period is wrong.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 17 guests

cron