We are making a junior soccer robot and we just got our brilliant motors from Maxon. Setting the PWM timer to low-frequencies (around 39kHz or 156 kHz ) the robot acts as expected. But this produces some problems.

  1. It puts a heavy current on batteries (around 1.5A for 3 motors which is far too high).
  2. The high current causes our motor drivers (L6203) to heat up very quickly and even heat-sinks won't help them.
  3. The motors make such a bad sound as they are screaming and this is not normal.

In contrast when I configure the timer on high-frequencies (such as 1250 kHz or 10000 kHz) the current drops off to 0.2A which is ideal and the sounds quit down. But this causes a problem that our 3 motors when set to run on their highest speed (PWM set to 255) don't run by the same rpm. like one of them runs slower than others making robot turn to a specific side and so our handling functions fail to work correctly.

Asking someone he told me that the drivers don't respond the same to frequencies thus resulting in different speeds and because on low frequencies the difference is very small I won't notice it but on higher frequencies the difference becomes bigger and noticeable.

So is there any workaround for this problem? or I should continue using low frequencies?

PS: I'm using ATMEGA16 as the main controller with a 10 mHz external crystal.

  • $\begingroup$ Just so we're clear, are all of the drivers identical? $\endgroup$
    – Joe Baker
    Mar 3 '13 at 7:17
  • $\begingroup$ Yes the drivers are all identical.. $\endgroup$ Mar 3 '13 at 18:35
  • $\begingroup$ Is there a specific cutoff frequency where it gets problematic? Also, do you have access to a logic analyzer by any chance? $\endgroup$
    – Joe Baker
    Mar 3 '13 at 23:16
  • $\begingroup$ I don't know if there is a cutoff frequency or not... However my guess is that the 10mHz crystal can't produce the required clock for 3 motors. Is that even possible? what do you mean by logic analyzer? however I own an oscilloscope. $\endgroup$ Mar 4 '13 at 15:45
  • $\begingroup$ Highly doubt it's the crystal. A logic analyzer is a special type of scope (or sometimes an addon module for an existing scope). I was once dealing with a jitter issue in PWM signals that was causing servos to shake. We used a Salae (saleae.com/logic) to take a big (~10k pulse) sample of the pulses at a given width and measured the jitter by calculating the standard deviation of the widths of the sample set. It's possible that you could use your scope to hunt for similar issues, but you likely can't get a big enough sample at once for stdev calculations. $\endgroup$
    – Joe Baker
    Mar 4 '13 at 16:06

While I do not know how to fix the root cause of the problem, a work around is to use closed-loop feedback. If you can measure the speed of each wheel (for example, with encoders), you can use a PID-like algorithm to adjust the speeds of your wheels so the robot goes straight.

A compass or gyroscope would also be suitable for this task.

  • $\begingroup$ I'm already using a compass and PID for my spin back functions to get the robot in the right direction to the opponent goal. However your answer would work but I would need to solve out the problem rather just reduce the speeds until the robot goes straight. Thx $\endgroup$ Mar 3 '13 at 18:34
  • $\begingroup$ @MiroMarkarian - The point is that if you have one PID loop per motor, it shouldn't matter that they respond differently because the PID loop will adjust the PWM output for each motor so that the encoder on the wheel tracks the desired speed & position. $\endgroup$
    – Mark Booth
    Mar 4 '13 at 16:43

Two issues on hardware,

a) Chip takes time to turn on and off. Heating up more while in-between on and off. So, no point to use too high frequency. Generally, 10, 15 or 20KHz max, out of human ear range is enough.

See details (explain frequency effects with examples of 20 chips from many companies) (especially those items state ultrasonic frequency 20KHz) in

b) Motor coil has inductance. Too high frequency reduce current flow, low torque, low RPM.

Apparently, 0.5A per motor seems in normal range. Likely, at 6, 7.2 or 12 volts, a few watts to 10 watts per motor for fast robot motion.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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