[chbot] Motor controller

Mark Atherton markaren1 at xtra.co.nz
Sat Jan 24 04:34:48 GMT 2015


Sounds like you are making progress.

What is the frequency of the PWM timebase, maybe a multiple of 2MHz ?

I was playing with a PID controller with grunty-motor a while and resolved the torque-peaks issue by implementing a simple slew-rate limiter. An interrupt timer compared set point with current velocity, if the difference was greater than the allowable rate-of-change then maximum rate-of-change was added. Eventually the set point is reached and everyone is happy. Motor was a 2kg brushed unit, with a 500g load on the shaft. Feedback was via an optical shaft encoder and FPGA. PSU was 24V/30A with a 28V clamp. Managed to get the unit run from+3600RPM to -3600RPM in 85ms with 30A supply peaks. Had to clamp the motor to the bench (17mm ply) which was flexing every time the motor changed direction. H bridge was a 30A three phase / 600V IGBT , but only using 2 phases. Most impressed that none of the fixture got hot, let alone fried.

http://idesignz.org/mc/motorsetup.jpg
http://idesignz.org/mc/motorsetup.pdf

Also, it is possible to feed the A side of  the  H bridge with PWM, and the B side with /PWM (with an invertor between A and B inputs). At 50:50 PWM, the inductive load will not see any current flow (since both sides have an average of VCC/2). Change the PWM to 40:60, and average one side rises, the other side falls and there is movement etc.

-the-other-mark


At 03:54 p.m. 24/01/2015, you wrote:

Thought I'd report on a couple of problems that have arisen since I
demo'ed the motor controller for my walnut washer.

1. Looking at the waveform with a 'scope showed a one clock 0.5uS glitch
when zero was set in the PWM compare register in Fast PWN mode. Its a
silicon bug!! Rather than add an errata for the AVR Mega, Atmel have
incorporated the behaviour in the main body of the specification that
indicates that for a no pulse output the register should be set to the
'TOP' value. The problem with that is that the signal is now up-side-down.
Good job I'm a hacker when it comes to coding :)
I noticed that the 328 as used in the Arduino Uno and even the ATMega8 and
ATMega169 (Butterfly board) have the same problem. One to watch out for
especially if using a slower clock to the PWM timer.

2. As Mark questioned, what do the H-bridges do when there is no input.
That is actually 2 conditions - setting a PWN ratio of all off or all on
and then flicking to the opposite state (eg. hitting the stop button)
keeps the output MOSFETs engaged and the commutating diodes clamping any
back emf off the motor at it screeches to a halt.
The second condition is nothing like as severe.  In the case of a switch
off, the enable lines of the H-bridge are de-activated, so the output
stages float, so the motor just coasts to a halt in a 1/2 to 1 second.
Another coding change for the former condition now takes a running average
of the value required so that step changes are 'smoothed'. The motors no
longer fall over when started or stopped :)
-- 
Robin Gilks
Internet: robin at gilks.org    http://www.gilks.org
Tel:      (+64) (3) 347 4370

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20150124/a5370171/attachment.html>


More information about the Chchrobotics mailing list