I have come upon an aircraft RC controller, and I wanted to use it to build a small robot / car.

I realise that an aircraft is not a robot, but I have come this far and feel like it should be possible to see it through.

The RC receiver (F-06A) is receiving signals and is producing a PWM signal.

I have some L298N modules and can successfully drive a motor.

The issue is that Channel 1 and 2 (and maybe others) are producing a steady motor rotation. Moving the sticks on the controller makes the motor go faster or slower. In a robot, we would expect a stick in "home" to be stationary, forward and reverse to rotate the motors forward and reverse.

I could probably use a small board and some C code to split the PWM signal between two inputs of the L298N, depending on the frequency.

My question is though, this feels like it should be a solved problem. Is there a component that one would normally use to solve this, or could it be done with a simple circuit?

Also, if there is a (polite) technical term for what I'm trying to do, I'd appreciate it!

[EDIT] I've got some absolutely amazing answers here, thank you all. I'm going to stop being lazy and get an oscilloscope set up - once I know what the waveforms actually look like, I'll work out which brilliant answer to tick.

  • 1
    \$\begingroup\$ Are you leveraging the same microcontroller that you have both on your controller and receiver? If so, then I'm curious to know how you're planning on reprogramming the microcontrollers and if you reprogram it, how you're going to know the PWM format, i.e. its transmission frequency, duty cycle, etc. \$\endgroup\$
    – Colin
    Mar 14 at 17:47
  • 1
    \$\begingroup\$ Which PWM frequency is generated by the receiver and does it have 50% duty cycle in the neutral position? \$\endgroup\$
    – Jens
    Mar 14 at 18:16
  • 1
    \$\begingroup\$ @Jens, dunno about this specific one but the standard for R/C controls is a 2 kHz waveform with PWM of 10..90% linear across the control's full movement. \$\endgroup\$
    – TonyM
    Mar 14 at 18:29
  • 1
    \$\begingroup\$ If you can still return the controller, getting a controller designed to operate an RC car would seem more appropriate as it comes out of the box with the behavior you are seeking - no modding necessary. \$\endgroup\$
    – MOSFET
    Mar 14 at 21:06
  • \$\begingroup\$ @Colin Sorry for the confusion; I wasn't thinking I'd reprogram the microcontroller in the receiver (even assuming it's possible). I'm thinking a second microcontroller - something like an ESP8266 or an arduino-alike. \$\endgroup\$
    – user208769
    Mar 15 at 9:08

3 Answers 3


A lot of hobby RC equipment is based on a series of pulses between about 1-2ms, at about 50+ Hz (where 1ms is 0% and 2ms is 100%). Some parts will work with pulses outside this range, and some things support a "calibration" mode so that the two pieces can be configured together for optimal operation.

an example 1-2ms waveform as described

This is what I expect the F-06A is producing... while it is (strictly speaking) a form of "PWM", it's not what most people outside of the hobby RC space will think of when you say "PWM" (as the duty cycle will never reach 0% or 100%, i.e: always low or always high)... see Servo Control and Servo (radio control) for more information.

Servos will typically respond to a 1ms pulse by moving "full left" and a 2ms pulse by moving "full right".

For speed controllers there are generally two modes - for example, those used for aeroplanes (where 1ms is stopped, and 2ms is full speed), and those used for vehicles (where 1ms is full reverse, 1.5ms is stopped, and 2ms is full forward). Electronic breaks can often be configured too.

The L298N you have is designed for two input signals - "forward" and "reverse". Providing a 0-100% PWM signal into one or other of these will control the output in that direction. If you've wired a channel of the F-06A to one of these signals and got something to happen, then it's likely responding to this 1-2ms signal... if it does stop, then that's only because the 1ms pulse doesn't provide enough torque to get things moving... equally, if it does start, then it'll likely have very low torque (about 10%).

You need to convert this 1-2ms signal from the F-06A, into either an increasing duty cycle on the "reverse" input, or an increasing duty cycle on the "forward" input of the L298N.

In simple terms, to get you started, the mapping may look like this:

  • 1.00ms input -> 100% reverse, 0% forward
  • 1.25ms input -> 50% reverse, 0% forward
  • 1.50ms input -> 0% reverse, 0% forward
  • 1.75ms input -> 0% reverse, 50% forward
  • 2.00ms input -> 0% reverse, 100% forward

a graph of the mapping described above

Don't forget that the PWM input to the L298N relates directly to torque, and is completely unrelated to absolute output speed... i.e: if you go up a hill, the vehicle will start to slow down. If you need / want speed, then you'll have to get a speed sensor and feedback loop involved. "Continuous rotation" servos also exist, which I believe will generally operate at a set speed for a given input, rather than torque.

could it be done with a simple circuit?

The above can be implemented easily with a small ATtiny or PIC, and minimal firmware effort.

  • \$\begingroup\$ Thank you - very informative. There was a period of testing where the motor was static except from a tiny pulse every half-second, that lasted about 10 seconds, which I suspected was the F-06A or the L298N calibrating somehow - not sure what made it change. Will attack it with an oscilloscope and let you know, I suspect, at the very least, you have preempted some questions I will have about the "rudder" signals... \$\endgroup\$
    – user208769
    Mar 15 at 10:17

If you have 50 % PWM duty cycle in the neutral position, you can directly feed this signal to one half leg of the bridge and the inverted signal to the other half leg.

With the help of a L/C low pass filter, here L1 and C1, you feed the motor with an average of the square wave created by the bridge.

At 50 % duty cycle the average voltage is zero, the motor stops.

If you use only 2 kHz as PWM frequency, relative large values for L1 and C1 are required, but the solution is simple and can be implemented with good old L298N (not my first choice here).

This schematic just shows the idea, L298N cannot be simulated with this tool. There also is no proper gate driver circuit.

The PWM duty cycle is defined with R1.


simulate this circuit – Schematic created using CircuitLab

R3 and C2 are added to measure the average supply current, at least R3 is not part of a real circuit. A bulk capacitor like C2 should exist to avoid supply voltage overshoot during fast direction changes, where the motor can act as generator.

A drawback is, that the circuit supply current is not perfectly zero in the neutral position. Switching, conduction and core losses are always present.

  • \$\begingroup\$ This was absolutely the answer I was looking for. I'm going to go down the microcontroller route first, because the other answers have convinced me that I don't really know anything close to what the signal actually looks like, but using two low-pass filters is brilliant and I would have never gotten there myself. Just out of curiousity though - "good old L298N (not my first choice here)." - I scrabbled around to find that I needed an H-Bridge, and that seemed to be the best choice, especially at the 3-5v range, but I have no experience here. What is your preferred choice for the job? \$\endgroup\$
    – user208769
    Mar 15 at 10:43
  • \$\begingroup\$ @user208769 What is your motor voltage and current? \$\endgroup\$
    – Jens
    Mar 15 at 11:04

The simple idea would be to drive the two phases with PWM and !PWM (inverted). The motor's inductance and mechanical inertia will integrate the PWM to a net drive level. At 50% duty the motor will see an average current of zero.

The problem with that approach is that it's wasteful. Even if the average is zero, the dynamic current is the same regardless of what the drive is doing, so even if the motor isn't moving there's lots of current circulating back and forth. This isn't desirable in a robot, as it makes excess heat and drains the battery.

What would be better is to convert PWM more intelligently into a set of signals that provide 0~100% PWM and direction control, as follows:

  • Reverse: 0 - 45% PWM -> EN = 0 ~ 100% PWM, In-1 = 0, In-2 = 1
  • dead-band: 46 - 54% PWM: EN = 0, In-1 = 0, In-2 = 0
  • Forward: 55 - 100% PWM -> EN = 0 ~ 100% PWM, In-1 = 1, In-2 = 0

This could be done in analog-land using some op-amps, but I think the behavior is complex enough that I'd recommend a small microcontroller to interpret the PWM input and make the pair of In-x inputs plus the EN signal. The micro would be cheaper and more flexible than analog. But, yes, you have some software to write.

A tip: Use PWM to modulate EN, and use In-1 and In-2 to set direction. This is a 'bang-bang' style drive: The motor outputs are alternating between drive and high-Z. This uses lower power than a continuous PWM.

A caveat when using PWM drive: PWM chop makes lots of electrical noise. Mind your power supply routing, and consider adding a common-mode filter to the motor drive signals.

Finally, don’t forget to put catch diodes on the motor drive wires. See the L298 data sheet.

  • \$\begingroup\$ This mostly aligns with my intuition, based on the motor behaviour I saw. The motor never reached stationary, even with the stick fully back - eyeballing it, I'd say the range is probably around 55% low - 75% midpoint - 95% high. I think you are right initially - configuring both the dead band and the midpoint using resistors is going to be a faff. My only concern is that it will drastically increase power consumption and reduce response speed. That said, definitely the first step. \$\endgroup\$
    – user208769
    Mar 15 at 10:33
  • \$\begingroup\$ Having a microcontroller in the middle should not significantly change response speed. The microcontroller can figure out the PWM on a cycle by cycle basis and compute what the output duty cycles should be. That said, you won’t be able to get good power consumption without doing something fancy to transform the PWM signal into an efficient motor drive. It’s much easier to do that in a digital domain than the analog. \$\endgroup\$ Mar 15 at 15:40

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.