This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ESC controlled by MSP430F5529

Other Parts Discussed in Thread: MSP430G2553

Hello,

Did someone try to control a ESC (Electronic Speed Control) with a microcontroller ? I mean, I've heard it is possible but I've encountered a problem during the process. So, I've started from the following idea. I've configured the TIMERA2 from the microcontroller in hope I can control the ESC like a servo . I've tested the configured timer on a servo motor and it works. When I've tried to configure the ESC, sending the corresponding 180 degrees value for a servo, it beeps for 6 times consequently.Therefore, after I send the corresponding 90 degrees value for a servo it is running for few seconds and then it stops. I've also used a pull up transistor and the out mode 3 for timer (set/reset)

I don't understand this strange behavior.

  • Are you sure that pulse widths are ok - according to what your servo and ESC expects? What about frequency of pulses? I would suggest to "debug" your circuit using oscilloscope.
  • The frequency is 50Hz, I didn't verified this with an oscilloscope , but as I've said it works on a servo motor.
  • > but as I've said it works on a servo motor.
    So what? Servo motor is not an instrument to measure your pulse widths. Maybe it miraculously works with pulse widths which actually are out of allowed range.

  • Briceag,

    a common ESC for radio controlled models uses the same PPM (PWM) signal as for the servos. Your signal has to

    • go high each 20ms (frequency)
    • go low again between 1.0 and 2.0ms (duty-cycle) after going high

    When using a MSP's timer, then OUTMOD_7 is the best solution for that. This is the reset/set mode. Every time TAR hits CCR1 (or 2 or 3 ...) the output is reset, when hitting CCR0 it is set again. So CCR1 (or 2 or 3 ...) is always smaller than CCR0!

    This could be an example configuration with an MSP430G2553:

    #include "msp430g2553.h"
    
    void main( void )
    {
      WDTCTL     =  (WDTPW | WDTHOLD); // Stop watchdog timer
    
      BCSCTL1    =  CALBC1_1MHZ;       // Set DCO range
      DCOCTL     =  CALDCO_1MHZ;       // Set DCO step and modulation
    
      P2SEL      =  0x40;              // P2.6 special function: output PWM TA0.1
      P2SEL2    &= ~0x00;              // P2.6 special function: output PWM TA0.1
      P2DIR      =  0x40;              // P2.6 output
    
      TA0CCR0    =  20000;             // Period: 20ms @ 1MHz clock
      TA0CCR1    =  1500;              // Duty-cycle for PWM: 1.5ms @ 1MHz clock
      TA0CCTL1   =  OUTMOD_7;          // Reset/set for P1.6
      TA0CTL     =  (TASSEL_2 | MC_1); // SMCLK, up-mode
    
      while( 1 )
      {
      }
    }

    This would give you 1.5ms high-time of your 20ms frequency.

    Normally ESCs want to start with motor off, so they expect a signal of 1ms which means lowest possible position of your stick. You can play around with this value a little bit. The ESC then makes beeps that mean "OK". Some ESCs have an own configuration setup where you can set an own stick position as start-point. These ESC then often have a button and one or two LEDs.

    If the ESC gives you beeps through the motor, then at least something happens :) Maybe it says wrong input signal. An ESC can have different beeps for different problems/states of operation. Isn't there a manual where you can look for your sound pattern?

    Dennis

  • Yes, the ESC starts normaly with a sequence of beeps. I've found a documentation and it seems to be alright . The problem comes after the beep is stopped. When I try to send the command for go forward, it runs for 1 second and then it stops instantly.
    I don't know the reason fot this. Should be a current limitation ? I mean. my ESC is able for 30A constantly and 35 at burst. The motor needs 20A.
  • Well, hard to say. Of course most of them will have protection against overheating, maybe current limiting, too. But in most cases it is the undervoltage motor stop to take care of the connected battery cells. Remember that todays LiPos don't like beeing discharged, otherwise they will take damage and this even gets dangerous.

    So what is your power source? Is it capable of providing the power for your motor without a significant voltage drop?

    Dennis
  • I use a battery Lipoly of 2200mAh with 3 cells (11.4 V).
  • Is it fully charged? Depending on it's charging state and the C-rating of your battery the voltage drop might be to high with the flowing current. Or the problem is somewhere else. What you can try: Build a circuit like this

    and put it between your phases of the ESC and see if it switches off, too. Then it is not the load that causes the ESC to stop operation.

    Dennis

  • Hello,

    Where exactly can I put it? I mean, the Esc has three wires.

  • From A to B
    From B to C
    From C to A

**Attention** This is a public forum