PWM / RC motor control - newbie help - Page 1
Forum section: electronics / projects

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 09:29:36 am
content: 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 thanksDaniel

author: Ian.M
author_rank: Super Contributor
timestamp: July 11, 2018, 09:58:14 am
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: July 11, 2018, 10:17:02 am
content: "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.

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 10:28:11 am
content: Quote from: Ian.M on July 11, 2018, 09:58:14 amThanks 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?CheersDaniel

author: Zero999
author_rank: Super Contributor
timestamp: July 11, 2018, 10:36:55 am
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: July 11, 2018, 10:51:26 am
content: 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.

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 10:58:32 am
content: Quote from: Ian.M on July 11, 2018, 10:51:26 amI 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

author: Ian.M
author_rank: Super Contributor
timestamp: July 11, 2018, 11:22:00 am
content: 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.Edible bribery may help . . . . .

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 01:00:42 pm
content: Quote from: Ian.M on July 11, 2018, 11:22:00 am donuts are always welcome...Sent from my ONEPLUS A3003 using Tapatalk

author: james_s
author_rank: Super Contributor
timestamp: July 11, 2018, 08:34:05 pm
content: Quote from: Benta on July 11, 2018, 10:17:02 amI 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.

author: Benta
author_rank: Super Contributor
timestamp: July 11, 2018, 08:54:44 pm
content: "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 inlessstarting torque due to the magnetic/iron losses from the switching carrier.We're talking brushed DC motors here, of course.

author: danners430
author_rank: Regular Contributor
timestamp: July 11, 2018, 08:56:42 pm
content: Quote from: Benta on July 11, 2018, 08:54:44 pmYes, but when run constantly at a low speed it provides better continuous torque than a resistive controller.Sent from my ONEPLUS A3003 using Tapatalk

author: Benta
author_rank: Super Contributor
timestamp: July 12, 2018, 08:44:42 am
content: Quote from: danners430 on July 11, 2018, 08:56:42 pmI think you are confusing DC motors with induction motors with vector control.

author: In Vacuo Veritas
author_rank: Frequent Contributor
timestamp: July 12, 2018, 01:00:34 pm
content: Just buy ... a RC winch. They are servos with the stop pulled out, they are used in sailboats.

author: danners430
author_rank: Regular Contributor
timestamp: July 12, 2018, 01:02:29 pm
content: Quote from: In Vacuo Veritas on July 12, 2018, 01:00:34 pmUnfortunately 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

author: Ian.M
author_rank: Super Contributor
timestamp: July 12, 2018, 02:06:53 pm
content: 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.

author: danners430
author_rank: Regular Contributor
timestamp: July 12, 2018, 02:34:31 pm
content: Quote from: Ian.M on July 12, 2018, 02:06:53 pmI'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" If we ever need this circuit again, I'll revisit it and improve on it, but for now - it works, no touchie! Many thanks for everyone's input!!Sent from my ONEPLUS A3003 using Tapatalk