Powering ATMEGA328 with power circuit that powers charger

I have built a charger that is logically controlled by the arduino. Now i currently supply 5v power to the chip from a battery and the charging circuit is powered by a 32v power supply. Can i get rid of the batteries and power the ATMEGA328 directly from the same power supply that feeds the charging circuit?

i will connect it in parralel and with a 5v regulator?

5V regulator can't handle 32V input, that will smoke it.
Add a little switching regulator

Option 1: connect the arduino to your computer with a USB cable to borrow 5V from it
Option 2: modify arduino and build a step down (from 32V to 12V) circuit.

  • You can use LM7812 to step down from 32V to 12V (need a big heat sink). So, input of the regulator (the step down) will be 32V, and output will be 12V
  • Lift up positive side of M7, and connect it to 12V (you just created above)
  • Connect central pin of DC jack to the input of regulator

Now, plug your 32V adapter (source) to the DC jack, your arduino will be powered!

CrossRoads:
5V regulator can't handle 32V input, that will smoke it.
Add a little switching regulator
http://www.pololu.com/

Thank you, a few questions though. I currently have a switching voltage regulator but the input voltage is from 6v to 28v though so will 32v fry it?

Another thing I am concerned about. Can the atmega328 share a common v+ with the charging circuit?

The atmega328 chip controls transistors inside the charging circuit so I am afraid that if a use the same 32v regulated down to 5v to power the atmega328 I will create a short? Because now 5+ and 32+ are common? As well as the grounds?

Oh yes and one more thing, is it possible to use a voltage divider to drop voltage that can then be fed into lm7805?

You need a switching regulator, aka DC/DC converter, that can handle the input voltage, such as
http://www.digikey.com/product-search/en?pv573=25&FV=fff40042%2Cfff800df&k=murata+oki&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25

Voltage divider is not a solution where current flow for power is involved, that only works well where the current is small, i.e. for signals.

Ok i will just need to power the atmega separately for now.

I have a question thats off topic now but someone suggested i use a relay to switch the charger off. i only have a 12v relay. How can i go about switching this relay with 14.1v? i was thinking that i drive the coil with a transistor but then i dont know where i must get the power for the coil? i have placed the coil such in the circuit that it connects the ground to the power supply ground. so i need to supply a voltage from the charging circuit to the coil but i dont know from where

Put the coil's contacts before the 12v to the battery.
Power the coil from 14V, add a series resistor to limit current flow per the relay spec, and use NPN transistor with gate driven by the Arduino.

CrossRoads:
Put the coil’s contacts before the 12v to the battery.
Power the coil from 14V, add a series resistor to limit current flow per the relay spec, and use NPN transistor with gate driven by the Arduino.

Im confused now, before the 12v to the batter? or do you mean the 14v to the battery? ive moved it i dano if this is where you mean

That’s where I mean.
Now add in the coil control circuit like you have below the LM317.

CrossRoads:
That's where I mean.
Now add in the coil control circuit like you have below the LM317.

But if I add it there and put a low side npn transistor the ground from atmega connected to the emitter is going to short across the battery

Huh? Does the emitter from the other transistor short out the battery?

CrossRoads:
Huh? Does the emitter from the other transistor short out the battery?

No what I'm saying is that if I add a transistor like you drew now, then that transistor when switched on will short the battery. If all transistor emitters are connected to ground and I have one transistor on the negative side of the battery and one transistor on the positive side of the battery then that will effectively bridge the battery won't it?

I am obviously confused like usual. If you say it will work I take your word for it cause you know your stuff

The transistor I drew allows current to flow thru the coil. It no more shorts out the battery than the power-on LED in your drawing does. The resistor in series with the coikl resistance determines how much current will flow when the transistor turns on.

Ok that makes sense. Thank you for explaining it so clearly. Much appreciated

Would I be able to power my ATMEGA with an LM317 connected to the 32v power supply in parallel?

Sure. 32V down to 5V is a lot of power to dissipate as heat, if you drawing a lot of current then you'll need some good heatsinking.
How much current is the 32V supply rated for?

1.6A but I'm drawing at most 250mA for the charger and I don't know what mA the Atmega would draw but I'm sure it won't be more than 50mA

Ok this does not work, when i connect an LM317 in parallel with the 32v power supply to power the atmega with 5v then the atmega does not come on properly. Why is this? is it because its using the same power supply for the charging circuit?

atmega cant use same power supply.dib (64.4 KB)