Night Light Motion & Darkness Sensing - No Micro
by brandit01 in Circuits > Electronics
2879 Views, 36 Favorites, 0 Comments
Night Light Motion & Darkness Sensing - No Micro
This instructable is about preventing you from stubbing your toe when walking through a dark room. You could say it is for your own safety if you get up at night and try to reach the door safely. Of course you could use a bedside lamp or the main lights because you have a switch right next to you, but how confortable is it, to dazzle your eyes with a 60W light bulb when you just woke up?
It´s about a LED-strip you mount underneath your bed that is controlled by two sensors which detect motion and the level of darkness in your room. It will run at low power and brightness to provide a very pleasant light at night. There is also the capability for controlling the brightness-threshold to make it suitable for every environment. No microcontroller is needed to conduct this project. That reduces the number of necessary components and complexity. Furthermore it, it is a quite easy task if you already have some knowledge in electronics hardware circuitry.
Function Principle & Components
The basic working principle of this light is that it has two Mosfet in series with a LED. The Mosfets, which need to be logic level type - explanation later on - are turned on by two different subcircuits of which one responds to darkness and the other one to movement. If only one of them is sensed only one transistor is turned on and the other one still blocks the current flow through the LED. This combination is quite essential as you would waste battery power if you activate the light during the day or with no motion at night. The components and the cirucuit were chosen in a way that you are able to optimize parameters for your own location and the conditions there.
Furthermore a housing was 3-D printed to fit in the components, which is not really neccessary for functionality reasons but has a practical purpose.
UPDATE: A new version of the housing was designed after I published this post. The 3D-printed housing now contains also the LEDs which makes it a "whole-in-one" solution. The pictures from the introduction of this post (new model) differ from the ones in step7 "Power supply and housing" (old model).
Bill of materials:
4x 1.5V batteries
1x GL5516 - LDR
1x 1 MOhm fixed resistor (R1)
1x 100 kOhm potentiometer
1x 100 kOhm fixed resistor (R2)
1x TS393CD - dual voltage comparator
1x HC-SR501 - PIR motion sensor
1x 2 kOhm fixed resistor (R6)
2x 220 Ohm fixed resistor (R3&R4)
2x IRLZ34N n-channel Mosfet
4x cable lugs flat
4x cable lugs (opposite part)
Sensing Brightness
To sense the brightness of the room I used a light dependent resistor (LDR). I created a voltage divider with a 1MOhm fixed resistor. This is necessary because in darkness the resistance of the LDR reaches similar magnitudes. The voltage drop across the LDR is proportional to the 'darkness'.
Setting Up Reference Voltage for Darkness Threshold
The night light shall shine when a certain threshold of darkness is exceeded. The output of the LDR voltage divider needs to be compared to a certain reference. For this purpose a second voltage divider is used. One of its resistances is a potentiometer. That makes the threshold voltage (proportional to darkness) modifiable. The potentiometer (R_pot) has a maximum resistance of 100 kOhm. The fixed resistor (R2) is 100 kOhm as well.
Brightness Dependent Switch
The voltages of the two described voltage dividers are fed into the operational amplifier. The LDR signal is connected to the inverting input and the reference signal to the non-inverting input. The OpAmp doesn´t have a feedback loop, which means it will amplify the difference of the two inputs by magnitudes of more than 10E+05 and thus operate as a comparator. If the voltage at the inverting input is higher compared to the other one, it will connect its output pin to the upper rail (Vcc) and hence turn on the Mosfet Q1. The opposite case will produce ground potential at the comparators output pin which turns off the Mosfet. In fact there is a small region where the comparator will output something between GND and Vcc. That happens when both voltages are almost the same value. This region might have the effect to make the LED´s shine less bright.
The chosen TS393 OpAmp is a dual voltge comparator. Other suitable and possibly cheaper ones can be used as well. The TS393 just was a leftover from an old project.
Motion Detection
The HC-SR501 passive infrared sensor is a very simple solution here. It has a microcontroller built on it which does the detection in fact. It has two pin for supply (Vcc and GND) and one output pin. The output voltage is 3.3V why in fact I had to use the logic-level Mosfet type. The logic level type ensures that the Mosfet is driven in its saturation region with only 3.3V. The PIR sensor consists of several pyroelectrical elements which respond with a change in voltage to infrared radiation that is transmitted by human bodies, for example. That also means it might detect things like cold heating radiotors that are flooded with hot water. You should check the environmental circumstances and choose the orientation of the sensor accordingly. The angle of observation is limited to 120°. It has two trimmers you can use to increase the sensitivity and the delay time. You can change sensitivity to increase the range of the area you want to observe. The delay trimmer can be used to adjust the time for which the sensor outputs a logic high level.
In the final version of the wiring diagram you can see that between the sensors output and the gate of Q2 there is a resistor in series to limit the current drawn from the sensor (R4=220 Ohm).
Electronics Assembly
After understanding each components functionality, the whole circuit can be build up. This should be done on a breadboard first! If you start with assembling it on a circuit board it will be more tricky to change or to optimize the circuit afterwards. In fact you can see from the picture of my circuit board that I did some rework and thus it looks a little messy.
The comparator output needs to be equipped with a pull-up resistor R6 (2 kOhm) - if you are using a different comparator then make sure to check the datasheet. An additional resistor R3 is placed between comparator and Mosfet Q1 for the same reason as described for the PIR. The resistance R5 is dependent on your LED. In this case a short piece of LED stript was used. It has the LEDs as well as the resistor R5 already built in. Thus in my case R5 is not assembled.
Power Supply and Housing
UPDATE: The housing shown at the very beginning of this post is a redesign. It was done in order to have a whole-in-one solution. The LEDs shine from the inside through a "transparent" plastic layer. If this is not applicable for you, the first concept of the first prototype is shown here in this step. (If there is interest in the new design, I can attach it as well)
As mentioned earlier, four AAA 1.5V batteries will power the system. In fact it might be more pleasent to you to use one 9V battery and put a voltage regulator in front of the whole circuit. Then you also do not have to 3-D print a battery housing which connects to the batteries by cable lugs.
The housing is a first simple prototype and has some holes for the sensors. In the very first picture you can see the big hole in front for the motion sensor and the left upper hole for the LDR. The LED strip should be outstide of the housing with same distance to it as it might influence the LDR.