# Simple Solenoid Using Arduino

1,558

10

4

## Introduction: Simple Solenoid Using Arduino

This by far the simplest way to weakly magnetise any object using your Arduino uno. All it takes is a lot of wiring and coiling, and a program to do the trick. In fact, it takes just two steps to program an Arduino to turn it into a solenoid.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Program the Arduino

Here is one program that you may use to make a solenoid out of an Arduino:

void setup() {

pinMode(10,OUTPUT);

pinMode(11,OUTPUT);

}

void loop() {

digitalWrite(10,HIGH);

digitalWrite(11,LOW);

delay(10);

digitalWrite(10,LOW);

digitalWrite(11,HIGH);

delay(10);

}

by changing value of delays, one can change frequency of alternating current hence you can test whether lower or higher frequencies magnetise the best or not. Upload it onto your Arduino board using the IDE.

## Step 2: Making the Coil

based on the program, you may have to take a very long piece of Insulated, Single core, Copper wire ( commonly called enamelled wire) and wrap it around the metallic object that you wish to magnetise.

Caution: the current in the coil must not exceed max current output limit for the pins (40mA). Since the Digital pins also provide 5V of electricity, the ideal resistance of the coil must be less than 125 ohms so that the current in it will be 40mA. You can use a multi-meter to find resistance of coil and if it is too high, you can shorten length of wire used.

it is best to make as many coils as you can fit around the object. one of the wire may the be connected to digital pin 10 on the Arduino while the other of the coiled wire may be connected to digital pin 11 on the Arduino. And... Violà! your solenoid is good to go. :-)

Note: remove object from coil only after you have disconnected coil from the aduino.

150 10K
86 7.9K
197 12K

## 4 Discussions

Keep in mind that you don't want to exceed the max current output limit for the pins (40mA). So you need make sure that the total resistance of the solenoid is at least 125 ohms.

Thank you for the helpful input. I will make a note of that in the instructable as soon as possible.

Also the wire you show at the bottom is useless for winding coils as it is not enameled. Each winding would short to the wining next to it.

And dont forget the BEMF, the Voltage Spike will (eventually) kill your Arduino too...Insert a Diode in parallel to the coil. Dont tell People, how to mess up things...