Let's Make Robots!

Homebrew Servo Controller Issues


I've been developing my own serial servo controller for the hexapod I'm working on, using a Microchip PIC16F74.  It accepts serial input and controls up to 20 servos. The servos are connected in ports A, B and D.  Power for the PIC is from a 9v battery via a 7805 regulator.  The servos have a separate power supply from a 6v battery pack.

The problem I'm having is that the PIC seems to brown-out when the servos are running.  Powering from the 9v battery I get random behaviour, powering directly using the Microchip PICKIT2 programmer isn't possible as the programmer turns itself off complaining about a power issue.

I can't see why the PIC is having power issues when all it's supplying is the pulse?  Running anything over Port A seems to work fine, in a few cases I have the PICKIT programmer fail with just a single servo connected to the board on Port B.

Below is the simplified schematic of the board; I removed the TTL-Serial chip etc... Can anyone offer any thoughts as to why I'm getting this behaviour.  Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I've noticed that you've got a Vdd, Vss and your !MCLR line disconnected. It's better to have your Vdd lines tied together, and the same goes for Vss.

Depending on your !MCLR config settings, the free floating !MCLR pin could be the source of your device's erratic behaviour. What's your config word set to?

My config word is _HS_OSC & _WDT_OFF. I'm using a 20mhz crystal.  I'm programming in SourceBoost BoostBasic. While I can do rundimentary assembly the logic for this is a bit beyond my scope. I'm a high-level OO programmer (Java and C# primarily).

Hmm, I'm struggling to come up with anything else that is likely to be causing the problem. If using PORTA is fine then it can't just be bad soldering/wiring, or a toasted micro, and the caps on your 7805 should take care of any minor voltage spikes or sagging.

Have you measured to current being drawn through the 7805 in the circumstances where the PIC is misbehaving? Maybe hook up an oscilloscope to the Vdd line if you can too, worth eliminating as many potential issues as possible.

I don't have access to a scope, but will try and measure the current.  My multimeter is really basic, so I think I need to get a 1ohm resistor to measure milli-volts across to calculate the current draw (?)

Yeah, that's one option if you don't have a current meter as part of your multimeter. 1ohm should be fine for the expected load.

Thanks for the input.  I removed what I felt was superfluous information from the schematic, probably shouldn't have done that.  MCLR is connected to Vdd via a 1n4001 diode and 100k resistor for ICSP programming.

I will try connecting the Vdd and Vss pairs together.


I always put a small ceramic capacitor between VDD and VSS  on all the chips in my circuits to both filter noise and to supply peak current to the chip. I hope this helps.

Thanks. I've got the 22uf electrolytic on the inside of the 7805 to try and handle that.  Are you thinking it might be worth having something else?

It's always a good idea to add .1uF caps on the power supply as close to each IC as you can.

The problem with electrolytic capacitors is that they are not very good at supplying peak current.

My experience it always to put one across the supply of each chip and preferably as close as possible to the powersupply pin on the chip.