3
\$\begingroup\$

I want to use an Arduino to control the throttle signal going to a high power motor ESC. The problem I have is as the Arduino outputs a PWM, the ESC reacts by pulsing the power to the motor. So I searched a bit and I understand that to convert the PWM output of the arduino to an analog signal I can use a RC filter. Also I was wondering whether DAC ICs actually convert PWMs to analog. Knowing that the Arduino has a PWM frequency of 490Hz, which of the two methods would you recommend? Thanks for your help!

\$\endgroup\$
4
  • \$\begingroup\$ What dynamic qualities do you require in your analogue signal? \$\endgroup\$
    – Andy aka
    Commented Oct 2, 2016 at 10:40
  • \$\begingroup\$ Very low voltage ripple and relatively fast settling time. The latter being the variable I can most compromise on. \$\endgroup\$
    – Eliott W
    Commented Oct 2, 2016 at 10:47
  • \$\begingroup\$ ... and put into numbers? \$\endgroup\$
    – Andy aka
    Commented Oct 2, 2016 at 10:58
  • \$\begingroup\$ I am not sure what is reasonable to expect. As I want to control the throttle of a bike, I need the throttle to be as accurate and constant as possible so a voltage ripple as close to 0 as possible. At the same time for PID control performance, comfort and experience the fastest response time possible is also ideal. I would say that higher than 100ms would start to be inconvenient but again I don't know if this is reasonable. \$\endgroup\$
    – Eliott W
    Commented Oct 2, 2016 at 11:07

2 Answers 2

2
\$\begingroup\$

If your motor driver (AKA electronic speed control) is of the type used in radio controlled models, the expected speed control signal isn't just a voltage level. It listens for the RC servo "protocol": A constant frequency (usually 50 Hz) square wave with a high time between 1 ms (motor stopped on an aircraft, full reverse on car/boat ESCs) and 2 ms (full forward). While this is often called PWM, you can't just feed any PWM signal to it and expect it to work.

A servo control signal with the correct timing is easily generated by an arduino with the included servo library.


If the motor driver does actually expect a signal in the form of a voltage level (like some E-bike motor drivers, for example), you need an actual digital to analog converter (DAC) to set the speed.

  • As you already suggested, the easiest way is probably to use the PWM output library function analogWrite() and low pass filter the waveform. This is an actual, rudimentary form of a digital-to-analog converter, and should be more than good enough for your application.

  • You can use a dedicated DAC chip. While I have never seen a DAC chip which takes a PWM input (A PWM signal is actually not digital even though it only has two voltage levels, as pulse width is a continous analog property), you can buy DACs with either a serial (e.g. I2C or SPI) or a parallel(one input pin dedicated for every bit) interface.

\$\endgroup\$
0
\$\begingroup\$

PWM is one way of implementing Digital to Analog Conversion (DAC). But not the only way. It is NOT correct to say "DAC ICs actually convert PWMs to analog."

Your question is too complex to be answered as a simple generic question. There are many variables in the overall design which must be considered when deciding whether to use PWM or a more traditional method of conversion.

There had been hundreds or thousands of circuit designs implementing exactly the same function you are asking about. Typically, motor controllers use the special UN-filtered form of PWM defined for traditional radio-controlled model aircraft, etc.

Your question appears to indicate that you have not yet sufficiently understood the issue. Your question doesn't make sense as you have asked it. Common motor speed controllers and R/C receivers, etc. do not use traditional DACs at all. They ultimately perform a DAC function, but they don't use DAC chips to do it.

\$\endgroup\$
2
  • \$\begingroup\$ In my specific case, I don't have a choice but to go through a PWM as I am using an Arduino. When I connected this to my controller, it actually pulsed for every wave so the motor response was not continuous at all. This is why I am searching methods to smooth it. All I want to know is if it would be worth putting a DAC between the Arduino PWM pin and the controller throttle input or if a RC filter will be sufficient with the appropriate characteristics. \$\endgroup\$
    – Eliott W
    Commented Oct 2, 2016 at 11:21
  • \$\begingroup\$ @EliottW I don't mean to be rude, but it only takes 10 cents worth of components to make an RC filter and see what difference it may do - have you tried that? If you cannot quantify your speifications in numbers (P2P ripple etc.), then maybe you can try out some different RC-constants and see how it works for you ? \$\endgroup\$ Commented Oct 2, 2016 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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