Garage door openers use relays to operate. You might be
able to hear the clicking if you listen closely.
Circuit 2
Arduino Code:
13
Troubleshooting:
LEDs Not Lighting
Double-check that you've plugged them in correctly. The
longer lead (and non-flat edge of the plastic flange) is the
positive lead.
No Clicking Sound
The transistor or coil portion of the circuit isn't quite
working. Check the transistor is plugged in the right way.
Not Quite Working
The included relays are designed to be soldered rather than
used in a breadboard. As such you may need to press it in
to ensure it works (and it may pop out occasionally).
When you’re building the circuit be careful not to mix up
the temperature sensor and the transistor, they’re almost
identical.
You should be able to hear the
relay contacts click, and see the
two LEDs alternate illuminating
at 1-second intervals. If you
don't, double-check that you
have assembled the circuit
correctly, and uploaded the
correct sketch to the board. Also,
see the troubleshooting tips below.
Code to Note:
Real World Application:
Open Arduino IDE
//
File > Examples > SIK Guide >
Circuit # 13
What You Should See:
When we turn on the transistor, which in turn energizes the
relay's coil, the relay's switch contacts are closed. This connects the
relay's COM pin to the NO (Normally Open) pin. Whatever
you've connected using these pins will turn on. (Here we're using
LEDs, but this could be almost anything.)
digitalWrite(relayPin, HIGH);
The relay has an additional contact called NC (Normally Closed).
The NC pin is connected to the COM pin when the relay is OFF.
You can use either pin depending on whether something should
be normally on or normally off. You can also use both pins to
alternate power to two devices, much like railroad crossing
warning lights.
digitalWrite(relayPin, LOW);
IOREF
RES
ET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGIT
AL (PWM~)
ON
ISP
TX
RX
IOREF
RES
ET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGIT
AL (PWM~)
ON
ISP
TX
RX
IOREF
RES
ET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGIT
AL (PWM~)
ON
ISP
TX
RX
LEARN. SHARE. HACK.
Page 72
Содержание RedBoard
Страница 13: ...Page 11...