This is only a preview of the December 2024 issue of Silicon Chip. You can view 40 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Capacitor Discharger":
Articles in this series:
Items relevant to "Compact HiFi Headphone Amp":
Articles in this series:
Items relevant to "WiFi weather logger":
Items relevant to "The Pico Computer":
Items relevant to "Variable Speed Drive Mk2, Part 2":
Purchase a printed copy of this issue for $13.00. |
SILICON CHIP
Mini Projects #017 – by Tim Blythman
Automatic Night
Light
While Arduino modules make it easy
to add sensors to microcontrollers, the
same modules can often be used without a micro.
For example, Jaycar’s XC4444 PIR sensor modules can be
easily turned into a night light controller with just a few extra parts.
M
any night lights are programmed
to only turn on when they detect
motion in the dark, using a PIR (passive infrared) motion sensor and an
LDR (light dependent resistor) to
detect the ambient light level. It’s certainly a handy thing to have around
the house.
Recently, we came across an application note explaining how to add
an LDR to the BISS0001 PIR sensor
controller chips, as used in Jaycar’s
XC4444 PIR sensor module.
By adding an LDR to the PIR module,
the PIR sensor will only operate when
the LDR has a high resistance; that is,
when it is dark. We just need a way for
the PIR sensor module to switch on
a light, and we have a useful circuit.
One bonus of this arrangement is
that these PIR sensor controllers are
designed to have a very low quiescent
(idle) current, so our circuit is wellsuited to being powered by batteries. It
will only draw any significant current
when the light is actually on.
We’ll mention some other features
of the PIR sensor module a bit later.
It is quite configurable and has some
adjustments that can be changed to
tweak its behaviour.
The XC4444 PIR module
This module has a PIR sensor with
two sensing elements. The elements
detect the IR radiation that is passively
emitted from people and animals. The
elements are arranged so the output is
their difference.
When a passive IR emitter walks
past, the signal changes as the elements report differing amounts of
IR radiation. The BISS0001 PIR sensor controller chip mentioned earlier
turns this into a digital output signal
that is usually low but goes high when
a moving object is detected.
The module has two trimpots to set
the sensitivity and the duration of the
output pulse. Figs.1 & 2 show a block
diagram and their corresponding parts
Fig.1 (left): this block diagram shows what is built into the PIR sensor
module’s small PCB. The output has a series 1kW resistor, so we can directly
connect it to a bipolar transistor’s base.
DELAY TRIMPOT
SENSITIVITY TRIMPOT
VOLTAGE
REGULATOR
LDR (NOT
FITTED)
After removing the plastic lens, the
LDR module is soldered to the pads
labelled “RL” on the PIR module as
shown. The LDR’s light-sensitive side
must be facing the same direction as
the IR sensor.
52
Silicon Chip
PIR SENSOR
ON REVERSE OF PCB
POWER AND
IO HEADER
CONTROLLER
IC
Fig.2 (above): the locations of the parts
on the PIR PCB. The two pads near the
header are for the optional LDR, while
two others can accept a thermistor to
provide temperature compensation.
Australia's electronics magazine
siliconchip.com.au
ADVANCED
TEST T EEZERS
The Advanced Test Tweezers have 10 different modes, so you can measure
☑ Resistance: 1Ω to 40MΩ, ±1%
☑ Capacitance: 10pF to 150μF, ±5%
☑ Diode forward voltage:
0-2.4V, ±2%
☑ Combined resistance/
capacitance/diode display
☑ Voltmeter: 0 to ±30V ±2%
☑ Oscilloscope: ranges ±30V at
up to 25kSa/s
☑ Serial UART decoder
☑ I/V curve plotter
☑ Logic probe
☑ Audio tone/square wave
on the module. Note that the module
does not come with the LDR fitted,
so it needs to be added, but that is
quite easy.
emitter (E) pin. As a result, all three
elements of the RGB LED light up, providing white illumination. The human
eye is surprisingly sensitive, so even a
small LED module like this will provide adequate light in a dark room.
Circuit details
Fig.3 is the circuit for our Night
Light. Power comes from a 3×AA battery holder, providing a nominal 4.5V.
The PIR sensor module contains a 3.3V
regulator and will work with any supply voltage from 4V to 12V.
We have arranged for the output of
the sensor to drive an NPN transistor.
A bipolar junction transistor like this
should have a base resistor to limit
the base current, but there is actually
a 1kW resistor in series with the module’s output, so an external resistor is
not needed.
When the output goes high, it biases
the transistor on and current can flow
from the transistor’s collector (C) to its
generator
Assembly
Because soldering is needed to add
the LDR to the PIR module, we decided
to build the Night Light on a small prototyping board.
The wiring is elementary and could
easily be done without a prototyping
board, but it makes a nice, stable base
for the device.
The first step is to fit the LDR to the
PIR module. The large plastic lens is
just a friction fit to the PIR module’s
PCB, so it can be pulled or prised off
with a flat-tipped screwdriver.
Having done that, solder the LDR to
the pads labelled RL on the PCB, with
Complete Kit (Cat SC6631)
siliconchip.com.au/Shop/20/6631
The kit includes everything
pictured, except the lithium coin
cell and optional programming
header. See the series of
articles in the February & March
2023 issues for more details
(siliconchip.com.au/Series/396).
the LDR’s light sensitive side facing
in the same direction as the existing
IR sensor.
Make sure the LDR doesn’t block the
IR sensor; refer to our photos to see
how we arranged it. After that, pop the
lens back on. Next, carefully bend the
three-pin header to allow the PIR module to be mounted facing outwards on
the prototyping board. Again, refer to
our photos if you aren’t sure about this.
The prototyping board has two copper tracks that snake around it, which
we used for the Vcc (4.5V) and GND
(0V) rails.
Fig.4 shows how we laid out the
parts and wiring. Note that this
assumes you have a −BRG marked
RGB LED module, as we got from our
local Jaycar. Other versions of the
module may be wired differently and
may not even need the three external
resistors.
Fig.3: in our Night Light circuit, a
signal from the PIR module drives the
transistor which then switches the LED
module on. It will run for a long time
from three AA cells, using negligible
power until it is activated.
siliconchip.com.au
Australia's electronics magazine
December 2024 53
Parts List – Automatic Night Light (JMP017)
1 PIR sensor module [Jaycar XC4444]
1 RGB LED module [Jaycar XC4428]
1 light-dependent resistor (LDR) [Jaycar RD3480]
1 BC546, BC547, BC548, BC549 or similar NPN transistor [Jaycar ZT2154]
3 150W ½W axial resistors [Jaycar RR0552]
1 mini prototyping board [Jaycar HP9556]
1 3×AA cell holder [Jaycar PH9274]
3 AA cells
1 10cm length of insulated wire (cut from excess length on battery holder)
4 self-adhesive feet (optional) [Jaycar HP0815]
If you have a part marked +BRG or
similar (meaning it is a common anode
type, instead of common cathode), the
+ or anode should go to the red 4.5V
supply and the common end of the
three resistors should connect to the
transistor’s collector.
If you want to use a different LED,
make sure that it has the appropriate series resistor for your chosen
voltage and connect the anode to
4.5V and the cathode to the transistor collector.
We recommend fitting the lower-
profile parts (like resistors) and wires
before the modules, as they are difficult to get to otherwise.
Fortunately, two of the three transistor leads line up with two of the PIR
module’s leads, simplifying the layout.
Make sure you don’t get the transistor
backwards.
Now add the LED module, battery
holder and insert the cells. You can
test that the LED is wired correctly
by shorting the outer two leads of
the transistor (emitter and collector),
which could cause it to light, as long
as the cells are inserted in the battery holder.
If all is well, remove the cells, solder the PIR module in place and then
refit the cells.
As we’ve added the LDR to the PIR
module, you’ll need a dark room to
test the Night Light. Walk in front of
it and check that the LED lights up. It
might only be for a second or so, but
that is enough to know it is working.
Conclusion
Using the two trimpots shown in
Fig.2, you can adjust the sensitivity
and delay time. Both increase when
the trimpots are rotated clockwise. The
delay refers to the time that the output
is high and thus the time the LED is
on after each trigger event.
We suggest setting the delay to
its minimum (fully anti-clockwise)
and sensitivity near the middle, then
adjust the sensitivity until you are
happy with how close you have to
get before it’s triggered. That’s easier
to do when the LED only stays on for
about a second at a time. After that,
adjust the delay to your liking. The
working range is about one second to
three minutes.
Fit rubber feet if you wish, and set
up the Night Light where it is needed.
We measured the current draw of our
prototype at 50μA when idle and
35mA when the LED was on, so the
battery life will mostly depend on how
much the light is activated.
If the Night Light is used infrequently, the AA cells should last
for several years. You will see the
light getting dimmer as the battery
SC
goes flat.
Fig.4 (left): a top view of how we laid out our prototype. The copper
pattern is not visible from this angle; we have shown it here so you
can see how the 4.5V and ground rails are connected on the other
side of the PCB.
The photo above shows how we have laid out the
wiring on our prototyping board. The adjacent
close-up photo shows the two points under the
board where we used blobs of solder to connect to
the 4.5V supply and ground rails.
54
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
|