NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Higher power supplies with ATMega168 (running higher voltage devices with lower powered ground)

December 29, 2012
by wadaltmon
wadaltmon's Avatar

Is it possible to use power sources on the ATMega168 that are higher than the rated 5.5V? Is it possible to use an unregulated 9V battery? How about the 21/23 12V battery, unregulated?

I am simply trying to use a solenoid valve, rated for 12V (but runs fine off of a 9V battery, unregulated) with the microcontroller. I have the positive side of the solenoid hooked up to VCC, while the negative side is hooked up to an output of the microcontroller. What I figured is that when the output of the microcontroller is high, the solenoid will not be energized. When the output is low on the microcontroller, I thought that the VCC would run through it and allow a "ground" return at the negative output of the microcontroller. It worked fine with an LED operated in this way. I think the reason that it is not working with this solenoid is because it is not operating off of the "same power source". The solenoid positive is hooked up to +9V, while the microcontroller is running on the +5V, with the negative side of the solenoid hooked into the microcontroller.

What I am resolving to do is simply run the MCU off of the full 9V, to allow for the solenoid to ground itself in the low output of the microcontroller. They need to run off the same power source for this, which is why I am asking about the different power sources and voltages. Or is this even the issue? Is there something about this issue that I am overlooking?

Thanks, Dalton

December 29, 2012
by Ralphxyz
Ralphxyz's Avatar

Is it possible to use power sources on the ATMega168 that are higher than the rated 5.5V?


oops sorry this isn't that type of forum.

Why do you think the mcu is *"RATED" 5.5v?

Oh by the way you just need a common ground to use two different voltages.


December 29, 2012
by Rick_S
Rick_S's Avatar

You should not do what you are doing, you can damage your micro. The solenoid most likely draws way more current than the micro is rated for anyway. The proper method would be to use the micro to switch a higher current device such as a mosfet (the 2n7000 came with your nerdkit). Look at the motor control tutorial in the tutorials page to see how to use a mosfet as a switch. The mosfet can be "turned on" by the micro and it in turn can "turn on" the higher voltage (9V or 12V) at the higher current.


December 30, 2012
by BobaMosfet
BobaMosfet's Avatar


Let's assume you're using a 12V battery.

You can do what you want to do-- but you're not thinking it through. First, you must use the LM7805 regulator (5V), or a Zener (1N5231; 5.1V) to drop the source voltage for the mcu. However, for the solenoid, you need to power it from above the regulator (or zener) so it has full 12V and full current available to it. Then use a transistor rated to handle the current level the solenoid requires (see the solenoid datasheet), and put that in a common-emitter configuration. Use the mcu to control the transistor, which controls the solenoid. solenoid ground comes back to ground rail of power-supply above the regulator.

Voila, everything tied to ground properly, no ground loops created. Just make sure that your power-supply provides more than enough current to satisfy the solenoid's needs, without dropping the circuit- otherwise the MCU will get reset every time you trigger the solenoid, and it won't appear to work.


Post a Reply

Please log in to post a reply.

Did you know that you can control 120 LEDs with just 17 microcontroller pins? Learn more...