Maker Pro
Maker Pro

Servos jerking around!

roineust

Jul 2, 2013
34
Joined
Jul 2, 2013
Messages
34
Hello!

I am building a project, that includes an Arduino pro-mini 5V, a small, but relatively strong, slot-car 12V ~5A DC motor and 6 micro servos.

My problem is, that when the DC motor is working, the servos start jiggling and jerking and not going exactly in their programmed path. I have used a 4000mAh 30C battery, so i think it can not be the battery current capacity.

Can you help me solve this please?

P.S.
Harald just told me, that it might be an issue of noise reduction, because of the disturbance emitted by the DC motor.
If this is indeed the most probable cause, what is the easiest way for a layman to add noise reduction to the circuitry?

Thanks!
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
The motor generates disturbances on the power supply. You need to filter the supply so the servos don't see the disturbances.

Find suitable circuits using Google, e.g. this one..
You may need to add an additionalk filter in the power supply lines that go to the servos and the servo controller/arduino to further decouple them from the motor.
 

roineust

Jul 2, 2013
34
Joined
Jul 2, 2013
Messages
34
Harald!

From my limited electronics knowledge, what i see in the link you referred me to, is that i should add a circuit containing many capacitors, to the motor and MOSFET (switching) circuit?

Wouldn't adding a capacitor, just to the motor + and ground, solve the problem?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
A capacitor alone will do some filtering, but typically not enough. You will also need the inductor(s). An inductor + a cpacitor form a rather effective filter for high frequency noise as generated by a motor.

You can buy dc noise filters commercially. A hobby shop near you should be able to help.
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
Just another thought.

Are the servos driven from software in the Arduino or hardware driven? Even slight variations in the pulses to the servos will cause jiggles and erratic behaviour. So if the the PWM is software driven and the CPU gets busier when the motor is running, CPU loading is a possibility worth investigating.
My experience with servos is that they require as near as dammit perfect square wave, otherwise they chatter. Stick a scope on the servo signal and see what it looks like. Also check that the duty cycle does not vary for a given position for the servo.

Apologies if I mention suggestions that you know about.
 

roineust

Jul 2, 2013
34
Joined
Jul 2, 2013
Messages
34
Harald,
Should i connect the noise reduction circuit to the motor or to the Arduino?
 
Last edited:

roineust

Jul 2, 2013
34
Joined
Jul 2, 2013
Messages
34
shumifan50,

When i had the exact same configuration, but with 2 servos, instead of 6 and an Arduino Uno, instead of an Arduino pro-mini, there was no problem.

Does it make the software possibility more viable or less?
If it is the software, what can i do to fix the situation?

Thanks.
 
Last edited:

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
Is the PWM driven from software in the Arduino or is it driven by dedicated hardware?
The answer to this question has a huge impact on the answer to your question.

I had a quick look at the Arduino specs (I have not used them myself) and it seems that if you have the 5V version of the pro-mini it is the same as the Uno as far as CPU speed is concerned(provided you run it at 5V). So, what happens if you run the 6 servos off the Uno? Does that work or does it also fail?

I regularly drive 2 motors with 2 servos from a PIC with no hassle and fairly primitive power supply(transformer, rectifier, regulator, caps) and it works fine.

A clue might be in the 6 servos; they will draw a lot of power if they are all driven simultaneously. Add the motor current and maybe the battery cannot cope. Again I have not used batteries with my motor/servo circuits. What happens if you reduce the number of connected servos to 1 then 2 then 3 etc? Depending on what the servos are used for and how they are used, will also have an impact. What causes them to change position? Is it a continuous varying cycle or is it based on some inputs received?
 
Last edited:

roineust

Jul 2, 2013
34
Joined
Jul 2, 2013
Messages
34
shumi,
It is software driven and runs on a continuous varying cycle.
At any given moment, there are only 2 servos moving, when the DC motor is on.
And it was exactly the same with the Uno, with no jerking problems.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Should i connect the noise reduction circuit to the motor or to the Arduino?
primarily to the motor. A second filter to the arduino may improve noise behavior even more.
But you have given important new info regarding the use of the same setup with another type of arduino. Follow shumifans lead. What happens when you disconnect the motor? No motor, no noise, this simple test can easily identify whether noise is an issue here, or software.
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
I read up some more on the Arduino and it seems that the PWM is hardware driven (AnalogueWrite()) but does use the timers. so it is quite possible that driving 6 PWM outputs will interfere with each other through the timer.
To try and establish if this is the problem, I would suggest disabling some of the servos in the software(comment out the Analgue Writes) and see if the situation improves. You could also try and increase the period of the overall cycle to lower the CPU load and see if that makes a difference.

Note that these suggestions does not rule out noise interference as the 2 boards are different and might have different sensitivity to noise. To this end i would try and run the 6 servos off the Uno. If the Uno works then it is most likely noise causing the problem on the pro-mini. If the Uno also fails, it is likely overload or maybe a program bug.
 

mursal

Dec 13, 2013
75
Joined
Dec 13, 2013
Messages
75
Might be worth measuring the average (DC) voltage across the supply rails with everything running?
If it is noise, you will have to experiment with different filters across the individual loads to see what gives the best results.

Did you try capacitors (of different values) as close to the loads as possible, yet?

Loads = servos, motors etc
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
What does 'no motor no noise' mean; Do the servos behave properly?

If so:
It might now be one of two things: noise from the motor disturbing the pro-mini or too much current drain on the battery.

I would still try running it off the Uno to see if it works.
 

roineust

Jul 2, 2013
34
Joined
Jul 2, 2013
Messages
34
Mursal and Shumifan50,

If i keep the code logic and just disconnect the motor, the problem goes away. It is probably an electric problem, probably noise disturbance caused by the DC motor.

I have soldered 0.1M capacitors in several places (between the DC motor + and - legs, between the Arduino + and - outputs to the bluetooth dongle and before the + and - power to the servos).

But, it only changed a bit the manner of the servos jerking in the following way - a few servos stopped jerking, while other servos, moved from strong jerking to either mid-strong jerking or most of the time, they just move to a certain position and then not respond at all, until the DC motor is switched off.

All these problems occur, only when the DC motor is switched on, when it is not switched off, the servos respond good.

I don't think it is a battery Amperage drain problem, since this also happens with a 4000mAh 30C LiPo 3s battery. After All, how much Amps, could be drawn by one Arduino pro-mini with a BT dongle, 6 micro servos and a strong, but a really small (around 20 grams) DC motor ??

Here is the motor:

http://www.electricdreams.com/Shop/scale-auto-sc0022-motor-ff-p-6287.html


It must be noise disturbance, don't you think so?

Mursa,
What other values should i try and in what positions?


Thanks!
 

jpanhalt

Nov 12, 2013
426
Joined
Nov 12, 2013
Messages
426
Confused.

I thought you stated that motor +fewer servos worked fine. If that is the case, then it seems to be an MCU problem as shumifan50 suggested or your voltage regulator. Although, fixing excessive noise from the motor should still be done.

It is a common observation with multi-servo sailplanes (≥6 on flight control surfaces) that if all servos are loaded, as in landing, the voltage drop and noise causes problems. The solution is a switching voltage regulator of higher capacity.

John
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
It certainly looks like it might be noise. The only evidence against that is the fact that it worked with 2 servos and the motor on the Uno board. Now this might be a board sensitivity issue, but it could also be the new configuration. I keep saying this: I would try the 6 servo/motor config and software on the Uno to see if it works.

Do you connect to the raw power input of the arduino with the 11.1V from the battery or do you regulate it externally and connect to the regulated input on the Arduino? You could try a little regulator board for the arduino and connect to the regulated power input.

Power consumption should not be an issue if I understand the LiPo product codes correctly your 4000mAH 30C should be capable of 120A. The servos stall current can be about 350ma each and the motor specs says 280ma max, so added together(< 3A) well within specs.

Suppressing the noise from the motor would be a good idea regardles although I have never had this problem with the PICs that I use with 4 servos and 2 motors.

Can you describe EXACTLY what you are doing (with block circuit diagram) if possible) - include ALL componets, whether you think they are relevant or not.

Something to bear in mind about servos: If they are driven to a specific position and have no resistive load, their current will decrease to almost zero, but if they have to keep pushing, like against a spring, they will continue drawing current and require a steady WPM signal.
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Try running separate power leads to carry the current to the DC motor.

Even though ground will have to be common, keep 2 separate ground connections also and jumper them with a low value (1 ohm perhaps) resistor.

You can test this idea out by having the circuit operating correctly without that DC motor, then run the DC motor directly from the battery using separate leads. If the circuit continues to operate correctly, my idea will likely solve your problem.

If you can tell me how the motor is driven (high or low side mosfet or bipolar transistor?) then I can draw you a schematic.
 

jpanhalt

Nov 12, 2013
426
Joined
Nov 12, 2013
Messages
426
The OP is using 3S lipos (about 12 V, fully charged). Those always have a voltage regulator before the servos, which generally operate at 4.8 or 6.0 V nominal.

John
 

shumifan50

Jan 16, 2014
579
Joined
Jan 16, 2014
Messages
579
Summary of all of the above(which by now is confusing I'm sure).

Suggested debug sequence;
1. Steve's suggestion to run the motor off separate leads directly off the battery. This is easy and quick to test. If this works, problem solved.
2. Try the same configuration on the Uno. If it still fails, it is most likely a software problem or too much processing required to drive the 6 servos or even a wiring problem. Have a look at speeding up the code. If it works, you have eliminated a software problem and also proven the rest of the circuit, so the remaining area is the pro-mini hardware.
3. Insert a power regulator between the pro-mini and the battery and connect to the regulated input rather than the raw input. Do not use the same regulator as that for the servos.
4. Starting at one, increase the number of servos until it stoops working. It is preferable to to comment out the analoguewrite() of the unused servos. If it fails before all the servos are connected, we can have a look at what to do about it. If it fails with just one or two servos go to the next point below.
5. Try to eliminate noise as posted above. I put this here as I have never had the noise problem, but I have never used Arduinos.
6. If it still does not work we need some scope work to see what the signal to the failing servos look like and some measurements of voltages at the various supply points.

As a matter of interest: how do you regulate the supply to the servos? Can the regulator handle 6 servos which can draw more than 1 amp easily.
 
Top