Hardware Reference
In-Depth Information
The Circuit
Once you've got a grasp on the plan and the system,
you're ready to build it. The circuit is shown in Figure 10-7.
Because the SD card is on the Ethernet module (Ethernet
shield or Arduino Ethernet), you only need to add the tem-
perature sensor and the relay.
Spark Fun's AC relay board is a safe and less expensive
option if you want to build your own circuit. Solder the
relay to the relay board. Then take an AC cord, cut one of
the two wires, and attach it to the relay board's LOAD con-
nections. Figure 10-5 shows a close-up of a household AC
cord attached to the relay. The relay's ground, control, and
5V connections connect to your microcontroller. To build
a more robust version—such as the one shown in Figure
10-6—with a household electrical outlet junction box, see
Nathan Seidle's excellent tutorial at www.sparkfun.com/
tutorials/119 .
The relay contains a coil wrapped around a thin switch.
When the coil gets voltage, it forms a magnetic field
through induction, pulling the two sides of the switch
together. To use it, take an alternating current circuit
(AC) and break one of the wires, as shown in Figures 10-5
through 10-7.
To test the circuit safely before you plug it in , set your mul-
timeter to measure continuity, and to measure between
one of the plug's pins and the corresponding socket hole
on the other end of the cord. One pin/hole pair should
have continuity all the time. The other should not, unless
you power the 5V and ground contacts of the relay and
connect the control line to 5V. Then you'll get continuity.
When you connect the control line to ground, you won't
get continuity. When you're sure the circuit's working, test
it by attaching the control line to a pin of your microcon-
troller and use the Blink sketch to turn the relay on and off.
Working with AC can be dangerous, so make sure every-
thing is connected properly before plugging it in. If you're
uncomfortable building an AC circuit, the Power Switch
Tail will allow you to control 120V AC. A 240V version was
recently announced at www.powerswitchtail.com . It's
available from Adafruit, Spark Fun, and the Maker SHED.
Figure 10-8
The CatCam 2 and air conditioner schematic.
AREF
GND
D13
D12
D11/PWM
D10/PWM
D9/PWM
D8
Reset
+3.3V
To Ethernet shield Clock
To Ethernet shield MOSI
+5V
Gnd
Gnd
Vin
To Ethernet shield MISO
To Ethernet shield Eth. SS
Arduino
Module
D7
D6/PWM
D5/PWM
D4
D3/PWM
D2
Digital1/TX
Digital0/RX
0.1µF
Vin
Out
TMP36
Temperature
sensor
Analog0
A1
A2
A3
A4
A5
Gnd
To Ethernet shield SD card. SS
Relay
AC power
AC cord outlet
for air conditioner
Search WWH ::




Custom Search