NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Servo causes MCU to reset

August 01, 2010
by gugulethor
gugulethor's Avatar

Hi there! I'm having some trouble controlling a servo with my NerdKit, and I think it's some power issue: I've connected a small hobby servo to the NerdKit as described in the Servo Squirter tutorial and used only the parts of the software that control servo movement. When I now start the MCU in app mode, the servo starts to move a little bit (from the program trying to move to the initial position) and I get some repeated messages on the serial line. Those can range from a lot of non-sense, to some repeated "baba" (which as I've learned in the forum comes from the boot loader), or, if I send a welcome message to the serial before trying to move the servo, I also get this message repeated a couple of times. Eventually nothing happens anymore.

Am I right? Is this a power issue? Oh yes, it doesn't make a difference if I use a battery or power supply. So if it is, how can I connect the servo's power independently? If it isn't a power issue, what elso could it be?

Since we are on that topic: The servo's specs seem to say that it brings maximum torque at 6V. Can I have two voltage regulotors on one power source, say a 7805 for the MCU and a 7806 for the servo? Are they then wired parallel? Or doesn't that make sense?

August 01, 2010
by mongo
mongo's Avatar

I had the same issue with the servos weirding out the power. I found that adding a capacitor across the power leads of the servo helped a lot. I think they were 100 uF electrolytic caps.

The 7805 can be wired in parallel to double the current but it is usually not done. I think the biggest problem here is running off the 9V battery, which might not be delivering enough current to handle the surge of the servo in action.

The servos work just fine on 5V and a separate power supply would just be a waste. Just try running from a wall pack or a power source that can handle the surge.

There is a conversation thread about mounting the Nerd Kits where I posted a photo of my setup for the servos. I can't remember the exact place but I know it's here somewhere.

August 02, 2010
by gugulethor
gugulethor's Avatar

Thanks mongo! Connecting a 100uF across the servo power did the trick, at least for one of my servos. I have another slightly stronger one, that causes the MCU to reset about midway going from min to max position. So should I just increase the capacitance? 100uF seems already large isn't it?

August 02, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi gugulethor,

Step 1 is to determine whether you're being limited by the output of your battery/power supply, or by the output of the 7805 voltage regulator.

I suspect that you might be limited by the 7805's ability to supply current. If it can't supply enough current, the output voltage drops. In fact, the 7805 actually does some fancy "foldback" stuff to try to avoid permanent damage to itself. This is good because it makes the device survive temporary harsh conditions, but might be bad for your application because the foldback might be conservative relative to your load profile. That is, it doesn't know that the servo will be asking for a lot of current only for a few tenths of a second.

Take a look at the 7805 datasheet and specifically the graph labeled "Peak output current vs. input/output differential voltage" (in the linked PDF this is Figure 34 on page 39 -- but I believe it may be in a different place on the 7805 datasheet version we have on our members downloads page). This shows the foldback behavior. Basically, to get the most current out of the 7805 before it starts to limit you, you need to keep the chip cool (heatsink!), and have an input around 10V.

Sometimes the hobby servos can tolerate higher power supply voltages than just 5V. Your idea of running two separate linear regulators (the 7805 and 7806) from one power supply is ok, except that as mongo suggests, the power supply itself may have a "equivalent resistance" that causes voltage drop before either regulator.

Another workaround would be to limit the servo speed and acceleration in software! Instead of jumping from one extreme PWM value to the other, try creating a slow linear ramp. I concede that this is not an ideal solution, but it might help you out in this case.


Post a Reply

Please log in to post a reply.

Did you know that you can adjust most wire strippers to make it easier to strip insulation faster? Learn more...