SMC03A jitter?

We are using an SMC03A motor controller to control a 12V linear servo motor. We are using a Sharp GP2D120 to supply feedback on it’s position. The SMC03A is set to analog feedback. We have not tried to change any of the error loop settings yet.

Our problem is that the servo is jittering up and down a bit, as if the error loop is never stable. What is the best way to troubleshoot/correct this?

Also, if we do need to change register settings, are those retained when power is removed, or do we need to re-send the setting each time on power up?

Hello.

I suspect that a big part of your problem is noise from the sensor. Do you have a feeling for how clean it is? Maybe just an RC filter on that line could make a big difference.

All of the settings are stored in EEPROM, so you only have to set them once. The derivative term is sensitive to noise, so don’t use it if you don’t need it.

- Jan

Cool idea to use one of the Sharp IR rangefinders as feedback to position your linear motor. What are you trying to do in this project? I’m imagining that you’re trying to control some non-contact offset distance between your linear servo and obstacles around it. Be careful though, if something gets closer than about 3cm to your sensor, it could command the servo to ram right into it! Look at the feedback vs distance graph on the datasheet: http://www.acroname.com/robotics/parts/GP2D120_SS.pdf.

Before you start playing with the PID coefficients, you might want to check if the jittering is caused by instability in the feedback signal from your rangefinder. These fluctuations could be too small to show up on a multimeter. If you use a fixed voltage as your feedback signal, say by using a potentiometer as a voltage divider, or even just two resistors, does the motor still jitter? If not, there’s your problem, and you can smooth out your signal with a capacitor between the signal line and ground (or an RC filter as Jan suggests, I see just now that he’s responded too). Even if this only helps a little, you should use a stable signal when tuning your PID values.

If you do need to change the control loop values there isn’t any real formula for the correct values. That’s a lie, there are people who get PHD’s in systems and controls by working out exactly these kinds of problems, but it would involve characterization of the motor, the loads you are applying to it, and controller. I don’t think you really want to do that.

Instead you can determine good values experimentally by making small changes to the coefficients one at a time. The user guide briefly mentions a very good way to do this:

Start with the integral and differential terms set to zero, and test different values of the proportional term. If this term set low, the motor will move slowly, and it’s position will not scale linearly with the position command (with a purely proportional controller there will always be an offset from the desired position proportional to that position). As you increase the proportional term, your motor will move to the commanded position more quickly, and the offset will decrease and eventually become negligible, but if there isn’t enough mechanical damping in your system you will start to see oscillations about the commanded position.

If you do see oscillations before the motor speed and final position offset are to your liking, lower the proportional term until you see no oscillations and start to increase the integral term. This part of the loop will try to move the motor to it’s commanded position in response to it sitting in the wrong place for too long. Whereas the proportional term commanded the motor to move with a speed proportional to the position error, the integral term will command increases to the motor speed as it integrates (adds up over time) the error.

As you start to increase the integral term the motor will start to creep towards it’s true commanded position. As you set this term higher to get there faster, it may start to overshoot and cause oscillations again. This is when you can bring in the derivative term. This term will tend to slow the motor down as it approaches the commanded position, to prevent it from overshooting. As you set this term higher it will limit the speed your motor can reach as it approaches the commanded position (too high and it will never get there!).

The main thing is to change values slowly, and one at a time. Setting P or I too high can make the system completely unstable, where the jitters will increase with every oscillation! Also, don’t feel like you need to use both the I and D terms. You may find that P (I=0, D=0), PI (D=0), or PD (I=0) control is sufficient for you.

I see Jan also answered your last question. In general Pololu devices retain those sorts of settings without power (stored in non-volatile memory).

-Adam

Hi Jan, Nexisnet, thanks for the responses.

I tried a sliding potmeter as feedback and although it seemed a bit better, the jitter stayed.

The project is a bit different from what most people are building here… I’m building a Rans Coyote S6S (rans.com) and I’m using a linear motor to set the flaps 8)

I have already designed my own controller using an Atmel ATMega8L and a LMD18245 on breadboard but found the SMC03A a convenient option so I wouldn’t have to design a PCB for my own controller. Unfortunately it’s not working with the SMC03A just yet… My own design does work with both the linear potmeter and the Sharp sensor, no jitter.

I’ll start changing the error loop values with small steps, see if I can stabilize things. If you have any other suggestions, please let me know

I have to say my first thought when I looked at rans.com was “Wow, those are some nice model airplanes”. Then it dawned on me. Woah. Very cool.

Do you have any sort of open-loop backup you can switch to if, say, bright sunlight messes up your rangefinder reading? I guess if the FAA goes for it though…

I know Digikey has an official policy (it’s the first one on their Terms & Conditions page) stating:

“Products sold by Digi-Key are not authorized for use as critical components in life support devices or systems.”

I wonder if Pololu has a similar policy, because when you’re up in your Coyote it’s definitely supporting your life!

-Adam

Hi Adam,

The FAA has very little to say about this, as I’m in Europe :laughing: But you are right, the European authorities also have their demands and rules.

Pololu has a big safety warning in all their manuals warning that their products are not designed for “applications where malfunction can cause injury or damage”. Similar warnings are on all equipment in my plane, even the official avionics designed and built for planes… That’s OK with me, as the plane will be registered as experimental anyway. It will have big stickers that basically say: “YOU WILL DIE FLYING THIS CONTRAPTION! IF YOU DONT DIE, YOU’RE VERY LUCKY!” :wink:

As for sunlight on the sensor, there will be a cover over the sensor, and even if sunlight hits the sensor it has little effect. The specs claim about 5% difference, and the flap settings are not that critical.

Well it’s good to have that off my conscience, but why do you want to servo your flaps with IR range finders anyway?

-Adam

The reason for using an IR distance sensor is that it’s immune for wear and largely immune for external influences. I can also use an ordinary slider potmeter but moisture, temperature changes and wear can cause noisy feedback signals over time. Having a no-contact no-wear feedback system seemed like a good idea. What do you think?

I think it’s a very neat idea, especially if it’s only controlling the flaps (and not the actual steering surfaces of the airplane) and it does get you closed-loop, absolute, non-contact position control.

I’m curious why you wouldn’t instead go with the more standard approach of getting motors with sealed optical encoders.

-Adam

I’ve had some bad experience with optical encoder wheels in bumpy environments. An embedded potmeter might work, but changing to a different linear actuator when all the mechanics are already in place isn’t funny :frowning:

It also quite expensive. I think I found a suitable actuator with potmeter for just under $200, ex S&H. For that kind of money I’d rather try a couple of parameter tweaks on the SMC03A first :slight_smile:

I totally understand, and potentiometers aren’t so great in situations where they take unusual loads either.

My lab’s current serpentine robot, the Omnitread OT4, intially used two small potentiometers in each joint to sense joint position. These are high strength aircraft grade aluminum (2024) universal joints supported with ball bearings, but creep and shocks would still destroy the potentiometers over very short periods of time.

When building the second OT4 prototype, we spent a lot of time looking at alternatives, and eventually settled on 2D hall effect sensors. You can get little chips with the sensors embedded at 90 degrees from each other (there are 3D ones too, but I haven’t found a need for those yet) and special washer-shaped magnets with north and south poles at opposite sides of the circle: N(o)S as opposed to on the two flat surfaces like toy store magnets.

You put the magnet around, or on the end of your shaft, and the chip near the magnet and aligned in a plane with it (a Cartesian plane, not an airplane, although it would be both in your case). Each of the embedded hall effect sensors output an analog voltage proportional to the strength of the local magnetic field aligned with each sensor. With one sensor alone, the signal would vary with the particular magnet, and the distance from the sensor to the magnet, so you would have to calibrate it. With two sensors, you can treat the voltages as the sine and cosine of the angle of the magnet, and get full 360 degree position information with no calibration, and the distance between the magnet and sensor can even change (slightly, like from a big bump) without affecting the reading.

With no mechanical contact in the sensor, nothing ever wears out. These have been really great for us, I don’t think we’ve had to replace a single one on the Omnitread in close to a year since the swap. We get an angular position accuracy of within one degree, as opposed to 1.5 degrees with the potentiometers. There are also add-on chips, and some integrated sensor chips, that will do the trigonometry for you and output an analog or digital angle signal.

Now, at this point it would be a whole lot of development for you, especially when you already have something simple and elegant that works. Just something to think about next time.

-Adam

Thanks for the details and insight Adam. I could have used hall effect sensors if these were available for the actuator I use, but unfortunately that’s not the case.

All things considering I will first try to play with the SMC03A settings. I’m writing a quick program to do that from Windows or Linux right now.

If that fails I’ll start designing the PCB for my own AVR-based controller, I know that works. The AVR has a 10-bit ADC and I’m using an averaging algorithm to smooth out the feedback values. Once I get within 2% of the desired setting I stop the actuator and don’t power it up again unless I get outside of 4% or when my desired setting changes significantly. The error of 4% max is acceptable for my application, and this way there’s no jitter whatsoever.

I’ll need to check the SMC03A schematics, maybe I can port my AVR algorithm to the PIC processor and re-flash the microcontroller. Hmmmm…

The SMC03 has a PIC with limited hardware (16F684), so everything except PWM and ADC (most importantly, UART) has to be done in software. That makes all of the programming and timing a mess, so I do not recommend developing new code for that module.

- Jan