# 7805 powered Atmega328 Stops working when input of 7805 exceeds 7volts

I am developing a circuit with atmega328, the MCU is powered by a LM7805. The input of 7805 is given by a variable supply. Till the input of 7805 is 7volts, the output voltage is 4.9volts and current is around .75amps. Now if the input voltage of 7805 is increased, the current also increases and the MCU stops working(sometimes work with being reset after a few seconds), please help me out guys... i need to connect those circuits to my car battery, so it must work with 12volts.

I added capacitors and diodes as per Majenko mentioned. Now the situation is a) The circuit is working at 12V, b) With single C817 , output voltage of mcu is 3.5V, c)I used 56 ohms resistance, which is giving 1.2V to the input of C817, d) The Collector to Emitter resistance of C817 is 1520 ohms when turned on, this is creating a voltage drop of 3volts. e) This output is turning the led on, but being unable to switch the relay.

Circuit Upate

This the modified circuit, which solves the problem. But i have some questions, in the modified circuit if BC547 is used then its not working because the collector voltage which should be around 0.2 remains 1.8 volts, but replacing the BC547 with BC337 solves the problem(Collector voltage becomes around 0.3).

• Have you added capacitors ? Reset problems may be attributed to inadequate current supply. Refer : circuitdiagram.org/images/12-to-5v-converter-circuit.gif Mar 21, 2017 at 7:21
• Maybe thermal protection? Voltage drop on the regulator is 2 volts if you have 7V input and that means `2V * 0.75A = 1.5W` turned into the heat. That means heatsink might be needed to work properly.
– KIIV
Mar 21, 2017 at 7:57
• i have uploaded the circuit diagram, please take a look, and i will try all the hints mentioned above.. Mar 21, 2017 at 8:32
• Do you have a phobia of capacitors? I can see at least 8 that are conspicuous by their absence - maybe more. You seem to have an aversion to diodes as well. Mar 21, 2017 at 10:11
• yeah, its embarrassing , i didnt think that capacitors will be that much important. Anyways i am gonna try it again after attaching the capacitors and diodes. Mar 21, 2017 at 11:19

It looks like the reason for the MCU drawing high current is operating the LEDs in half a dozen optical isolators without current-limiting resistors. The part number of your isolators apparently is PC817, for which the suggested LED current is 5 to 20 mA at about 1.2 to 1.4 forward volts. But if you don't limit the current, they are likely to draw 50 to 100 mA each when turned on. Add a series resistor, say 220 to 330 Ω, in series with each isolator.

At this point, it's possible you may have damaged your ATmega328 by overheating it, due to drawing too much current from its outputs. You probably should run some tests with simple sketches to see if they all work ok.

Note, it probably would make sense to use a buck regulator rather than a linear regulator in the 12 V environment. MP1584-based buck regulator boards (“Mini DC 4.5~28V to DC 3.3V MP1584 3A Step-down Converter Regulator Module”), about 2x2 cm, are about a dollar on ebay and handle 2 amps typically.

• thaks for your reply, i tried using 220E resistors, but its not working, 56E seems to work fine in the sketches. Also i connected 100E at the sketch, output LED, is glowing , but dimmed, what should i do? Mar 21, 2017 at 10:03
• @SHILADITYADEY, do you have an oscilloscope? If so, check if regulator oscillation (as mentioned by Majenko) is an issue. And/or, use a DVM to check output voltages on several IO pins, on load and off. Also detach an isolator from its IO line, and drive the isolator with different voltages to test if the isolators+relays work by themselves. Also detach 4 isolators+relays from the circuit and see if you have enough current to drive the remaining 2 (to check if problem is just too much load, or some wiring error, or a design problem). Mar 21, 2017 at 15:13
• Also, a 'glowing , but dimmed' LED either is at low current or is turning on/off rapidly. Easy to check with a scope, not so easy with a DVM; possibly detectable by sweeping it across your field of vision. Low current may be a result of high resistance (eg damaged IO lines) or low voltage. Low voltage can be caused by shorts or low-resistance loads, or by power-supply oscillation. Mar 21, 2017 at 15:24
• gonna do it today and let you know Mar 22, 2017 at 12:44
• found out it was problem with the excessive current 817Cs are taking from controller. New modified circuit solved it. Thanku for the help. Mar 23, 2017 at 5:52

There are a number of basic but vitally important components missing from your schematic. Namely input and output capacitors on the voltage regulators, which would result in oscillation and thus overheating (which would then shut them down through thermal overload), decoupling capacitors on the main chip, reverse biased diodes across the relay coils (maybe as well a small capacitor would be beneficial in parallel), and resistors to limit the current through your opto isolators.

Here is a version of your schematic with the missing components added in red. I have omitted the values - your job is to read the datasheets and work out the correct values to use.

• Thanks @Majenko for your help, I am gonna try it and give you feedback.. thanks again. Mar 21, 2017 at 11:20
• I added capacitors and diodes as per Majenko mentioned. Now the situation is a) The circuit is working at 12V, b) With single C817 , output voltage of mcu is 3.5V, c)I used 56 ohms resistance, which is giving 1.2V to the input of C817, d) The Collector to Emitter resistance of C817 is 1520 ohms when turned on, this is creating a voltage drop of 3volts. e) This output is turning the led on, but being unable to switch the relay. Mar 22, 2017 at 5:48