Author Topic: Problem with driving multiple servos using an MCU  (Read 1956 times)

0 Members and 1 Guest are viewing this topic.

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Problem with driving multiple servos using an MCU
« on: October 03, 2018, 10:03:57 pm »
Hello i have been working on a 5DOF robotic arm project and i have a problem driving all the servos.
The arm consists of 6 MG996R servos and a generic Nema 17 stepper motor.

Problem : When i power the thing up some servos twitch or not work altogether even though the signals from the controller are fine. I think it is a power supply and not a signal issue but i feel lost in how i should proceed troubleshooting it.

Connections :

Laptop Power Supply : 18.5 V ,3.5 A which connects to  5 V buck converter capable of 5 A , variable buck boost converter which outputs 6.2 volts for the servos capable of 100W and another buck converter that provides 12 V for the stepper driver.

Logic :
On the logic side the 5 V converter powers the arduino and the controller, the controller connects via 4 pins (Vcc , SCL , SDA , GND) and its component communicate via I2C
The controller components are : ADS1115 ADC which reads 2 joysticks , MCP23017 IO Expander which connects with some buttons as well as the joystick buttons and rotary encoder and at last an 16X2 LCD with a I2C driver for it.

The arduino has an adafruit PWM servo driver clone which gets connected via I2C to the MCU and the servo power is provided by the 6.2 V 100 W capable converter and a DRV8825 stepper driver which drives the stepper motor.

Note 1 : I use the 5 V converter for the logic with some caps to keep the ADC readings and the Joystick voltages stable.
Note 2 : The controller and the stepper are working fine i just wanted to give the full picture to troubleshoot my problem
Note 3 : I know that chaining up all these converters is not ideal and the wrong way of doing it but i am asking here to get a better solution.

Thank you in advance everyone.

 

Offline Dubbie

  • Supporter
  • ****
  • Posts: 1114
  • Country: nz
Re: Problem with driving multiple servos using an MCU
« Reply #1 on: October 03, 2018, 10:11:18 pm »
Do you have an oscilloscope?
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #2 on: October 03, 2018, 11:01:44 pm »
I have a DSO cheap one that comes as a kit and picks up the mains frequency from the power supply but I will give it a try  :-BROKE
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11537
  • Country: my
  • reassessing directives...
Re: Problem with driving multiple servos using an MCU
« Reply #3 on: October 04, 2018, 12:19:24 am »
Hello i have been working on a 5DOF robotic arm project and i have a problem driving all the servos.
The arm consists of 6 MG996R servos and a generic Nema 17 stepper motor.

Problem : When i power the thing up some servos twitch or not work altogether even though the signals from the controller are fine. I think it is a power supply and not a signal issue but i feel lost in how i should proceed troubleshooting it.

Connections :

Laptop Power Supply : 18.5 V ,3.5 A which connects to  5 V buck converter capable of 5 A , variable buck boost converter which outputs 6.2 volts for the servos capable of 100W and another buck converter that provides 12 V for the stepper driver.
motor can easily suck few 10's of amp during startup, if say 10-20A transient is for each motor, 1 motor requires 120W to startup, you power supply is just 60W, you have 7 motors there (servo has higher load due to gearing and friction)... if all try to start at the same time, PSU can easily be choked. you'll need beefier PSU... the most comfortable is 2X transient my uneducated guess, 2 x 120 x 7 = 1.68KW PSU. maybe you can get by with 450 - 600W PSU with some hope.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Dubbie

  • Supporter
  • ****
  • Posts: 1114
  • Country: nz
Re: Problem with driving multiple servos using an MCU
« Reply #4 on: October 04, 2018, 12:24:49 am »
I'd check first that the servos have power. then secondly check that they are getting the expected control signals.
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #5 on: October 04, 2018, 08:54:04 am »
The servos are connected on to the PWM servo controller which provides them with the power. The problem i not at startup but during operation the startup process is fine.
https://www.adafruit.com/product/815
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Problem with driving multiple servos using an MCU
« Reply #6 on: October 04, 2018, 03:24:42 pm »
Random thoughts:

  • Power for servos comes from a different source than power for the Arduino.  If not, power supply design will get complicated
  • Ground for both supplies tied together - this is really important but it may be handled on the driver board
    Even without a scope, you can measure the servo voltage and the Arduino voltage.  You might be able to measure the noise by using a low range ACV
  • Use a different example for driving the servos.  Something that simply ramps them back and forth.  Get rid of the analog stuff for a while.
  • Make sure your analog ground ties in close to the Arduino and not over on the servo board
  • Try to measure noise on the analog supply if it is separate from the Arduino supply
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1924
  • Country: us
Re: Problem with driving multiple servos using an MCU
« Reply #7 on: October 04, 2018, 03:45:45 pm »
I second the power supply as the primary culprit. You need to examine the power rail(s) when the servos are told to move, which is why someone asked if you have a scope. I suspect it will be very enlightening. Most people don't give enough thought to power supply issues, particularly when big loads (like motors) are being switched. I've seen entire (or, worse, parts of) logic systems reset themselves when the supply glitches below their threshold(s). Such problems cannot be evaluated with a meter, you need a scope to see sub-microsecond events.
« Last Edit: October 04, 2018, 03:50:09 pm by IDEngineer »
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #8 on: October 04, 2018, 04:57:55 pm »
The servos were driven from the PWM driver. Every converter is sharing the same GND connection. I figured out my using my oscilloscope that the problem was the PWM driver. It does not output anything when told to move a motor. I am now trying to replace it by connecting all the pwm pins of the servos to digital pins directly and use I2C on the controller only.

Also to simplify this thing a bit i will try powering the arduino and the servos from the same 5v converter (hope 5 A would be enough current capability) and the stepper from the other converter. As for the ADC readings i hope they stay stable.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14309
  • Country: fr
Re: Problem with driving multiple servos using an MCU
« Reply #9 on: October 04, 2018, 06:29:41 pm »
Just a side note regarding "robotic arms" driven by servos.

Be very careful when powering your system on. Since servos are position-controlled, unless you can guarantee that they will each get exactly the same pulse width at power-on that they did at their last position when powered off, they WILL move. They may move so much as to make your robotic arm dangerous. So be very careful and never get anything too close to it when powering it on.


 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #10 on: October 04, 2018, 07:16:18 pm »
Believe me i had to deal with this a few times...
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #11 on: October 04, 2018, 08:29:00 pm »
Also when i tried driving the servos directly from the arduino it was acting weird after hooking up the logic analyzer i saw a lot of bouncing between the pulses.... why is that?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9886
  • Country: us
Re: Problem with driving multiple servos using an MCU
« Reply #12 on: October 04, 2018, 11:18:09 pm »
Also when i tried driving the servos directly from the arduino it was acting weird after hooking up the logic analyzer i saw a lot of bouncing between the pulses.... why is that?

Use serial IO to output the analog values.  Or get the analog out of the loop and use a simple up/down in a 'for' loop counter like some of the Examples. 

Serial IO is your best friend
 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #13 on: October 05, 2018, 11:13:59 am »
I did not get what should i do. I also think i messed up with the power supply so i am going to use a single 20W converter to get 5 v for the digital electronics as well as the controller , a 200 w capable converter for the servos at 6,2 V and last a 20 W converter at 12 V for the stepper motor.

I have currently disconnected the stepper motor and the controller to focus solving the issue with the servos.

The servos are driven by the digital pins of an arduino mega but i get a hum (at least with the 5V 5A converter which i use now) even when a single servo is connected and i try to drive it.

 

Offline ChrisGreece52Topic starter

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: gb
  • Electronics Engineer - Hacker - Nerd
Re: Problem with driving multiple servos using an MCU
« Reply #14 on: October 05, 2018, 03:01:06 pm »
After a few tests and many problems i sorted the power supply issue and i am now able to smoothly move the servos ... after some good coding it is going to be done.

a big THANK YOU to everyone that helped.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1924
  • Country: us
Re: Problem with driving multiple servos using an MCU
« Reply #15 on: October 05, 2018, 04:41:59 pm »
Sounds like this turned out to be a good learning experience. That's what happens when this forum is working the way it should... people help one another by sharing their knowledge and experience and everyone gets smarter. Congrats on threading that needle, and keep us posted!
 
The following users thanked this post: ChrisGreece52


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf