exterior motion light kit | jameco part no. 2184499

advertisement
EXTERIOR MOTION LIGHT KIT | JAMECO PART NO. 2184499
Experience Level: Intermediate | Time Required: 2 Hours
This project requires understanding of how to read a circuit schematic. The Ardweeny has its own included
instructions and will need to be assembled first before it is installed onto the protoboard. The circuit board and
relay will be housed in an ABS plastic enclosure, so the presentation on the protoboard is not important. 10
feet of stranded hook-up wire is included for making short connections from the relay to the board or supply to
relay, etc. The color of the wire is not indicative of the polarity or signal transmitted or supplied.
You Will Need
 Soldering iron and solder
 Wire strippers
 Angle cutters
Kit Includes
SKU
QTY
202403
1
417463
1
323362
1
103393
1
18922
1
105100
1
2082927
1
2115768
1
2144454
1
2157167
10
2159218
1
2161051
1
2177838
1
Description
Photocell, 100mW, 3k-200k Ω
LED cable interconnect
Power Supply, dual output, 12V/5V
Header, vertical, 1 row, 10 position
Case, ABS plastic, 3.125" x 2" x 0.875"
Prototype board
PIR motion sensor
Ardweeny MCU kit
Relay module, Arduino-compatible
1/4 watt resistors, 10k Ω
10 watt LED Floodlight, 12VDC
Stranded 20AWG hook-up wire, 10'
Servo extension cable, 3-wire, 12"
1) Ardweeny
Assemble the Ardweeny by following the included instructions.
2) Protoboard
Mount the Ardweeny on the protoboard near one side of the board. Be sure none of the pins are in the
common bussed strips of the protoboard if there are any. For the sensor headers, you will need to break the
single row header into the appropriate pin count. You will need two 3-position headers (one for the relay and
the other for the PIR sensor) and one 2-position header, for connecting the photocell cable. See the schematic
for the Ardweeny and barebones Arduino circuit at the end of this document. Note: The schematic shows a
power good LED that is not included and it is not critical to the circuit. It is just included in the schematic for
reference and testing if you need to troubleshoot.
You will need to make wire or solder jumper connections from the Ardweeny to the pin headers for the
sensors. You will also need a location on the board for the incoming 5V power and ground connections.
3) Electronics Enclosure
The supplied enclosure is to house the circuit board and the relay module. A 3'8" hole should be sufficient to
pass the four stranded wire connections, the two sensor cables, and the main power cable for the floodlight.
However you install the components, make sure you have easy access to the programming header in case you
want to modify the code. Permanently fixing the protoboard inside isn't really necessary, and not doing so
leaves the mounting hole of the protoboard free to be used as a strain relief for the incoming power and ground
wires.
4) Relay and Photocell
The photocell is a board level component which is why the LED connector cable is supplied. Trim the leads of
the photocell so when installed in the LED holder cable, it sits flush. The other end of the connector cable will
connect to the 2-position header in the circuit board. Below is the wiring diagram for hooking up a light to the
relay. The wires of the floodlight should already be stripped and tinned. You may shorten the main cable if
desired. Please be extremely careful when working with 120 VAC. Make sure appliances and power supplies
are disconnected when tinkering with power lines. The DFRobot is helpful for making relay connections:
http://www.dfrobot.com/wiki/index.php?title=Tutorial:_DFR0017_V2_Relay
5) Final Installation
The floodlight is already in a waterproof, metal-bracketed enclosure and can be installed as is. You may opt
for a more custom solution by retrofitting an existing light housing or by making your own. At the bottom of the
page is a template for a plywood cover. The cover allows the light to sit nearly flush and also secures the
sensors and allows them to "see". The dimensions on the template are approximate and should be verified
before making cuts or holes. The floodlight should be test fitted so you can mark the position of the screw
holes and have proper alignment. Some chiseling may be necessary to allow the PIR sensor to sit more
securely and allow the done of the sensor to protrude from the plywood surface.
6) Programming
Your will need a USB to Serial TTL programmer to upload code to the Ardweeny/Arduino. There is a zip
archive containing the Arduino code. One bit is for testing and verifying the sensors. The other is finished
code for a functioning light. Using the test code is necessary for determining what level of darkness to react to.
The default in the final code is "100", but yours may need some tweaking depending on your environment.
The code is commented to assist with making changes to variables such as delay time and how long the light
stays on when triggered.
/* The sample code was created by Ryan Winters for an Exterior Light project
for Jameco Electronics and Club Jameco. Use this code to test the function of the
sensors and also to record values reported by the sensors using the Serial Monitor.
************************************************************************
Relay signal should be connected to digital pin 3 (ATmega328 physical pin 5)
PIR signal wire should be connected to digital pin 2 (ATmega328 physical pin 4)
Photocell signal should be connected to analog input 0 (ATmega328 physical pin 23)
Status LED should be connected to digital pin 13 (ATmega328 physical pin 19)
Status LED is already built into the Ardweeny (still digital pin 13, physical pin 19)
***********************************************************************/
int Relay = 3;
void setup()
{
Serial.begin(9600);
Serial.println("Warming up...");
delay(20000);
pinMode(13,OUTPUT);
pinMode(Relay,OUTPUT);
}
void loop()
{
int Light = analogRead(0);
Serial.println(Light);
Serial.println(digitalRead(2),DEC);
delay(500);
}
//relay is on digital pin 3
//setup the Serial monitor
//display text while waiting for PIR to calibrate
//wait 20 sec required by PIR for calibration
//additional LED for relay status indicator set as output
//set relay as an output
//stores value read from photocell on analog 0
//print photocell value
//print PIR value
//wait 1/2 second and loop
/* The code was created by Ryan Winters for an Exterior Light project
for Jameco Electronics and Club Jameco. Attribution-NonCommercial-ShareAlike CC BY-NC-SA.
************************************************************************
Relay signal should be connected to digital pin 3 (ATmega328 physical pin 5)
PIR signal wire should be connected to digital pin 2 (ATmega328 physical pin 4)
Photocell signal should be connected to analog input 0 (ATmega328 physical pin 23)
Status LED should be connected to digital pin 13 (ATmega328 physical pin 19)
Status LED is already built into the Ardweeny (still digital pin 13, physical pin 19)
***********************************************************************/
int Relay = 3;
void setup()
{
delay(20000);
pinMode(13,OUTPUT);
pinMode(Relay,OUTPUT);
}
void loop()
{
int Light = analogRead(0);
if((Light < 100) && digitalRead(2) == HIGH)
{
digitalWrite(13,HIGH);
digitalWrite(Relay,HIGH);
delay(120000);
}
else
{
digitalWrite(13,LOW);
digitalWrite(Relay,LOW);
}
}
//declares the relay on digital pin 3
//wait 20 seconds for the PIR to warm up (calibrate)
//status LED is setup as an output
//setup the relay as an output
//assign a variable to store the photocell value
//test condition for the light. Photocell must read a
//value less than 100, and PIR must detect motion
//when true, turn on relay status LED
//signal relay to turn on
//number of seconds light remains on before testing again
//turn off status LED
//turn off relay
Download