Solenoid: A cylindrical coil of wire acting as a magnet when carrying electric current.



A solenoid works by creating a magnetic field which attracts or repels a metal rod. The electromagnetic field allows the rod to retract or extend depending on how much, how frequently, and under what circumstances, you choose to send voltage out.


Solenoids can be used in automatic locking mechanisms, and are sometimes used in dialysis machines. They can also be used in the railway industry; “Anywhere that electrical power is required to achieve a movement becomes an application for a solenoid. Some general examples of use are locking, cutting, clamping, punching, positioning, diverting, holding or rotating.” (


We used solenoids as the braking mechanism for our stroller. We made it so that the metal rod would extend and stop the wheel acting as a brake. The solenoids were wired to a touch sensor. Whenever the touch sensor felt pressure the metal would retract and if it did not sense pressure the metal would extend engaging the brake and stopping the stroller.



Sparkfun, $14.95

We learned about this specific solenoid by watching a tutorial where they recommended this model.


We liked this specific model the most because the metal rod was long enough to be used as a brake for our stroller. In most other models it could not extend far enough to stop the wheel.



  1. Connect wire from the positive rail of side 1 (a-e) of the breadboard to the positive rail on side 2 (f-j) of the breadboard
  2. Connect wire from the negative rail of side 1 of the breadboard to the negative rail on side 2 of the breadboard
  3. Connect wire from j20 to the arduino pin 12
  4. Connect wire from c16 to the negative rail of side 1
  5. Connect wire from c15 to the solenoid


Safety and precautions

We recommend keeping magnetic objects away from your solenoid because it could mess with the magnet inside the device. Also, you should keep an eye on the batteries, transistors, and sometimes ports in the breadboard as they often overheat.


The solenoid is very basic and has only two wires attached to it. One should be connected to the middle prong of the transistor (a semiconductor device used to amplify and switch electronic signals and electrical power which was necessary for our circuit and code), and the other to positive. If you use a diode ( an electrical device allowing current to move through it in one direction with far greater ease than in the other) with the solenoid, the white end of the diode needs to be put into positive. However, using a diode is not required it just helps make the values more consistent.                                   


Resource Files       

/*To use two solenoids with the a touch sensor.

int fsrPin = 0;      // FSR and 10K pulldown connected to a0 (this is a touch sensor)

int sol = 13; // one of the solenoids plugged into pin 13

int los = 12; // the other solenoid plugged into pin 12

int fsrReading;          // analog reading from the FSR resistor divider (touch sensor)


void setup(void) {   // setup process for the solenoids


  pinMode(sol, OUTPUT); // set solenoid 1 as an output

  pinMode(los, OUTPUT);// set solenoid 2 as an output



void loop(void) {

  fsrReading = analogRead(fsrPin);  // setup analog reading

  Serial.print(“Analog reading = “);   // print “analog reading” before displaying the values

  Serial.print(fsrReading);     // display the actual fsrReading on the serial monitor screen


if (fsrReading < 920) {  // if statement saying that if reading is less than a certain value

    Serial.println(” – No pressure”);    // then display “no pressure” on the serial monitor

    digitalWrite (sol, HIGH);// then send out 5V to sol

    digitalWrite (los, HIGH);// and send 5V to los (both solenoids now extended)


  }  else if (fsrReading > 920) {  //if the reading is greater than a certain value

    Serial.println(” – Pressure “);  //  then display “pressure” on the serial monitor

    digitalWrite (sol, LOW); // Then voltage is not sent to solenoids

    digitalWrite (los, LOW);// voltage not sent to los (solenoids retracted)



  delay(100);                           //wait 1/10 of a second



Our code was based off of a code we found online which you can find at: (

This is the schematic we based our circuit on:


Additional resources:

We recommend using these websites, videos, and tutorials as resources in your endeavors involving solenoids:

       If you want to use multiple solenoids, check out this links

To read more, visit



Sometimes, the solenoids would appear to be faulty and the metal rod would shoot out and retract back in immediately. We solved this problem when we changed the voltage input. Sometimes it would be too much and other times it would be too little. We recommend favoring less voltage so that you do not burn out the batteries or the solenoid itself. 


Make sure you use the proper amount of voltage. [1]

[1]how does one determine that?


Artio Team                6/6/15

Dr. Aviv                ETOOLBOX


Pneumatic 12v Solenoid Valve


The Pneumatic 12v Solenoid Valve is common way to operate directional valves. The valve is recommended for use in systems that need constant flow control without pressure. The valve controls the flow by opening and closing. Applying 12 volts to the power inputs can electronically control when it opens. There are two metal leads that except the current and open the valve. The vertical pipe connector is the acceptor and the pipe connector horizontal to the leads pushes the water out only when the valve is open.

In our project, we needed to transfer water from a tank to a plant at a controlled rate. When the plant was dry, the valve would open, letting water flow into the plant. We used a moister sensor to sense the amount of moister, and used a transistor to turn the valve on and off by opening and closing a circuit. This valve is often used in small at home projects because it is small, and does not require pressure to move the water through.


Many websites sell the 12v Pneumatic valves, but there are other valves sold that require pressure such as connected to a hose, so be sure to purchase the valve shown above. This specific valve does not need pressure. It can be purchased at many websites such as Adafruit, eBay, or Amazon. It normally costs nine to ten dollars, but can be more expensive at other sites. Dr. Aviv first introduced us to the valve, and we then looked it up later. You can find the valves in the grey equipment cabinet in the Inc. They are in a draw labeled solenoid. There are multiple types in there so be sure to buy the valve shown above.


There are two metal leads protruding from the valve. That is where you connect the power source. There are two openings in the valve. They are to be connected to tubing to allow water to flow through it. The opening on the top (the vertical one to the metal leads) allows water to flow in using gravity. The other opening it horizontal with the metal leads at the back of the valve, which lets water out when, the valve is open. To power the valve, you will need a twelve-volt power source. We connected two six-volt power sources together to have the correct amount of voltage. Connect the negative wire of one battery pack to the positive wire of the other battery pack to connect the two packs for the twelve volts. When both the battery packs are on, the valve should open due the current it is receiving. We used alligator clips to connect the valve to the power source. Attach one alligator clip to the negative wire of the battery pack, and the other end to a metal rod sticking out of the valve. Do the same with the positive wire from the other battery pack. To check if it is working, listen for a clicking sound. The sound is the opening and closing of the valve. You[a] can also feel the clicking if necessary. If you are touching the valve be very careful. Be careful not to turn the circuit on before it is completed because it could short and stop working. Once the circuit is working do not touch the alligator clips or anywhere current is flowing, because it will shock you.



The metal leads

Screen Shot 2015-12-07 at 12.42.34 AM


Manually opening and closing the valve by applying and removing power does not require any code. If you want to control it electronically, you will need to use other parts such as transistors [b]and you will need to use an Arduino board. No special code is needed, for example you can simply use the blink code to turn on and of the transistor, opening and closing the valve.

Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second


To prevent leaking, find tubing that fits perfectly over the water inputs and outputs. If the correct size tubing is not found, the valve will leak, getting the electronics wet, and could then cause the circuit to short out. If no correct size tubing is found, zip ties can minimize the leaking. Covering the valve in plastic and tape can keep most water from touching it, and flexible tubing is easiest to use.

[a]Won’t it only click once?

[b]Which transistors? At least bring us to a place where we can learn about how to use these transistors