loading
Picture of 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 one such disaster;

How To Hack Together An Adjustable, Dark Activated, AC Outlet Powered, Cold Cathode Tube, Night Light
 
Remove these adsRemove these ads by Signing Up

Step 1: Gather Parts and Accessories

Picture of Gather Parts and Accessories
modware003.gif
See that Modware - Windowed Side Panel and Mod Kit over in the corner? We bought that a few years ago in the heyday of the PC case modding fad and never used it. Time to wipe the dust off. Take out the 12" Neon Cold Cathode Light Kit and the Case Cutting Tool, throw the rest away. The cathode kit includes the light tube itself and a voltage converter (black box thingy). We won't be using the cutting tool in this project but you never know when you'll need some crappy tin snips.

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.

Step 2: Sizing the AC Adapter

Picture of Sizing the AC Adapter
Project_NightLight_033.JPG
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.

Step 3: Step It Up a Notch

Picture of Step It Up a Notch
Just to test things out a bit, strip the AC adapter's wires and stuff them into the cold cathode connector. Make all the proper safety checks and plug it in.

Things are looking dim. And smelling hot.

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.

Step 4: Control Circuit: Attempt Number 1

Picture of 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".

Step 5: Control Circuit: Attempt Number 2

Picture of Control Circuit:  Attempt Number 2
Head on down to your local Radio Shack and pick up the MPF102 JFET. Go ahead and just substitute the old transistor with the JFET. Remember, Base = Gate, Collector = Drain, Emitter = Source.... kind of.... not really.... just line them up the same in the circuit. Turn on the power.

Wow, the light never turns off.

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.

Optional: Before finding out about the negative bias thing.
In frustration, try to set up a Darlington pair by combining the JFET and the transistor from Attempt Number 1. Reference diagram 2.

Mmmm, smokey.

Step 6: Control Circuit: Final Attempt

Picture of Control Circuit:  Final Attempt
Project_NightLight_014.jpg
Project_NightLight_012.jpg
Project_NightLight_008.jpg
Project_NightLight_001.jpg
Project_NightLight_002.jpg
Time again for a Radio Shack run. Your shopping list is now:

From Mouser:
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.

Step 7: All Together Now!

Picture of All Together Now!
Project_NightLight_015.jpg
Project_NightLight_040.jpg
Project_NightLight_026.jpg
Project_NightLight_024.jpg
Project_NightLight_028.jpg
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!

You now know how (not) to hack a night light!

Step 8: Why This Is a Failure

Picture of Why This Is a Failure
Project_NightLight_030.jpg
Project_NightLight_029.jpg
Project_NightLight_038.jpg
Project_NightLight_039.jpg
Adding up all the parts and stupidity, this project cost me $46.95. I could have bought an awesome GE Limelite Night Light for $4.19. It uses space age materials!

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.

There is an unused op-amp in the control circuit.

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.

In conclusion, and because I suck at conclusions, enjoy the glamour shots!
jetflyer134 years ago
i do believe the "black box thingy" is called a ballast lol
angelaice125 years ago
if ur trying not to hack a night light then just let it be ><
theIdeaMen (author) 6 years ago
I appreciate the encouraging words. I was worried my jovial self-deprecation would be mistaken for genuine disgust. In any event, I had a ton of fun on this project and learned quite a bit.
PKM6 years ago
I haven't laughed out loud at an Instructable in a while.. this was classic. Step 4 especially :)
yes I'm juvenile, sue me

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.
gmjhowe6 years ago
Well, at least you gained experience, and no doubt you enjoyed making it!
Rob K6 years ago
Cheaper to go with the night light.

Also yellow and red make 7.

You can use the 5v as a ground from 12v. http://www.cpemma.co.uk/7volt.html

nixiebunny6 years ago
That's a fine project, I wouldn't call it a failure. I'd recommend a few small changes to deal with the instability. It's better to use a real voltage comparator, the LM393, when you need to compare voltages. Op-amps aren't designed to run open-loop like that. Add a >1 megohm resistor from the + input to the output for positive feedback to achieve hysteresis. Put a bypass capacitor across its supply leads to keep it stable while switching. Also, having to spend money on this project just means that you haven't stocked your workshop with enough thousands of dollars of inventory. My shop holds everything needed to build this, but I've been collecting junk for 35 years.
cyrozap6 years ago
Wow. $46.95. I'm honored to learn from your mistake. I'm just glad it wasn't me. That's pretty cool, though.