Author Topic: PWM / RC motor control - newbie help  (Read 2161 times)

0 Members and 1 Guest are viewing this topic.

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
PWM / RC motor control - newbie help
« on: July 11, 2018, 09:29:36 am »
Hey folks,

Something completely different to my usual posts, as this is a topic which I've never before had anything to do with and have no idea about!!

I need to create a motor control circuit for a STEM event this weekend. The motor will be powering a winch, but as we couldn't get a gearbox for the motor, we're hoping to use a PWM circuit to reduce motor speed without compromising power. At the same time, we would like to have a circuit which the students can themselves build on a breadboard, and can be controlled by an RC car controller - the one I have in front of me is an Etronix Pulse FHSS 4 channel receiver.

Unfortunately, I'm way over my head in terms of this circuitry - I've never worked with PWM before outside using microcontrollers to do it, which in this case defeats the purpose of getting the students to build their own circuits, and I've never worked with RC control before. I've exhausted all my contacts, so was hoping someone here could point me in the right direction? Also, apologies in advance for asking more than just guidance, as due to the time constraint I really need to get any components ordered today!! :-(

Many thanks

Daniel
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PWM / RC motor control - newbie help
« Reply #1 on: July 11, 2018, 09:58:14 am »
On that sort of timescale, you'll be lucky to get *ANYTHING* working without a MCU, even if you order off-the-shelf PWM motor control boards, and mechanically couple the control pot's shaft to a RC servo.

Assuming the  Etronix Pulse FHSS outputs a Futaba compatible servo pulse,  you've got the problem of converting the varying width of a pulse between about 0.5ms and 2ms long, probably repeating something like 50 times a second into something you can  use as the duty cycle control for a PWM generator circuit.  Without a MCU, that's a Miller ramp generator or similar started by the leading edge of the pulse,  feeding a sample and hold strobed at the trailing edge of the pulse  to generate a control voltage to be compared with the output of a triangle wave oscillator to generate a PWM  + a whole mess of monostables to handle stuff like gating the sample and hold, resetting the ramp generator and inserting deadtime so your H-bridge doesn't blow up due to shoot-through.   An expert in the field of analog servo systems with all parts on hand could probably breadboard something suitable in a day or two, but as you have little specific experience, and have to order parts, a more realistic timescale would be a week or two, especially as you need to document it as a teaching guide.

« Last Edit: July 11, 2018, 10:02:07 am by Ian.M »
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6257
  • Country: de
Re: PWM / RC motor control - newbie help
« Reply #2 on: July 11, 2018, 10:17:02 am »
"we're hoping to use a PWM circuit to reduce motor speed without compromising power."

This is a contradiction in terms. By PWMing the motor, you're effectively reducing the voltage delivered to it. Of course this will reduce power.

 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: PWM / RC motor control - newbie help
« Reply #3 on: July 11, 2018, 10:28:11 am »
On that sort of timescale, you'll be lucky to get *ANYTHING* working without a MCU, even if you order off-the-shelf PWM motor control boards, and mechanically couple the control pot's shaft to a RC servo.

Assuming the  Etronix Pulse FHSS outputs a Futaba compatible servo pulse,  you've got the problem of converting the varying width of a pulse between about 0.5ms and 2ms long, probably repeating something like 50 times a second into something you can  use as the duty cycle control for a PWM generator circuit.  Without a MCU, that's a Miller ramp generator or similar started by the leading edge of the pulse,  feeding a sample and hold strobed at the trailing edge of the pulse  to generate a control voltage to be compared with the output of a triangle wave oscillator to generate a PWM  + a whole mess of monostables to handle stuff like gating the sample and hold, resetting the ramp generator and inserting deadtime so your H-bridge doesn't blow up due to shoot-through.   An expert in the field of analog servo systems with all parts on hand could probably breadboard something suitable in a day or two, but as you have little specific experience, and have to order parts, a more realistic timescale would be a week or two, especially as you need to document it as a teaching guide.

Thanks for the advice Ian,

I'm guessing then the best way forwards would be to use a microcontroller to control the PWM output, with the motor being driven by a MOSFET H-bridge? this would work for me, as we can easily get the microcontrollers delivered, and allows the students to learn very basic programming as well as basic electronics.

As for the RC receiver, as far as I know it does output servo pulses. However, from my experience a microcontroller could read these accurately with a little clever programming (saved into internal libraries which the students can call  :) ) - would I be correct in that assumption?

Cheers

Daniel
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19962
  • Country: gb
  • 0999
Re: PWM / RC motor control - newbie help
« Reply #4 on: July 11, 2018, 10:36:55 am »
What's the purpose of the exercise?

Practical skills or thinking?

Yes, teaching them to use a microcontroller, is very worthwhile, perhaps more so, than giving them a pre-designed circuit and asking them to build it.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PWM / RC motor control - newbie help
« Reply #5 on: July 11, 2018, 10:51:26 am »
Yes.  The MCU based approach is achievable.   On your very short timescale you cant afford to waste much time climbing the learning curve of a new MCU, so unless you already teach a 'house' MCU that's 5V and easily breadboardable, you'll probably be best off using something like an Arduino Nano.   There are already Arduino library functions for reading servo pulsewidths, and generating PWMs and code examples for H-Bridge shields are pretty common, so a couple of hours stringing it together should get something working.  Depending on the expected motor current, it may not be advisable to breadboard the H-bridge - you may need to use a H-bridge on a breakout board with screw terminals for power and the motor.

If you do have a 'house' MCU, you'll need to spend a bit of time writing and testing an equivalent to the Arduino pulseIn() function, and wrapping it up as a library for your students.  There's probably already a PWM library for your MCU, if not you'll need to write one.   

Its fairly easy to generate a reasonably good Futaba compatible servo pulse using a 555 timer IC - which could help you considerably as a signal source during software development.
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: PWM / RC motor control - newbie help
« Reply #6 on: July 11, 2018, 10:58:32 am »
Yes.  The MCU based approach is achievable.   On your very short timescale you cant afford to waste much time climbing the learning curve of a new MCU, so unless you already teach a 'house' MCU that's 5V and easily breadboardable, you'll probably be best off using something like an Arduino Nano.   There are already Arduino library functions for reading servo pulsewidths, and generating PWMs and code examples for H-Bridge shields are pretty common, so a couple of hours stringing it together should get something working.  Depending on the expected motor current, it may not be advisable to breadboard the H-bridge - you may need to use a H-bridge on a breakout board with screw terminals for power and the motor.

If you do have a 'house' MCU, you'll need to spend a bit of time writing and testing an equivalent to the Arduino pulseIn() function, and wrapping it up as a library for your students.  There's probably already a PWM library for your MCU, if not you'll need to write one.   

Its fairly easy to generate a reasonably good Futaba compatible servo pulse using a 555 timer IC - which could help you considerably as a signal source during software development.

I personally already do a lot with PICAXE MCUs - i was hoping to make use of the PICAXE Editor's flowchart programming to allow the students to learn - I've already used PWM with PICAXE MCUs before, i've just had trouble getting the editor software and USB drivers installed at the location the event is being held...

I'll get a circuit designed just now - thanks for all the help!!

Daniel
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PWM / RC motor control - newbie help
« Reply #7 on: July 11, 2018, 11:22:00 am »
Yes, PICAXE looks to be possible using their pulsin command to read the servo pusewidth, so you wont need to write any library functions.  :-+

I'll wish you good luck with getting I.T. support to install the editor and drivers.  :popcorn:
Edible bribery may help . . . . .  ;)
« Last Edit: July 11, 2018, 11:26:35 am by Ian.M »
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: PWM / RC motor control - newbie help
« Reply #8 on: July 11, 2018, 01:00:42 pm »
Yes, PICAXE looks to be possible using their pulsin command to read the servo pusewidth, so you wont need to write any library functions.  :-+

I'll wish you good luck with getting I.T. support to install the editor and drivers.  :popcorn:
Edible bribery may help . . . . .  ;)
[emoji23][emoji23] donuts are always welcome...

Sent from my ONEPLUS A3003 using Tapatalk

 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: PWM / RC motor control - newbie help
« Reply #9 on: July 11, 2018, 08:34:05 pm »
"we're hoping to use a PWM circuit to reduce motor speed without compromising power."

This is a contradiction in terms. By PWMing the motor, you're effectively reducing the voltage delivered to it. Of course this will reduce power.

I suspect what he really meant was "torque", PWM speed control is popular because it provides better starting torque than just adjusting the voltage. Torque and power are different things to an engineer but often confused.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6257
  • Country: de
Re: PWM / RC motor control - newbie help
« Reply #10 on: July 11, 2018, 08:54:44 pm »
"PWM speed control is popular because it provides better starting torque than just adjusting the voltage."

Please substantiate that statement. It goes against everything I've experienced through 40+ years of working with electronics and motors. In fact, PWM usually results in less starting torque due to the magnetic/iron losses from the switching carrier.

We're talking brushed DC motors here, of course.
« Last Edit: July 11, 2018, 08:56:40 pm by Benta »
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: PWM / RC motor control - newbie help
« Reply #11 on: July 11, 2018, 08:56:42 pm »
"PWM speed control is popular because it provides better starting torque than just adjusting the voltage."

Please substantiate that statement. It goes against everything I've experienced through 40+ years of working with electronics and motors. In fact, PWM usually results in less starting torque due to the magnetic/iron losses from the switching carrier.
Yes, but when run constantly at a low speed it provides better continuous torque than a resistive controller.

Sent from my ONEPLUS A3003 using Tapatalk

 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6257
  • Country: de
Re: PWM / RC motor control - newbie help
« Reply #12 on: July 12, 2018, 08:44:42 am »
"PWM speed control is popular because it provides better starting torque than just adjusting the voltage."

Please substantiate that statement. It goes against everything I've experienced through 40+ years of working with electronics and motors. In fact, PWM usually results in less starting torque due to the magnetic/iron losses from the switching carrier.
Yes, but when run constantly at a low speed it provides better continuous torque than a resistive controller.

Sent from my ONEPLUS A3003 using Tapatalk

I think you are confusing DC motors with induction motors with vector control.

 

Offline In Vacuo Veritas

  • Frequent Contributor
  • **
  • !
  • Posts: 320
  • Country: ca
  • I like vacuum tubes. Electrons exist, holes don't.
Re: PWM / RC motor control - newbie help
« Reply #13 on: July 12, 2018, 01:00:34 pm »
Just buy ... a RC winch. They are servos with the stop pulled out, they are used in sailboats.
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: PWM / RC motor control - newbie help
« Reply #14 on: July 12, 2018, 01:02:29 pm »
Just buy ... a RC winch. They are servos with the stop pulled out, they are used in sailboats.
Unfortunately not an option - makes complete sense, but we don't have time, and it means the students don't have anything to assemble :-(

Sent from my ONEPLUS A3003 using Tapatalk

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13119
Re: PWM / RC motor control - newbie help
« Reply #15 on: July 12, 2018, 02:06:53 pm »
To get good torque at low speeds, you may need to implement sensorless speed feedback.   
Basically, the average EMF generated by a brushed DC motor during the PWM Off period is proportional to the speed.  You'll need a series resistor to an analog switch gated by the PWM feeding a capacitor (to ground) to average the EMF, then a low input leakage current OPAMP buffer to feed a MCU ADC input, and possibly  scale the voltage for more resolution within the desired speed range.    You then need to write a proportional control algorithm to attempt to hold a constant speed by varying the PWM duty cycle.    If the EMF drops to zero, the motor is stalled, and in the absence of current sensing, to avoid burnout, you should stop driving it - but unless the winch has a ratchet mechanism, beware of run-back which will cause the EMF to go negative.
If you add current sensing, you can maintain torque while stalled, but if the motor is fan cooled, you need to derate the holding current significantly (from the max continuous operating current) to avoid burnout due to no cooling air flow.   A sealed motor doesn't need as much derating but still needs some as there will be little air flow within its housing to transfer heat from the rotor to its shell.

N.B. the effective time constant of the RC averaging network varys with the PWM duty cycle, so if you want to use this over a wide PWM duty cycle range you'll probably need to switch in different averaging capacitors.
 

Offline danners430Topic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: gb
  • Good at overcomplication
Re: PWM / RC motor control - newbie help
« Reply #16 on: July 12, 2018, 02:34:31 pm »
To get good torque at low speeds, you may need to implement sensorless speed feedback.   
Basically, the average EMF generated by a brushed DC motor during the PWM Off period is proportional to the speed.  You'll need a series resistor to an analog switch gated by the PWM feeding a capacitor (to ground) to average the EMF, then a low input leakage current OPAMP buffer to feed a MCU ADC input, and possibly  scale the voltage for more resolution within the desired speed range.    You then need to write a proportional control algorithm to attempt to hold a constant speed by varying the PWM duty cycle.    If the EMF drops to zero, the motor is stalled, and in the absence of current sensing, to avoid burnout, you should stop driving it - but unless the winch has a ratchet mechanism, beware of run-back which will cause the EMF to go negative.
If you add current sensing, you can maintain torque while stalled, but if the motor is fan cooled, you need to derate the holding current significantly (from the max continuous operating current) to avoid burnout due to no cooling air flow.   A sealed motor doesn't need as much derating but still needs some as there will be little air flow within its housing to transfer heat from the rotor to its shell.

N.B. the effective time constant of the RC averaging network varys with the PWM duty cycle, so if you want to use this over a wide PWM duty cycle range you'll probably need to switch in different averaging capacitors.
I'm afraid you've completely lost me :-)

I've actually managed to get a functional circuit designed, which is reasonably simple and possible for students to build themselves, so for now I'm gonna have say "no more designing" [emoji23]

If we ever need this circuit again, I'll revisit it and improve on it, but for now - it works, no touchie! [emoji23]

Many thanks for everyone's input!!

Sent from my ONEPLUS A3003 using Tapatalk

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf