I need to control a brushless motor that came connected to this ESC using the Arduino CNC Shield V3.00 and Grbl 0.9j.

I connected the ESC's black wire to a GND from the shield and the ESC's white wire to the shield's Z+ limit (end stop).

I then tested by connecting everything but leaving the ESC unpowered, sending several M3 S*commands, where 0 <= * <= 1000, then powering the ESC, but nothing happened.

  • very interesting post, but unfortunately working only for ATMEGA2560: reference line: #ifdef CPU_MAP_ATMEGA2560 any suggestion to make it possible also for ATMEGA328 chip? it would be really helpful for the most of Arduino UNO+GRBL Shield owner. TKS
    – Riccardo
    Feb 9 at 9:14

After a lot of research, I found out that the variable spindle speed output is a PWM signal, while the ESC needs a PPM signal to be controlled. Although that, it's a specific PPM signal that actually looks like PWM, so it can be used.

The problem is that, instead of being controlled by the duty cycle, what actually controls it is the amount of time that each pulse stays on high, which depends on the period, which is the inverse of the frequency. Long story short, the frequency is too high.

I managed to change the frequency used by grbl and found one that works. I don't know if this frequency allows the whole throttle range to be controlled but, for my application that doesn't require a very strict RPM, it was enough. Here are the steps (some steps are already explained elsewhere):

  1. Import grbl's library in Arduino IDE.
  2. Find out where the library got installed and edit grbl/spindle_control.c, lines 89 and 94.
  3. Change 0x02 to 0x05. Save and close the file.
  4. Compile and download the library to Arduino Uno.
  5. Connect everything but leave the ESC unpowered.
  6. Send M3 S0 (that's a zero).
  7. Power the ESC.
  8. You should hear a 123 tone (three beeps of different frequencies). It will then continue to beep once from time to time — I have no idea why... It should have stopped after a few.
  9. Send S600. It should start spinning. If it doesn't, first send lower values from 0 to 600.
  10. Send S500 to stop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.