## Sunday, February 8, 2015

### Lidl PIR nightlight teardown and hack

Summary: I picked up some low cost (E8) battery powered / PIR triggered nightlights that were on sale in Lidl. The heart of the device is a common PIR IC. One of the IC pins can be tapped to drive digital IO line for occupancy detection or an intruder alarm. Given that PIR sensors alone in small volumes can often exceed €10/$10 this represents good value for money. The device (Livarno Lux brand (Lidl), model Z31685C) comprises 8 white LEDs, a PIR (Pyroelectric Infrared) sensor with a polyethylene plastic fresnel lens [1] and a photodiode (which suppresses the illumination of the LEDs during the day). It is powered by 8 x AAA alkaline cells (supplied) arranged in two sets of 4 in series. The device can be mounted on a wall or ceiling by attaching a mounting plate with screws or an adhesive strip (also supplied). Teardown: The top cover comes off easily enough: seems to be held on by friction alone. Then an aluminiumized plastic reflector can be pulled of revealing a single sided PCB secured to the base with three screws. On the top surface of the PCB is the PIR sensor, a light sensing photodiode and two electrolytic caps.  Underside of nighlight PCB. (the thin red and yellow wires soldered to the main IC were added by myself to facilitate interfacing with MCU). Click to expand image. The fun is on the underside. At the heart is a 16 pin PIR IC marked "HS0001". Googling this didn't yield any useful results, but I found several PIR ICs that had similar marking codes: LP0001 [3] and BISS0001 [4]. The datasheets for these have a reference design which look very similar to the layout of this PCB. After some probing, I can say with certainty that the HS0001 used on this board is functionally identical to the LP0001 and BISS0001. The board is powered by the two parallel banks of 4 x AAA alkaline cells. Each bank supplies approx 5.5V. A diode in series with each bank prevents one bank from driving the other in reverse (which can cause alkaline cells to leak). A linear regulator provides a 3.3V rail to the PIR IC.  Reference design schematic from LP0001 datasheet. Most of the passive components on the board are resistors and capacitors used to set various tunable parameters of this IC [list pins] The VO (pin 2) line from the IC drives the gate of a (FET?) transistor which switches the lighting LEDs (driven by the 5.5V direct from the batteries). So how power efficient is this? Using a little hack I measured the quiescent current at about 90uA and the current with LEDs on at 70mA. Unfortunately the supplied AAA cells don't have any product code, but typically AAA alkaline cells have capacities in the range from 800 - 1200 mAh. Let's say 1000mAh. And as there is two sets in parallel that's a total of 2000mAh capacity. If you assuming the LEDs are never triggered, that's an approximate battery lifetime of 2000mAh/90uA = 22222 hours or 2.5 years. In reality if the LEDs are on at least a few minutes a day so that brings the battery lifetime down to under a year. Driving a MCU So can this cheap nightlight be used as a PIR sensor for another application? So this is what the OUT2 (output of second stage opamp) pin of the PIR IC looks like on an oscilloscope when I walk into the room (about half way though the trace). So it seems OUT2 tends to about half the supply voltage (1.6V) when there is no activity. Then when a person enters its field of view OUT2 oscillates between 0 and 3.3V. So if you connect this directly to a digital IO input, all you need to do is detect a transition (high to low or low to high). Apply classic switch debounce logic (except on a multisecond time scale) and you have a occupancy / intruder detection mechanism! To facilitate my hack, I soldered some think (30AWG) wire to OUT2 , GND / battern -ve and the 3.3V rail (to draw power for my MCU application).  Oscilloscope trace from the OUT2 pin showing a person enter the room at about the half way mark. Conclusion: If you can find these in Lidl (it's a very hit and miss thing with them) this can be converted into a nice neat PIR sensor for less money than ordering a dedicated PIR sensor [2]. Plus you get the LED night light functionality and 8 AAA alkaline cells! References: [1] Focusing devices for pyroelectric infrared sensors http://www.glolab.com/focusdevices/focus.html [2] Adafruit PIR (motion) sensor ($10)

[3] LP0001 datasheet

[4] BISS0001 datasheet
http://www.seeedstudio.com/wiki/images/2/2f/Twig_-_BISS0001.pdf

Dwalt said...

Did you use the connection from opamp out2 to trigger an interupt on a digital input or did you use analog? I had looked at using this signal to trigger an interrupton an arduino but was stymied by the erratic voltage swing and was curious if you successfully used it and how you wired or coded it together.

Joe Desbonnet said...

Sorry: I didn't get that far yet.

It seems the OUT2 signal settles at exactly half the supply voltage during periods of no motion, ie about 1.5V with a 3V supply (2xAA cells battery).

I was hoping (but haven't tried yet) to feed that directly into a digital input and configure that to trigger interrupts. But thinking about it now, that voltage level is right in the middle of an logic ambiguous zone, so it may not work so well.

Let me experiment and get back to you.

An alternative (if one is available) is to use a comparator. An ADC will obviously work too, but will be a power inefficient.

Joe.

cde said...

Typically you would just connect a Digital Input to Pin 2/VO (Output). It goes to the 1K resistor and then the J3Y NPN transistor on the right of the chip. That's the stable Motion Detected output.

Harry said...

Thnx ! So ... can I add a 12Volt (8 batteries x 1,5 Volt) to the board?
And attach a <a href="https://nl.aliexpress.com/item/5m-5050-RGB-led-strip-fita-de-led-tape-150-LEDs-diode-feed-tiras-lampada-non/32501443935.html>LED strip</a> to it?

Joe Desbonnet said...

By the way: I've subsequently become aware of very low cost PIR modules eg HC-SR501 (typically costing in the order of \$1 / €1 from EBay). I believe it uses the same IC and schematic as described in this blog post. I've put relevant docs and datasheets here: https://github.com/jdesbonnet/HC-SR501

Steven Wollman said...

Here is the datasheet for the HS0001. It's not in English:

http://www.icpdf.com/icpdf_datasheet_6_datasheet/HS0001_pdf_6921485/