Hi,
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.
I’ve noticed that you’ve got
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?
Thanks for the input. I
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.
Thanks,
Config
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
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
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 (?)
Try a small capacitor
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.
Yeah, that’s one option if
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.
add a series resistor
Depending on the servo, the pulse input may draw excessive current or have noise on it. Try adding a 220 ohm resistor in series with the pulse signal on the servos and see if the brown out keeps happenning. If you are driving 20 servos, you probably have more than one pulse active at a time.
How many servos are you actually running, and where do they get their power from ? A 9V battery can only supply ~40mA before the voltage starts to drop.
I’ll try the resistor. I’m
I’ll try the resistor. I’m powering the servos from a dedicated 6v battery. I’m pulsing the servos one at a time at the moment, no fancy timing or control . I’m driving 12 servos.
Thanks. I’ve got the 22uf
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
It’s always a good idea to add .1uF caps on the power supply as close to each IC as you can.
0.1uF capacitor
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.
bingo
Thanks, adding the resistors seems to have made all the difference. Quite a royal PITA to retrofit the SMD resistors, but worth it.