The purpose of this circuit is to explore the role of a relay.
Equipment
- 1 x Transistor
- 1 x Relay
- 1 x Diode
- 1 x 560 Ohm Resistor
- 1 x 2.2K Resistor
- 2 x LEDs
- 14 x Wires
- 1 x Arduino Uno
- 1 x Breadboard & reference sheet
Program Details


The code for the following circuit is as straightforward as blinking. In fact it follows the same format except instead of turning the LED on and off directly. We send the message to the pin connected to the relay. The LEDs are connected to the relay as well, so we're using one pin to control the bulk of the outputs.
Results
The LEDs worked fine, as instructed by the program. It did seem some what underwhelming, however I can imagine that it more LEDs were added it'd be pretty significant. This would be a good next step.
Tips
The only important tip with this circuit is to connect the relay properly. If one of its 3 pins aren't connected properly, it won't function. Also make sure the wire that connects the relay to the Arduino board is connected to pin 2 on the Arduino board.
Next Steps & Associated Modifications
A simple addition would be to connect more LEDs to the circuit (specifically to the relay). This way we can see how useful the relay really is. The program code for this stays the same. However this circuit isn't simply limited to LEDs, try a motor! Or even the piezo element! The code that can be applied to basically all these outputs is explained below.
int ledPin=2; //the relay is connected to pin 2
void setup()
{ pinMode (ledPin, OUTPUT); } //make it so the relay sends output to LED
void loop()
{
digitalWrite (ledPin, HIGH); //turns LED on via relay
delay (1000); //wait a second
digitalWrite (ledPin, LOW); //turns LED off via relay
delay (1000); //wait a second before repeating this blinking effect
}
References:
1. Spark Fun Inventor's Starter Guide
2. http://www.oomlout.com/a/products/ardx/circ-11
No comments:
Post a Comment