I have my FEZ mini robot with a servo connected. When I run this simple program, when the motors turn on servo starts going bananas, (random motion). Seems like there is some kind of cross talk going on. When the motors stop the servo returns to the 90 position. Any ideas??
using System;
using System.Threading;
using Microsoft.SPOT;
using GHIElectronics.NETMF.FEZ;
public class Program
{
public static FEZ_Components.ServoMotor myServo = new FEZ_Components.ServoMotor(FEZ_Pin.Digital.Di8);
public static void Main()
{
// Set Servo Position
myServo.SetPosition(90);
Thread.Sleep(2000);
// Move Forwards
FEZMini_Robot.Move(50, 50);
Thread.Sleep(5000);
// Stop
FEZMini_Robot.Move(0, 0);
}
}
Looking at the servo driver “FEZ_Components_ServoMotor.cs” it looks like it’s using OC.
Looking at the robot driver “FEZMini_Robot.cs” it looks like it’s using PWM.
Motors connected to motor pins & servo connected to Servo Port 8 on inex board.
We finally got a chance to try it and yes we can see the same behavior. Digging more into it, we learned that all signals are perfect! What is causing the problem is power. When the motors run with no load, they generate a lot of noise. Looks like the robot is not filtering that noise enough and the servo is acting funny with that very little noise we have! I blame it more on the servo! Try to put force on the wheels and you ill see how the servo will stop acting funny.
The fix: (none is ideal but here are some ideas)
try a different servo if you have one
add filtering on the power line going to the servo. I tried capacitor and it wasn’t enough! We will need some ferrite beed + capacitors.
power the servo separately. I didn’t try to get voltage directly from the batteries to the servo but this will probably work.
I would be surprised if it was a servo error. I have done a lot of playing with servos lately and I havn’t had any issues with noise, even when pulling power from the FEZ. It may depend on your servo, though.
I do not know either why the servo would be the cause either. Gus said it’s the servo, however I would think it would be the DC motor. They are known for enormous noise.
Anyway. Connecting motors to a different power supply then your chip is the best thing to do.
There is noise but it is not too bad at all, maybe 50mV of noise winch shouldn’t effect anything. For example FEZ Mini still works fine even with that noise coming in
OK, so what servo did Hai Nguyen use in the July 18, 2010 video on the tinyclr.com Main page. Servo seems to behave itself in that video, whats did he do different?
I don’t know how the motor control is done, but in general adding some fast shottky diodes is always a good measure (if the robot doesn’t have them yet).
Look at this page (there is a connection diagram in the middle of th page):H-Bridge DC Motor Schematic - Robot Room
I had similar issue with my late CNC router (RIP ) and the diodes made all the difference…