- Check the wiring: Ensure that the wiring between the microcontroller and the servo motor is correct and that all the connections are secure. Make sure that you are connecting the signal pin of the servo motor to the correct PWM output pin of the microcontroller.
- Verify the PWM signal: Use an oscilloscope to verify that the PWM signal being sent to the servo motor is correct. Check the frequency, duty cycle, and voltage levels of the signal to ensure that they are within the specifications of the servo motor. You can also use a multimeter to check the voltage levels of the PWM signal.
- Check the power supply: Ensure that the servo motor is receiving a stable and adequate power supply. Check the voltage level of the power supply and make sure it is within the specifications of the servo motor.
- Adjust the PWM signal: Try adjusting the PWM signal by changing the duty cycle or frequency to see if this affects the behavior of the servo motor. You can also try adjusting the pulse duration of the PWM signal within the range specified by the datasheet of the servo motor.
- Use a different method to control the servo motor: If none of the above steps work, you may want to try a different method to control the servo motor. For example, you can use an external servo motor controller or a different microcontroller with built-in support for servo motors.
How to control servo motor using ePWM block in Simulink
24 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Information about what I am trying to do:
I am trying to rotate my servo motor(VegaROBO V3006) for specific angle. I am using Simulink (and Embedded Coder) to program my TI's TMS320F28379D LaunchPad XL.
Problem i am facing: For start I am trying to sweep the shaft of my servo motor back and forth across 180 degrees but the motor vibrates with a buzz sound and doesn't move.
Figure 1 (below) shows my Simulink model.
Let's begin with verifying my calculations.
TBCLK = PWM Clock / (HSPCLKDIV * CLKDIV)
where Let HSPCLKDIV = 2, and CLKDIV = 8(Time base clock prescale divider)
PWM Clock = SYSCLKOUT * EPWMCLKDIV, where CPU Clock (SYSCLKOUT) = 200 MHz.
By default EPWMCLKDIV = 1/2
Then PWM Clock = 100 MHz and hence,
TBCLK = 100 MHz / (HSPCLKDIV * CLKDIV) (Eq 1)
The "counting mode" is configured to be Up-Down, then
TBPRD = (1/2) * (f_TBCLK / f_PWM) (Eq 2)
Substituting Eq 1 into Eq 2,
TBPRD = (1/2) * 100 MHz / (f_PWM * HSPCLKDIV * CLKDIV) (Eq 3)
then TBPRD = 62500.
We have choosen HSPCLKDIV and CLKDIV such that TBPRD <= 2^16.
The pulse duration is given as "from 1.5 ms to 1.9 ms" and T_PWM = 20 ms (or 50 Hz).
So range of duty cycle is coming 7.5% to 9.5%.
Now we can calculate CMPA Clock Cycles.
Duty = (62500 - CMPA)/(62500*2)
CMPA = 62500*(1-2*Duty)
For 7.5% duty cycle,
CPMA = 62500 * (1-2*.075) = 53125
For 9.5% duty cycle,
CMPA = 62500*(1-2*.095) = 50625
Then the WA signal (Specifies CMPA via the input port) should be:
Amplitude: (53125- 50625) / 2 = 1250, Offset: 1250 + 50625 = 51875, Frequency: 1 Hz (Arbitrary), Type: Square
Result: This didn't work as I expected. The motor vibrates with a buzz sound and doesn't move.
I have connected the motor PWm Pin to J4 40 Pin(GPIO0 Pin) - PWMOUT1A and ground to GND and 5V to the pin.
Can you explain what am I doing wrong? and if there is another method to rotate the servo motor through simulink please let me know
0 Commenti
Risposte (1)
Nikhilesh
il 9 Mar 2023
From your description, it seems like the servo motor is not rotating as expected and is instead vibrating and making a buzzing sound. This behavior suggests that the motor is not receiving a consistent and stable signal from the microcontroller.
There are several possible reasons for this issue. Here are a few things you can try to troubleshoot the problem:
As for other methods to control the servo motor through Simulink, there are several options available. For example, you can use the built-in Simulink Support Package for Arduino Hardware to control a servo motor connected to an Arduino board. Alternatively, you can use a custom Simulink block or library to control the servo motor using a different microcontroller or hardware platform.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!