How-To-Not-Hack-A-Night-Light
How-To-Not-Hack-A-Night-Light
How-To-Not-Hack-A-Night-Light
Table of Contents
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Intro: How To (Not) Hack A Night Light
The road to hacker prowess is paved in stillborn experiments and bloody pieces of failed projects. From these failures we learn patience, determination, how to cuss, and
of course, what not to do. The following hour of programming details once such disaster;
How To Hack Together An Adjustable, Dark Activated, AC Outlet Powered, Cold Cathode Tube, Night Light
Rummage through your junk box/drawer/closet/basement and find a suitable AC adapter. We'll go into how to pick the right adapter a little later.
Also in said junk, find a transistor, a potentiometer, resistors, and a photoresistor. Don't get too caught up in the values, I have a feeling we'll be replacing these with
Radio Shack parts soon anyway.
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Step 2: Sizing the AC Adapter
When sizing a power source it would do you good to ask the load a few questions. What's your current draw? What's your favorite potential? Are you always this needy or
do you spike at all?
Take a look at how our cathode kit is supposed to connect to the computer. It's a standard 4-pin peripheral plug but it only has two wires. Is it +12v or +5v? See where the
two wires line up when you connect it to an open, and running, computer. Then, measure with a multimeter. Or just look up the color code on the internet. It's +12v.
Current is a little trickier. You have to place your multimeter in series. Use a 12 volt power supply and stuff the ground wire into the cathode kit's connector. Connect one
lead of the meter to the power supply's positive and the other lead to the kit's connector. Approximately 333mA.
Ignore this new information and just grab the smallest AC adapter in your junk pile.
Well, that adapter isn't going to work. It wasn't gonna have enough room inside for our control circuit anyway. Grab one that says it can handle the awesomeness of a
blue cathode tube. We're not even gonna test it this time. That's confidence.
Image Notes
1. "Can handle awesome blue cathode tubes"
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Step 4: Control Circuit: Attempt Number 1
The main goal here is to electronically switch on/off the light according to ambient luminescence. Maybe the simplest switching circuit is a transistor and resistors for
biasing. Make one of those resistors sensitive to light, and viola, diagram 1. Vcc is the DC voltage from your wall adapter and Load is the cold cathode. R1 and R2
could/should be a potentiometer in series with a regular resistor. Its up to you if you want to use an NPN or PNP transistor.
Load this up on a prototyping board and let the electrons fly. Then, understand the meaning of 'In Between'.
There is a certain ambient brightness that will cause this circuit to be not quite on and not quite off. The cathode tube will probably be dim and blinky and may even make
a buzzing noise. What we need is a circuit that will give us a hard "on".
Some of our more learned viewers will have already figured out this attempt was doomed from the start. They know that the MPF102 is an N-Channel RF Amplifier and
that the gate bias voltage should be negative for a fully off switch. That just won't do for our needs.
Some things you forget from college turn out to be important later.
Mmmm, smokey.
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Step 6: Control Circuit: Final Attempt
Time again for a Radio Shack run. Your shopping list is now:
From Mouser:
MOSFET - Enhancement Mode N-Channel 30V 1.2Ohm X 5 - $0.76 each, $5.00 s&h
Five MOSFETs because shipping would be the same for a single and extras might come in handy.
The circuit in diagram 3 is what we're shooting for. The main plot point here is the voltage comparator created with the op-amp. The varying voltage from the
photoresistor/trimmer divider gets compared to the constant voltage from the resistor divider. The output of the op-amp is a definitive "on/off". And, of coarse, the
MOSFET is there to handle the switching of the light.
Throw this on a prototyping board first. You want to check functionality because of the wildly varied values of photoresistors. It would be tragic to get it all soldered
together yet not have enough adjustment to get the light turning on in the dark.
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Step 7: All Together Now!
Measure the empty space inside your AC adapter (hopefully there is some). Cut out a chunk of PCB a little bit larger than the width and depth of the empty space. It
needs to fit snug and it's a good idea to shave it down slowly instead of starting over with a new board. Arrange the control circuit in such a way that the photoresistor and
trimmer are close to the edges. Solder your heart out.
We need a holy AC adapter. One hole for the photoresistor and one for the trimmer. There should already be a hole from the old wire where we can place the cold
cathode tube wiring. It would be nice to have the photoresistor sticking out the front but some AC adapters have PC boards in the way. Instead, have it hang over the
edge of the board so it will stick far enough through a side hole to catch some photons.
Line everything up and shove it all together now. If the circuit board is snug and the photoresistor is in a good position it shouldn't rattle around too much. If the adapter
won't hold together use some rubber bands. Hopefully, you can get to the trimmer with a small screwdriver.
Don't panic! Be cautiously optimistic that everything is in order. Hook up the cold cathode tube kit and plug in the AC adapter to an appropriate AC wall outlet.
If there are sparks, you've failed. If the lights go out in the house, you've failed. If you've swept the trimmer up/down and the light doesn't turn on/off, you've failed. If it is
off with the lights on and you see nice neon glow with the lights off, congratulations!
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Image Notes
1. Trimmer adjustment port
Even though the light draws less than half the rated power of the AC adapter, it still gets warm. I tried to remedy this with a lot of little venting holes to no avail. I'm still
nervous to leave it plugged in over night.
Photoresistors are temperature sensitive. The on/off point of the device tends to drift with the aforementioned heat build-up. A possible fix I'm thinking about is to add a
similar photoresistor to the trimmer side of the divider with black tape over it. That should negate the temperature variation of the first photoresistor.
Hysteresis would be nice. There may or may not be room to build or place a Schmitt trigger . This would probably help out with the photoresistor drift, also.
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
Image Notes
1. Obi-wan Affleck
Related Instructables
Trade in your
Free Cold Cold Cathodes Install enhanced LEGO T-
Cathode Computer Cold lighting for your Intersection
Simple RGB for LED's! by
Lighting! Cathode Lights vehicle by LED Traffic
(Photos) by Cold Cathode Yerboogieman Into Car by Light by
sabianq
Xellers Light by drips theduke2011 Maloffstrano
Comments
7 comments Add Comment
This reminds me of building my own ball mill- it went through four radically different designs, smoked two wall transformers and a piddly electric motor. The
process of failing teaches you what works, however, which is always an invaluable lesson.
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/
gmjhowe says: Feb 20, 2009. 5:41 AM REPLY
Well, at least you gained experience, and no doubt you enjoyed making it!
http://www.instructables.com/id/How-To-Not-Hack-A-Night-Light/