Sunday 30 October 2011

CIRC-11: Larger Loads

Purpose:
To use one Relay in order to supply power to two separate LEDs.

Equipment:

  • 1x Arduino Uno
  • 1x Breadboard
  • 2x LED
  • 2x 330 Ohm Resistor
  • 1x 10k Ohm Resistor
  • 1x Transistor
  • 1x Relay
  • 1x Diode
Reference:

Program Details:
This program introduces one new piece of hardware, which is the relay. This relay is a mechanical relay, meaning it manually switches from one circuit to another. This switch creates a clicking sound, and helps you know that the relay is working. the relay itself has 5 pins. The lone pin over the pin pair is the one which takes in the voltage. The pair of pins are not connected to one another, as they are on two separate circuits. These two pins output the voltage which is taken in. The reaming two pins  have a coil in the middle of them, and require a current pass through.  The which circuit receives voltage is dependent on how much  current passes through the coil. A large amount results in a switch, while a small amount reverts is back to its normal position. 

As complicated as the circuit is, the programming for this experiment is very simple. It is the same code we had used in experiment one, but with Pin 13 replaced with Pin 2. This is because Pin 13 is not used in this experiment, and Pin 2 is the one which supplies the current to the base of the transistor.

This is a fairly complicated looking circuit, and therefore takes longer to assemble then our previous circuits. First take a 5V output from the 5V pin. Run this through the coil of the relay. Then connect this to the load of a transistor, with the emitter being directly connected to ground. Connect the base of the transistor to Pin 2, and place a 10k ohm resistor to lower the current. Between the coil and the transistor, place a bridging connection to the com; and a diode to prevent flyback. Finally connect the NO and NC ports to LEDs, with the negative ends grounded via a 330 Ohm resistor. 

Results:
It worked as intended the fist time it was put together.

Photo:
Done with Milind Shah


Tips:
For this circuit, it might be helpful to draw the Schematics, so you can get an under standing of what goes where. Also make sure you place a 10K Ohm resistor between Pin 2 and ground, else you might overload your transistor. 

Further Work:
You can set up a series of relay's. This would allow you to control an unlimited amount of LEDs, but each LED would receive a very small voltage.

Program Modifications:
No modifications were made to the program found in the reference:

Program:

int ledPin = 2;                              //This pin actually controls the current 

void setup()
{
    pinMode(ledPin, OUTPUT);    //Sets Pin 2 to output
}

void loop()
{
    digitalWrite(ledPin, HIGH);      //Transistor circuit is complete (LED A is on. LED B is off)
    delay(1000);                            //Halts program for 1 second
    digitalWrite(ledPin, LOW);      //Transitor circuit is incomplete (LED A is off. LED B is on)
    delay(1000);                            //Halts program for 1 second
}

No comments:

Post a Comment