Standalone ATmega current draw

Oh, hi everyone. Hopefully a simple question here. My standalone ATmega 328p is drawing significantly more current than I anticipated. When the same chip is mounted on an arduino uno it pulls roughly 40mA. However, my "bare minimum" standalone set up draws 800mA.

Below is a diagram of the setup I'm using. Click here for the full project that I got the diagram from, although I'm not planning on completing the linked project. I'm just borrowing its standalone diagram.

Any guidance would be adored. Thankee.

I'd probably swap that 220ohm pull-up resistor for a 10k one.

How/where are you measuring the current?

There is something very very wrong if that is actually drawing 800mA. Something should be getting real hot. I am with @red_car, how are you measuring that?

Missing from your circuit are the two 0.1uF bypass caps, one from Vcc to ground and another from AVcc to ground. They are required and the 10uF bulk capacitance in no way makes up for them.

1 Like

And the crystal is wired incorrectly. :roll_eyes:

I was definitely worried something was getting fried. Nothing seems to be getting hot, though. I'll make the recommended changes and look up correct crystal wiring.

I have the rest of the circuit in series with my meter. Like this:

If nothing is getting hot, then I suspect you are not getting a true reading.

What input voltage are you using?

If you simply apply the input across a 1k resistor - what current do you get? At 12V you should be getting ~12mA (I=V/R)

I'm just using a 9V battery, which shows 8.8mA on a 1k resistor. So, a functioning meter plus nothing getting hot... does that mean there has to be a short somewhere? I've stared at this thing to no end and cannot seem to find one.

That 5V regulator ground pin couldn't be the culprit, could it?

Are you sure all the wires to the 328 chip are correct? Is the chip the right way around?

At 800mA you must have a short somewhere.

Try removing the wires and adding them back one by one?

If you have the wiring as indicated in the picture the crystal looks fine to me. Maybe @Paul_B can tell us what is wrong, I am sure missing it.

I am currently using a setup with exactly the same basic wiring, not the same layout of course, and it is working fine. I do power from the USB and not via a 12V supply and regulator.

I have my Atmega32U4 ISP programmer, Atmega328P, ATTiny1614, MCP23017, PCA9685 servo board and a 20x4 LCD display with I2C backpack all hanging on the USB port. My cheapy inline USB amp/volt meter says I am barely touching 80mA.

How about showing us a picture of YOUR layout, maybe we can find something.

Something like that. Did you program the chip for e.g. blinking a LED? If it does not do that then something is wrong with your circuit.

Didn't you read 800 µA instead of mA?

A scope is a requirement for developing and debugging own PCB.

Was the power supply the 9V battery when you measured 800mA? Is the 9V battery one of those smoke alarm batteries? Like this?

If so, then the 800mA is really suspect. Few, if any, 9V smoke alarm batteries can supply 800mA.

Really appreciate all the time and brainpower thus far, everyone.

I tried @red_car's suggested and pulled some wires. Findings are:
-Removing positive rail -> VCC reduces draw to 530mA
-Removing capacitor -> AVCC reduces draw to 580mA
-Removing chip -> GND reduces draw to 10mA

Does this mean the circuit is somehow shorting through GND? I see with this diagram the chip is wired to GND twice. I have quadruple checked based on this diagram and others that I'm using the right pin.

That 10mA seems so right... I'll hook up an LED and load "example: blink" to see if it's functioning.

It would help us to help you if you would answer questions.

That is correct. There is a ground by Vcc and a ground by Aref. Both should be connected.

Was the chip ever plugged in backwards and powered? Many times we have spotted problems that the OP has missed.

Please post photos of your wiring.

@groundFungus , here are the photos of my wiring. Perhaps not super helpful with all the jumper cables, so I took multiple angles:




Also, the 9V battery is just a standard Duracell, although thanks for the knowledge of the smoke alarm batteries. Didn't know there was a different type.

Now, the blink test:
-I put the chip back into my Uno for programming. The onboard LED seems not to be functioning (news to me) so I switched the sketch to pin 4 and wired in an external LED. Works fine in the Uno.
-Back on the breadboard: With that GND pin plugged in, nothing happens, still drawing ~800mA.
-With the GND unplugged, the LED stays on solid.

I fear now that I've foolishly burned out pin 4, since I can't replicate the solid LED result. I checked the LED on its own circuit afterward, it's still functioning, not burned out.

Your photos don't show the 0.1uF (100nF) decoupling capacitors that were suggested by @groundFungus back in post #3. The regulator (7805?) usually has capacitors between Vin & Gnd and Vout & Gnd as well.

Edit: Do you have another Arduino board to hand - maybe an Uno, that you could take 5v from to temporarily power your breadboard project and get the simple blink sketch working. Remove the regulator from your breadboard first.

Agh I forgot to make that post #3 change. I will do that and your other changes later today. For real, this time.

EDIT: Powering from another board is an excellent idea. I have another UNO and will try that as well as soon as I can fight my way back to my desk.

I wouldn't attach an 800 ma load to another Arduino. If that current is real(which I doubt, as you'll not get that from a 9V duracell for long, so maybe your meter's decimal isn't working???), you could just make another piece of junk out of the new Arduino.
Instead, start by doing ONLY one thing - removing the IC. At that point, you should be able to measure just the quiescent current of the 7805 itself.
Let us know how that goes.
C

The photos help. You are indeed shorting out the power supply !

In the image below, you can see that +5v should go to pin 7, GND goes to pin 8.

In your set up you are out by 1 pin. You have +5v going to pin 6, GND to pin 7 !!!

The crystal is also on the wrong pins.

... probably should have checked one more time !

2 Likes

Good eye!