|
|
View previous topic :: View next topic |
Author |
Message |
techn0
Joined: 09 Jun 2011 Posts: 4
|
Occasional Erratic behavior on PIC startup |
Posted: Thu Jun 09, 2011 2:05 pm |
|
|
I am using a 16f873a to control 2 smaller DC motors using the hardware PWM outputs connected to a couple of mosfets. This is being used in an ag related product. My question is really about what you guys would change on my voltage regulator and power capacitors to make my design less prone to voltage transients that could possibly be causing erratic behavior. For example when the unit powers up, occasionally the pumps are running full bore and the MCU does not respond to commands. The majority of the time it is working perfectly. One of the first things the program code does is set the pwm outputs to zero.
I have the power up timer enabled as well as the Brownout enabled. I am not using the Watchdog as of right now.
The electrical system coming in is very similar to that of the automotive environment. alternator driven 12v system that is going to range from 11v to 15v.
Right now I use a 1n4007 diode to protect the circuit from being connecting polarity backwards on the 12v in.
Then a 100uF 25v electrolytic to ground.
Then to a 7805 5v regulator.
Then the 5 volt out leg goes to another 100uF 25v electrolytic to ground.
And that is all. I have been using this configuration on much less complex 16f873a products for about 6 years in the ag field with out to much problem but those products were switched on power wise when needed my current product is powered on the entire time the equipment is running and then the motors are turned on by digital signal interpreted by the MCU. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Thu Jun 09, 2011 2:31 pm |
|
|
You could add hardware to keep the motors turned off for say 1 -2 seconds.Maybe some simple R-C circuit on the mosfets.
Some value cap across the motors should help( .1mfd ?)
Also be sure to put a 1N4007 from out to in across the 7805 for additional protection.
I'd also beef up the input cap to 1,000MFD, add a couple of .1mfd caps as well as a MOV. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
|
|
Posted: Thu Jun 09, 2011 2:47 pm |
|
|
Lots of comments:
Where are the smaller capacitors?....
Key thing to understand. Larger is not always better. Electrolytic capacitors (most larger capacitors), have massively degrading responses at higher frequencies. They are great for handling low frequencies, but do almost nothing against switching edges, or high frequency spikes. If you look at recommended designs for regulators, you will find, that most larger capacitors are shown _in parallel_ with something like a 0.1uF ceramic capacitor. This is dome to catch the high frequencies that the larger capacitor can't handle. Also, on larger circuits, they will have many such capacitors spread across the board, to handle the spikes from the IC's themselves. Look at a typical PC motherboard, and you will find perhaps 100!...
You should have a 0.1uF close to the regulator, and another very close to the PIC, at the least.
If you have a large capacitor like 100uF on the output of the 7805, you should also have a diode across the 7805 (reverse biased in normal use). This prevents the regulator from being destroyed, if the input rail drops below the output rail. You'll actually probably get better regulation, by having a smaller capacitor like 1uF on the output of the regulator, and doubling the capacitance on the input side.
Then you talk about using MOSFET's. Have you got separate flyback diodes across these?. MOSFET's have an internal diode structure, but on the standard parts, these are _not_ rated to handle the same current as the FET, and are very slow recovering. There are special FETs that have a built in avalanche rated diode, but this needs to be verified on the data sheet. Then when switch off occurs, and this diode comes into use, what is going to handle this energy?. Has to go somewhere....
Add bias resistors (large - perhaps 100K), to ensure the FETs are switched off, when the PIC is off.
If you want high speed switching, you need a better drive than the output of a PIC. Remember a power MOSFET, can have an input capacitance of several thousand pF in some cases. To turn this on/off quickly, needs significant amperage. The PIC output _will_ be overloaded when you switch he FETs, and this will encourage noise on the supply.
Best Wishes |
|
|
techn0
Joined: 09 Jun 2011 Posts: 4
|
|
Posted: Thu Jun 09, 2011 3:17 pm |
|
|
I am using 10k resistors to hold the mosfets low. I am using IRFZ44ZSPBF mosfets to be more precise. I also have diodes installed across the terminals on the motor itself to redirect the energy when the PWM sig goes low. Also my PWM freq is only 2500. I have used this config with 8000 many times. I also have some .22uF ceramic caps accross the mosfet output and ground. We had an issue with our hardware interfering with other electronics and this cap fixed that problem.
As far as the diode accross the regulator. I would just assume use the smaller caps on the 5v side to avoid that like you guys are thinking. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Thu Jun 09, 2011 4:13 pm |
|
|
Depending on the load on the regulator I'd still use a 100MFD on the output as it's the 'reservoir' for what's 'downstream'. Turning a lot of stuff on can cause a dip in the output of the regulator and poof, PIC resets or things 'go funny'. Fine on the bench, NOT fine at 2AM in a freezing plant 20 miles away....
Also check the pcb ground layout, be sure it's 'beefy' to supply the current. On one board the 'fix' was to solder a length of bare 18ga wire since the trace was too narrow (so much for design rule checking algorithms...). It was either that or a total pcb layout change. Wire/labour was cheaper and faster. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|