Go Down

Topic: Controlling a simple Solenoid (Read 3976 times) previous topic - next topic


Oct 19, 2006, 01:46 pm Last Edit: Oct 19, 2006, 01:47 pm by tallberto Reason: 1

I am trying to do a little project where I control a series of 6 solenoids with my arduino board, but somehow I cannot do it.

The solenoid is push-pull and operates at 3-6volt, interminittent duty cycle. Shouldnt I just connect one of the solenoids pins at GND and the other at a Digital Output and start setting the pins or do I need to drive more power into the Solenoids (eventhough they are very little and I dont require a lot of power..).

For the software I use a modified version of the Serial_write_basic, but targetted at pin 12 where I connected one end of the solenoid, the other one to GND..

THe problem is that no movement or current seems to be drawn to the solenoid...



you should not power the solenoids directly from arduino. With 30mA max on an arduino pin an actuator should not consume more than 0,15 W. and i don't think that this is much for a magnet.

unless you are sure that the current stays below 30mA use a transistor or similar method to drive the solenoids. this should be the same as connecting a motor. notice that there might be high current peaks even if your solenoids are advertised as <0,15W.

best, kuk



you could try using one solenoid on pin 13 i guess, whose current is limited to 20mA by a resistor.

first use an led instead to see if your code works. then attach the solenoid. if it works, your solenoid is indeed small enough to be powered by arduino. but don't go without the resistor!


Unfortunately, you can't drive any kind of physical output device form the Arduino pins (motors, solenoids etc) , as it takes too much current. The Arudino lives in a very low-current world, and to make big things happen, you need to amplify its signals with "driver" devices or what is generically called "power electronics".

What you need for the solenoid is a basic transistor amplifier (one for each pin used to drive a solenoid). The Arduino sends a milliamp into the transistor, and presto: the transistor switches 500ma or 1500 ma in proportion with the input. See this link for very basic instructions on how to do it:


Note that you ahouls also have ~ 1K  resistor between the Arduino and the Base of the transistor, unless you use pin 13, which already has the resistor built in.  Also missing is a 1N4001 diode across the solenoid, to clamp the noise...  


So how do servos work with such little power then? Not doubting what anyone says, I just mean that they are pretty impressive in driving a reasonably large torque with such a small input


Oct 20, 2006, 12:01 am Last Edit: Oct 20, 2006, 12:03 am by leKuk Reason: 1
it's the same for servos. they shouldn't draw their power from an arduino digital pin. Though they can be _controlled_ by one

servos mostly have three inputs (ground, power, control).
just connect the servo-control-input to arduino pin 13 or alike and the power-input to 5V. ground goes to ground.


yes, like Kuk says above, the RC servos take their power from the main supply, and a very low current control signal from the Arduino. They have transistor amplifiers built in...


Aha, got it... I guess I knew that servos got their 5V from another source becasue I've been hooking them up that way, with the 5V line providing power. It just didn't click that the 30mA 'limit' applies to the AtMega8 pins rather than the arduino board as a whole, which is how I was looking at it I guess.


the datasheet for the Atmega8 says you could actually get 40ma from a single pin, but in practice, you should probably design for 10ma or under... remember, the internals of the chip are doing operations at the microamplere level, so the less loading of the chip's power supply ciruitry, the less chance you have of interrupting those calculations. The basic rule of thumb is to give the processor as clean apower supply as possible, and to ask its pins to drive very small loads.  

Go Up