Projects/CorridorLight

Short description

Replicate functionality of an Arduino project using analog components to create a night light that's photosensitive and detects motion.

A bit of history

Moved to a new place that has a corridor connecting all rooms but no natural lights so when all doors are shut, as it's usually the case for fire safety reasons, it's completely dark and also hard to find the light switches. I wanted to fit a night light that wouldn't be on all the time but also wouldn't be on when I have one of the doors open. My first prototype was based on Arduino Nano connecting three LEDs to three pins and using the analogwrite function to dim the LEDs when they start up. For the motion detector I used a PIR sensor I bought some time ago and for the light detection I went for a photodiode instead of a light dependent resistor LDR. I had to reverse bias the photodiode and use an analog input on the Arduino Nano to detect when it was dark enough to turn the LEDs on. As for the power supply, I used a phone charger with USB output so that I can unplug and reprogram the Arduino as necessary. It does the job quite nicely and it has been working for three months but...

You could do that with a 555

It's one of the comments that most electronic hackers would make when such simple functionality is required. Indeed, it can be done with a 555, triggered with the two conditions of low light level and motion detection and driving some sort of transistor in case the power required by the LEDs was higher than what the 555 can supply.

''What's a 555? And also, is that the right device for the application?''

A 555 is basically a timer. It can work as a monostable and astable multivibrator. In plain words: it generates a voltage output that can be maintained for a variable time, can be triggered multiple times and can also be retriggered automatically thus generating a square wave signal (astable configuration). To change the different time constants only a capacitor and a couple of resistors are required so it's quite simple to implement.

I was using the analog output from the Arduino in a similar manner as the 555 could be configured to drive the LEDs but to achieve the same variation of duty cycles on the square wave I would have to change the capacitance or the resistors and that just complicates things. But, how complicated is 'complicated'? What am I trying to do exactly?

Designing an analog circuit from scratch

I use microcontrollers for pretty much every single project, no matter how big or small, and I don't care much about the efficiency of the result as I'm usually going for mains powered solutions. That doesn't mean that I'm not aware of the implications in terms of energy use and cost of components. Yeah, Arduino boards are super cheap and unless you want to run on battery power they don't use much energy but still, could I do better? The first idea was to put the Arduino to sleep with an interrupt but the voltage regulator would still be running so it doesn't really make a huge difference. I'm not the first one to consider this issue (Arduino Low Power).

So, as a challenge, I decided to improve the power consumption and remove the Arduino while keeping the functionality. To do so I would have to use analog circuits and perhaps a logic gate, and if that was the case then it would be my first fully analog circuit. I know the basics but I've been more of an integrator than a designer so perhaps it's a good excuse to follow some methodology that will help reduce the developing time:

- Describe the functionality and generate a logic diagram - Split the functionality into different blocks that can be tested individually - Select the components that are required for each block - Simulate each block - Build the circuit on a protoboard and test functions individually - Integrate and stress-test all of them in one circuit - Generate a PCB layout - Solder the components and build the prototype - Write things down on every step!!!

Day 1 (to be continued)