atmega328 glitching on and off

hi there i have made a control board for a heating system that i work with on a regular basis was in the process of fine tuning my code to work correctly so all hardware seemed to be working ok but just recently it seems like the processor is switching on and off continously. hardware: 8va transformer 24v output KBP005M rectifier 16uf capacitor changed for 33 and then 1000 still no different L7805 Voltage Regulator was changed no different 16uf capacitor changed for 33 and then 1000 still no different atmega328 works fine in the arduino board and has been replaced aswell the 2 capacitors and crystal have been changed still no difference

when i changed the two capacitors either side of the voltage regulator to 1000uf when you turn the board off it suddenly seems to work for a split second just before the capacitors discharge

any ideas?

just had another play and just ran two temporary leads picking up the pos and neg from te board and linking them to the 5v out on the arduino programming board it appears to work fine then bit hard to exactly say as some of the componenets will not work as they need higher voltages so i presume my bridge rectfier needs replacing or the voltage regulators im using are a load of crap?? but seem to test out ok on the multimeter

The meter won't show everything. An oscilloscope might.

Try some decoupling capacitors.

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

some of the componenets will not work as they need higher voltages

If the 328 works with a separate 5V on it, but not when running off the 7805, then it sounds like some of the other components in the circuit may be crowbarring the 7805.

Just a thought about voltages in your circuit. Your transformer will give a peak voltage of 1.414 x 24 volts ( 33.936 ) at the rated output. If you are drawing less current, which seems likely, the peak voltage will be higher. The spec for a 7805 is maximum input 35 volts, your rectifier will drop a few volts but it might still output more than 35 volts so it might keep shutting down.

The meter won't show everything. An oscilloscope might.

Try some decoupling capacitors.

http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

thanks for that information just tryed that and still seems to make no apparent difference

If the 328 works with a separate 5V on it, but not when running off the 7805, then it sounds like some of the other components in the circuit may be crowbarring the 7805.

disconnected them from circuit no difference unfortunatly

Just a thought about voltages in your circuit. Your transformer will give a peak voltage of 1.414 x 24 volts ( 33.936 ) at the rated output. If you are drawing less current, which seems likely, the peak voltage will be higher. The spec for a 7805 is maximum input 35 volts, your rectifier will drop a few volts but it might still output more than 35 volts so it might keep shutting down.

oh yes with no load i have 40v off the bridge rectifier so yeah your probably correct that the voltge regulator is shutting down due to over voltage does anybody have any recommendations for a regulator what will handle the higher input voltages?

Use a switching supply, or lower the voltage, or add your own winding for a low voltae tap

or add your own winding for a low voltae tap

what so add an external winding? any information on this?

Well it would depend on the type of transformer you have and if you can take it apart to add a winding, its not too hard if there's space and if the transformer comes apart, toriodal transformers are the easiest, other really depend on how well its assembled, sometimes the EI transformers are just two pieces of core together, other times its a whole lot of individual laminated layers, which is. Real pain and I wouldn't try, did one and cut myself, not so fun but if there's room wrap enamel wire around the other wires basically until you getthe voltage you need, which I would suggest testing that while its under a similiar sized load

o ok i understand what you meen now unfortunatly the transformer is molded into a plastic case so can not get to the windings i did have a look for voltage regulators with higher input voltages but the only ones i found were variable ones was looking at this LM317AHVT for a quick fix what do you think? but for future boards i think i will have to pick just the one 12v output from the transformer and run two rectifiers one for atmega328 and the other for the other components on the board

Unfortunetly dropping from 40 to 5v means wasting 8times the power and 8x the heat so a 30ma draw at 5v would have the regulator dropping the 35v and using 1W of power(maximum without a heatsink assuming a cool surrounding), where only .15W is actually doing work the rest is heat you need a switching power supply to effectively drop that within practicality so unless your drawing less than 30ma you'd need a largish heatsink, which will get you a little farther but not too much

This is a "No-Brainer", Really simple. However remember that an 8VA transformer has a secondary current capability of .3A and 300 mA can quickly be used if the transformer supplies other things. One other thought is that If the transformer is used for other control it's secondary must not be common to your ground or negative PSU terminal.

Solution #1 use a 150 ohm 10 watt resistor from the HV to ground... Load it down to the equivalent RMS voltage. Solution #2 use a half wave rectifier and 2200uF cap on the output of the diode. 1/2 of 24 V Solution #3 is the transformer Center Tapped? if so use a halfwave bridge or tweo diodes cathodes common and + output... - output is the CT. or connect the bridge rectifier from one side of the secondary and the center tap... 12V Ac... now 1/2 of the transformer secondary is used Solution #4 Connect a 12Volt 1 watt or better Zener diode in Series with the HV PSU cathode pointed to the HV side of the PSU... anode to the regulator. Polarity of the diode is important here the diode will work connected either way however only the way I mentioned will give you more than the nominal .6V diode drop. The Zener is used as a level shifter. Solution #5 Get a 12V transformer... or see Solution #3 and find a 24V transformer with a center tap.

Doc

I believe the half wave idea wouldn't work effectively unless it was a constant predictable load, the halfwave rectifier would simply make it a larger ramp up time of the capacitor, if there's no load it will go up to the full voltage I think a switching regulator is the best option, the rest re kinda wasteful, they actually make drop in switching replacements for the to220 7805 tho they are a few bucks

Winner you are DEAD WRONG the half wave rectifier has been successfully used without the strange effects you describe for nearly a hundred years, it's only drawback is the requirement for a large input filter. I've used it for 50 years my self... Very successffully... When I was a WORKING PROFESSIONAL ENGINEER, You?

Docedison

Im sorry I haven't that experience nor tried it, I just never heard about that and thought that it would only cause alot more ripple because it only charges the capacitor half of the cycle, still it would charge it so long as the capacitor is at a lower voltage than the ac peak voltage, which if there was no load would charge it to the ac peak If it was only ac output then I could see it effectively cutting the rms voltage in half, but then again im not that experienced and there's a million things I don't know yet

It does cause more ripple that's why I pointed out that the input filter had to be bigger and in this case since there is a linear regulator the added ripple makes no difference . Even with a 470uF instead if the 2200 uF min I had mentioned the ripple could Never be big enough to cause the regulator to even be close to it's dropout voltage. You will remember that the original issue was the reg shutting down because of overvoltage... So I listed several different workable strategies to fix that problem.

Doc

As far as I understand a common 7805 has no 'automatic' shutdown due to input voltage being too high. There is automatic shutdown for output over current draw and for maximum heat dissipation, but over voltage of the input would just subject the chip to damage, not any kind of automatic response.

Lefty

thanks all for your help think i will pick it off the centre tap just one more question as im here anybody know a good website to explain the correct way of working out the correct va transformer for your application?

Calculate or Measure the current drawn and double it... Just for luck and multiply that by the voltage realizing that control/signal transformers come in standard values. A 24 V transformer, a 10 ohm resistor and a single diode with a 2200 uF - 4700 uF input filter is the simplest method to deal with 24V transformers... Because of the required high value of the input filter for a single diode (half wave) it is recommended to use a 5 to 10 ohm 'Surge' protection resistor in series with and before the diode to reduce the inrush current to the diode. It is also recommended to use a diode of 3A forward current, typically a 1N5407 and the input filter after the diode. This is for a supply for a 5V regulator and a low current load. This is from memory and I am certain of it's validity, It's just that right now I am too busy to go find the text and quote it here and for that I apologize... However the loaded voltage should be about 11-13V which, while being a little high for heat considerations in the regulator should be OK. The Best method was already mentioned and that was to use a switcher to begin with. The methods I outlined earlier were only "Fixes" for the immediate issue which was the regulator shutting down for an over-voltage condition. There was a comment about "Not Believing???" that a regulator would shut down... YES VERY MUCH SO... Read the Data Sheet before you consider yourself enough an expert to quote opinions here. The Shut down is done for several reasons primarily to control the device Power dissipation. Ex. 1. 50 V in 5 V out @ 1 A = 5W load to the regulator and 45 Watts wasted as heat... 50W total device dissipation Ex. 2. 35 V in 5 V out @ 1 A = 5W load to the regulator and 35 Watts wasted as heat... 40W total device dissipation 50W/40W = 1.25~ X increase in power dissipation for a 15V increase in supply voltage or simply by making the Max voltage 35 V instead of 50 V makes a 25% decrease in required power dissipation. Under any circumstances the final shutdown is due to heat and limiting the input voltage to a 'reasonable level' increases the available current at high voltage inputs because the final control in the regulator is it's internal temperature... Not current as much as heat. Internal to the regulator is a comparator that measures the supply voltage against a reference voltage and if high merely shuts down the drive to the pass transistor to prevent exceeding the total device dissipation.

Doc

thankyou for that information so if i have my boubled load at 1A at 24V i should have a 24VA transformer? sounds a bit high could you do a quick drawing on what you describe to give me and others a better understanding thanks