Showing posts with label lighting control. Show all posts
Showing posts with label lighting control. Show all posts

Wednesday, 30 March 2016

Switching Mains Loads with Relays

I want to control the external lights around my home from a small computer to provide a bit of automation. The plan is to use an Arduino, and have it switch the lights on and off via relays. There are plenty of low cost relay boards to choose from. Most seem to be clones of the same basic designs which offer either 2, 4 or 8 relays. Here's a typical 4 way board:

4 Way Relay Board
4 Way Relay Board
This board has a 2.54mm pitch pin header with 6 pins - ground, +5VDC power and 4 inputs that control the coils of the 4 relays. Each relay is provided with an individual 3 way screw terminal block that is wired to its common, normally open and normally closed contacts. Note that these terminals are big enough for 1-1.5mm solid wire and the relays are rated for up to 10 Amps. My advice is to stay way below this.

The inputs are protected from the "heavy lifting" of energising the relay coils by opto-isolators. Grounding an input pin allows current to flow from the +5VDC supply through a current limiting resistor, a surface mount red LED, and then the LED within the opto-isolator. The forward current is about 2mA in this situation so it's fine to directly connect these inputs to digital I/Os on an Arduino. The relay coils are wired to the +5VDC supply and the opto-isolator phototransistor collectors, and each is provided with a usual flyback diode. (Note that the +5VDC supply might get in the way of using one of these boards with a Raspberry Pi; these use 3.3V digital I/Os and could be damaged by higher voltages.)

So far I've built a box with an 8 way relay board and connected it to 8 external lamps. A small AC-DC module provides +5VDC locally; I will locate the control system elsewhere, with the link to the relay box containing just relay control lines and ground in a multi-core cable.

8 Way Relay Board - Driving Lights
8 Way Relay Board - Driving Lights
Working on electrical installations can be dangerous and is heavily regulated by law. Consult a qualified electrician!

Tuesday, 15 March 2016

12 Volt DC PIRs for Outdoor Use

I've wanted to automate the operation of some external lights in my home for a long time, and PIR motion sensors are a must. I already have several as part of an intruder alarm system, but they are not rated for outdoor use; electronics that is typically uses components with wider than normal operating temperatures (e.g. -40 to +85 degrees Celsius instead of 0 to +70), and conformal coating is often used to protect circuitry from moisture (condensation).

When I first looked for external PIRs (several years ago), I found that almost every one of them was designed to be powered by the mains, and to switch a mains load (a lamp). But I need to drive the inputs of a microprocessor based control system from the PIR, so I would prefer a contact closure (volt free) output. I did find one or two low voltage DC units, but they were horrendously expensive (nearly 100 GBP).

A more recent search turned up a much more reasonable solution:

12V DC Outdoor PIR Motion Sensor
12V DC Outdoor PIR Motion Sensor

This unit retails for under 25 GBP from Solar and Wind Power Systems. It is IP44 rated, runs from a 12 Volt (AC or DC) power supply and has a relay that can switch up to 10 Amps. It allows adjustments to on-time, range (sensitivity) and ambient light.

Note that the unit is supplied with a 4 way terminal block that is quite large (appropriate for 10 Amps). I swapped this for a smaller one. Also, the knock-outs molded into the ABS plastic housing are quite difficult to remove - I resorted to drilling them out.

Here's a video of a quick test of one. In this setup, the ambient light adjustment is at maximum (to allow daylight operation), the range/sensitivity is low, and the on-time is at a minimum - corresponding to about 5 seconds. The power supply is 12VDC, and the output is wired to ground the cathode of a blue LED - the anode is wired to 12V via a 470R resistor.



Notice that the unit's output remains on while the PIR is detecting motion, and stays on afterwards for 5 seconds.

I checked the range quickly in this setup, and detection worked reliably at 4 meters in daylight.