![]() The timer’s range can be adjusted up or down from 14400 using the variable wait. If you need to manually reset the device, consider adding a pushbutton switch to ground the reset button (RST). By turning the control all the way down (to zero volts), the light comes on at dark and stays on until light returns (sunset to sunrise). Everything automatically resets after timing has expired and light is available. ![]() When you turn up the control in full, the light will stay on for approximately 4 hours before turning off. Turning up slightly the timing control will turn the lights on for a few minutes before turning off again. The timer is activated as soon as the timing control is turned above 0V (zero volts). Adjust the 10K potentiometer to control how long the light stays on after dark. However, if you want the light to come on at dark, stay on for a while, then turn off before sunrise. And when the control is set to minimum, the relay turns on the light then off as soon as light returns (sunset to sunrise). The relay will turn on the light when the photoresistor is dark (covered). The CodeĪfter everything is connected according to the wiring diagram above, upload this code to your Arduino: const int photoResistor = A0 Īfter uploading and compiling the code, set the 10K potentiometer to the minimum. Since the relay can draw as much as 80 mA when energized, you could damage the Arduino if you drive the relay directly from it. Note: The relay has a built-in transistor to drive the relay coil as well as a diode across the winding to protect the transistor. Keep in mind that two identical photoresistors may have different resistance ranges. ![]() You can check the resistance of the photoresistor in low and high light levels with an ohm meter. The typical range of a photoresistor runs from about 3K ohms in high light levels to many Mega ohms in low light levels. As the light gets dimmer, the resistance increases. In bright light, a photoresistor has a lower resistance. Photoresistors or Light Dependent Resistors (LDR) are light sensing devices. To prevent back EMF, a diode needs to be placed in parallel with the coil. ![]() This induces a large reverse current in the coil, which can damage other components in the circuit. Back EMF happens when the electromagnetic field surrounding the coil collapses back into the coil. When working with inductive loads like relays, solenoids, motors, or stepper motors, it’s important to protect your circuit against back EMF. When the switch is closed, current flows through the coil and the electromagnetic field produced from the coil causes the high voltage terminal to switch to the normally open position: With no current flowing through the coil, the relay is in the normally closed position: Inside the relay is an electromagnetic coil that actuates a high voltage switch when there is current flowing through the circuit. They can be configured to switch AC line current to loads like fans, motors, and lights. At 150☏ the relay shuts off and the current stops.Relays are often used in home automation projects. In this example, the relay will stay activated and let current flow through the light bulb until the temperature of the thermistor reaches 150☏. The CodeĪfter everything is connected, upload this code to the Arduino: #include See our article on Making an Arduino Temperature Sensor for more information. If you do use a 100K Ω thermistor, you’ll need to change line 7 in the code below to Temp = log(100000.0*((1024.0/RawADC-1))). If you use a 100K Ω thermistor, use a 100K Ω resistor. For example, I’m using a 10K Ω thermistor, so the resistor should be 10K Ω as well. The value of the resistor should be the same order of magnitude as the thermistor. The thermistor part of the circuit is set up as a voltage divider. It’s dangerous to put the relay on the neutral wire, since if the device fails current can still fault to ground when the relay is off. This way the relay is on the hot side, and current is switched before it reaches the light bulb. Connect the side leading to the light bulb to the NO terminal of the relay, and the side leading to the plug to the C terminal. Identify the hot power wire (red wire in the diagram above) in the cord leading to the light bulb and make a cut.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |