go_away

Author Topic: how to isolate servos from noisy motor  (Read 2376 times)

0 Members and 1 Guest are viewing this topic.

Offline szhangTopic starter

  • Robot Overlord
  • ****
  • Posts: 140
  • Helpful? 1
how to isolate servos from noisy motor
« on: October 24, 2008, 04:18:10 AM »
So my robot prototype now has a 12V motor and a 6V servo.  I have a problem right now in that the servo goes wonky from interference if I send a PWM signal to the motor, especially if it is a low duty cycle signal.  I tried some filter capacitors on the 12V line feeding the motor controller, hoping to absorbe some of the noise; it helped, but not nearly enough.  Anybody have a suggestion on what the best course of action here is?

Since I'm protyping i'm powering both through a bench supply, and the boards not are very well isolated, which probably contributes to the noise.  In any case, I am not sure I can provide separate power sources anyways.

Offline ArcMan

  • Supreme Robot
  • *****
  • Posts: 519
  • Helpful? 4
  • Mmmm... Plasma
Re: how to isolate servos from noisy motor
« Reply #1 on: October 24, 2008, 09:06:58 AM »
To reduce noise produced from your 12V motor do the following.

Attach a 0.1 uF capacitor from one motor lead to the motor case.
Attach a 0.1 uF capacitor from the other motor lead to the motor case.
Attach a 0.1 uF capacitor between the motor leads.

Ceramic disk caps work fine.

This noise reduction "network" is so common that many good R/C car motors come with the capacitors already attached like this.

I use it for all my robot motors.

Offline szhangTopic starter

  • Robot Overlord
  • ****
  • Posts: 140
  • Helpful? 1
Re: how to isolate servos from noisy motor
« Reply #2 on: October 24, 2008, 03:31:59 PM »
The motor already had those capacitors attached.

Offline Tsukubadaisei

  • Robot Overlord
  • ****
  • Posts: 293
  • Helpful? 0
Re: how to isolate servos from noisy motor
« Reply #3 on: October 25, 2008, 05:13:58 AM »
Notice that servos are digital devices, therefore they are very resistant to noise. maybe it is a software problem. check your code. If you are doing software PWM for all the motors and servos this problem may happen.
Separate power sources for the controller and for the motors are a must. Personally every single time I tried to run a dc motor using the same power suppy used for the controller it didnt work(dc motor drains all the power(should I say current?) for itself, resetting the controller).
A.I.(yes those are my initials)

Offline ArcMan

  • Supreme Robot
  • *****
  • Posts: 519
  • Helpful? 4
  • Mmmm... Plasma
Re: how to isolate servos from noisy motor
« Reply #4 on: October 25, 2008, 08:59:56 AM »
You make a very good point.  I don't know how many times I was sure it was a hardware problem, when all along it was software.

This is the nature of embedded systems development.

Offline szhangTopic starter

  • Robot Overlord
  • ****
  • Posts: 140
  • Helpful? 1
Re: how to isolate servos from noisy motor
« Reply #5 on: October 25, 2008, 09:54:01 PM »
No, motors (including servos) are analog devices (only the control signal is digital, and that gets converted to an average voltage by the motor inductance), otherwise you won't be able to control it's speed.  Plus, while motors are resistant to noise, the PWM signal you feed it is not, especially for the servo signals where the duty cycle is less than 10%.

In anycase, I checked the signals using a scope and both PWM looks perfect when disconnected from the motor.  So it is definitely the motor noise messing with the PWM signal to the servo, and not a software problem :P  I also know for a fact that the chip isn't resetting.

Maybe I should use some optoisolators?  Though i'm not sure I can spare enough space for another battery pack...
« Last Edit: October 25, 2008, 09:55:07 PM by szhang »

Offline Tsukubadaisei

  • Robot Overlord
  • ****
  • Posts: 293
  • Helpful? 0
Re: how to isolate servos from noisy motor
« Reply #6 on: October 27, 2008, 01:09:27 AM »
No, motors (including servos) are analog devices (only the control signal is digital, and that gets converted to an average voltage by the motor inductance), otherwise you won't be able to control it's speed.  Plus, while motors are resistant to noise, the PWM signal you feed it is not, especially for the servo signals where the duty cycle is less than 10%.

In anycase, I checked the signals using a scope and both PWM looks perfect when disconnected from the motor.  So it is definitely the motor noise messing with the PWM signal to the servo, and not a software problem :P  I also know for a fact that the chip isn't resetting.

Maybe I should use some optoisolators?  Though i'm not sure I can spare enough space for another battery pack...
I was talking about the signal, of course(usually in engineering, when you say a device is digital it means you use digital signals to interface with it(the same appies for analog devices)). And the PWM signal IS resistant to noise(that is one of reasons people use it). Do the maths: you need at least a 2.5V voltage drop on the PWM line in order to "confuse the servo". Just try to calculate the amount of current the motors must draw in order to produce a variable eletromagnetic field strong enough to produce such a voltage drop and you will understand what I am trying to say.

And as a said before you must have a separete power supply for the motors. Every time the motors turn on and off you electrical system gets unstable messing up the controller or the controllers inside the servos. If an extra power supply doesnt solve your problems the problem is 100% in your code. Notice that even if your code is wrong you will still produce PWM output. The problem is: are the pulse parameters(period and length) really correct?

Honestly I bet you can try any filter circuit it will NOT solve your problem. This is not a noise problem. If it were a noise problem you would be able to see the noise on the scope.
A.I.(yes those are my initials)

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: how to isolate servos from noisy motor
« Reply #7 on: October 27, 2008, 10:29:12 AM »
Do you have protection diodes on the motor?

check out the diagram in this link:

http://www.robotroom.com/HBridge.html

D1 and D3 etc... are the protection diagram there is an explanation near the bottom of the page why they are there. Basically when motors stop, slow down or are turned on and off quickly with pwm, then they can produce back emf which tries to go back through your cicuit in reverse. If your circuit is protected from this the only other way to escape is generally magnetic breakdown causing interference, if you use the diodes, it will direct the back emf into your batteries
« Last Edit: October 27, 2008, 10:36:42 AM by paulstreats »

Offline szhangTopic starter

  • Robot Overlord
  • ****
  • Posts: 140
  • Helpful? 1
Re: how to isolate servos from noisy motor
« Reply #8 on: October 27, 2008, 11:48:23 PM »
@Tsukubadaisei: Since the control signal HIGH is only 3.3V, it was pretty easy for the motor to mess up the PWM signal (a negative spike during a PWM high for example).  I checked with a scope, my code was correct (correct timing/length everything).

@paulstreats I'm using a motor driver with built-in protection diodes.

It turned out the problem was the motor noise.  In the end I just decided to have another 4AA battery pack powering the servo and the microcontroller.  The motor is driven with 12V from the main supply.  Works well so far.

Offline Tsukubadaisei

  • Robot Overlord
  • ****
  • Posts: 293
  • Helpful? 0
Re: how to isolate servos from noisy motor
« Reply #9 on: October 28, 2008, 07:36:40 AM »
Quote
@Tsukubadaisei: Since the control signal HIGH is only 3.3V, it was pretty easy for the motor to mess up the PWM signal (a negative spike during a PWM high for example).  I checked with a scope, my code was correct (correct timing/length everything).

No it is not easy. Just check your scope again: Is there any noise? If there is any then post a picture because I wont believe you.


Quote
It turned out the problem was the motor noise.  In the end I just decided to have another 4AA battery pack powering the servo and the microcontroller.  The motor is driven with 12V from the main supply.  Works well so far.

That is not noise. That is a bad circuit design. The motor drained all the power unbalancing the circuit. Just like I said last post ;).
A.I.(yes those are my initials)

 


Get Your Ad Here