Hardware Reference
In-Depth Information
There are two ways to make a sketch wait for a long time, either using the
delay() function, which normally means that no other calculation can take
place, or by reading the number of milliseconds since the sketch started. To
make things simple, this application will use two loops; one for the temperature
sensor and one for the lighting application. Both will be running independently.
Hardware
The Arduino Due will have an LM35 temperature sensor connected to A0. The
LM35 will be powered by 5 volts. Even though the LM35 runs at 5 V, it will
never reach 3.3 V, so it's safe to connect to the Arduino Due.
WARNING The LM35 is not waterproof! Do not place it directly in water; it could
damage the component and cause oxidation of power wires, resulting in toxic water for
the fi sh. Make sure to totally isolate the LM35 and any wires before placing them inside
an aquarium. The outside glass of an aquarium is often a good indication of the tem-
perature of the water; you can place the LM35 outside the tank, directly on the glass.
The PowerSwitch Tail II is a power cable with on-board electronics. When it
receives a signal on the input pins, it lets the AC electricity through. It requires
little energy to activate; at 5 V, it will draw about 10 mA, which the Arduino is
more than capable of delivering. The PowerSwitch Tail II is also “opto-isolated,”
meaning that the low voltage is never in any contact whatsoever with the AC
lines, making this device extremely safe to use. The output will be connected
to digital pin 7.
To light the aquarium, you can use either an LED array or LED strip. Both
of these can be found on sites like Adafruit. For this application, I recommend
Adafruit's RGB LED Weatherproof l exi-strip (available at http://www.adafruit
.com/products/346 ). These strips contain 60 RGB LEDs per meter, and their
length can be adjusted according to your aquarium. However, they draw far
more current than an Arduino can deliver, so they require an external power
supply and will require three transistors to power them, one for each color
channel. A transistor is like a switch: by providing a small current to the base,
a much larger current can l ow from the collector to the emitter, allowing the
Arduino to power devices that either require far more current than what it can
provide, or even power devices that require more voltage.
CROSS REFERENCE
Transistors were presented in Chapter 3 in the
“Transistors” section.
To control the light intensity, you will be using PWM. The LED will essen-
tially be turned on and off very quickly, far too fast for the human eye to see,
and by varying the duty cycle—that is to say, the amount of time spent on
 
Search WWH ::




Custom Search