View Full Version : Turning on a Light Bulb

10-01-2008, 01:30 AM

I'm trying to make an photoresistor turn on a lamp/bulb. I'm working with the BASIC Stamp Activity Kit so the photoresistor shouldn't be a problem, but I don't know how to turn the lamp on and off aside from using a servo to flip the switch. I'm a total newb and I don't know the proper terminology to search for this.

Any help would be much appreciated.


Chris Savage
10-01-2008, 01:54 AM

Please provide some details about the lamp…is it AC or DC? How many volts/amps/watts? All of this depends on how you would go about controlling it.

Chris Savage
Parallax Engineering

10-01-2008, 02:51 AM
It recommends a 60 Watt Type A bulb and is 120V 60Hz AC

Mike Green
10-01-2008, 02:58 AM
You can certainly use a servo to turn on and off a conventional switch. You can also get a solid state relay (SSR). For a 60W bulb, something as simple as a Crydom D2W202F would work (Google the model # to find a datasheet). All of these have a + terminal to connect to a Stamp I/O pin and a - terminal that you'd connect to the Stamp's Vss (ground) pin or supply. You'd make the I/O pin HIGH to turn it on and LOW or INPUT to turn it off. The other pins on the SSR switch the AC. There are higher power SSRs with screw terminals that work the same way and may be easier to use. If you don't know how to properly protect yourself and your circuits from the dangers of AC, stick with the servo and ordinary AC switch.

10-01-2008, 03:01 AM

I·would reccomend a solid state relay for switching an AC light.


www.madlabs.info (http://www.madlabs.info) - Home of the Hydrogen Fuel Cell Robot

10-01-2008, 03:31 AM
The X10 "Firecracker" module is very good for this.

10-02-2008, 01:56 PM
Thanks for the specifics Mike. I won't do this knowing more, but why would the board be in danger if I'm using an SSR?

Also, what would I use if it was DC power?

10-02-2008, 06:26 PM
· Solid State Relay is a somewhat generic term. An SSR uses electronic components to do the same thing as the more familliar mechanical relay with it's energizing coil and mechanical contacts.

· Solid State Relays are made to switch either AC or DC, but the same one won't work interchangably with both AC and DC.· SSRs use different types of internal electronics dependant on whether they are designed to switch AC or DC, so you need to make an appropriate selection based on what you plan to switch.

· For switching an AC light bulb, an SSR based on "Triac" technology is what you'd need, while for switching a DC load, you'd be using one based on "mosfet" technology. When you look in an electronics catalog for SSRs, you'll see in the description whether it's for AC or DC.

· As for dangers to the board, there's always danger when you have 120VAC where an errant figer can come in contact, plus the danger of working with unfamilliar components and the inherent·increased possibility of miswiring them.·The basic stamp doesn't respond well to 120vac.

·· Darlene

Post Edited (Geekgirl) : 10/2/2008 11:36:57 AM GMT

10-02-2008, 08:37 PM
"Not responding well" meaning bursting into flame, popping like a firecracker, and/or other permanent damage if 120vac is put across the module.

10-31-2008, 08:55 AM
If you mean to do something with it, look into getting some X10 hardware and use the XOUT Pbasic command.

You can get authentic X10 gear on ebay for cheap, thier website is way over priced

Carl Hayes
10-31-2008, 09:52 AM
I'd use a simple old mechanical relay. The Stamp can't drive directly a relay big enough to switch a 60w bulb, but it can switch it through, for example, a ULN2803A chip (about a buck from Mouser). I'd suggest the following:

ULN2803A relay driver chip (Darlington array), Mouser 757-ULN2803APG. This is $0.89 from Mouser, and it will drive eight relays from eight Stamp outputs.

Song Chuan 12v SPNO relay, 12v coil, contacts rated 25A. This will switch a heckuva lot more than 60 watts, can be driven directly from the ULN2803A, and I'm holding one in my hand as I write. Makes it hard to type. Mouser 893-852W1AFC112VDC, $3.16 each. You'll need one for each light.

You can power all the relays through the ULN2803A from a 12vdc wall wart. The coil current is about 90 ma, so even the wimpiest wall wart can handle several of them, and most will handle as many as you have outputs from a Stamp.

Pay no attention to the people who urge you to spend big bucks for solid state relays. The cheapest solid state relays are over ten bucks, and are no better. At all! They have their appropriate uses, in explosive atmospheres for example, but your applicatiion is not among the appropriate uses for solid state relays. Mechanical relays are among the most reliable hardware on the planet, right up there with ball-peen hammers.

· -- Carl, nn5i

11-02-2008, 02:50 AM

I think You have enough Idea's from the other post's on this thread...But like allanlane5 said Be very carefull of Your wireing when working w/ high voltage "120vAC" This can hurt or possiable kill You!!!!!i if You made contact w/ this voltage "120vAC"... If at any instance the "120vAC" makes its way to the $stamp$ it will most certaintly let all of the factory smoke out.And like allanlane5 said "snap crackel pop".....

______use caution_________________________$WMc%_____________ __________fire extinguisher in hand_____

Carl Hayes
11-02-2008, 10:16 PM
Then of course there's the method I would have suggested in the 1960s.

"How do you turn on a light bulb?"

"Stroke it gently, and tell it you love it."

· -- Carl, nn5i