Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I NEED Help (Circuit For DIY At Home Project)

Status
Not open for further replies.

hellohellosharp

New Member
The goal of my project is to make a circuit with a photoresistor that can turn my bedroom light on and off.

I will be pointing a laser at a little photoresistor. If my bedroom light is on, I want it to turn off, and vice versa.

To make things simpler, lets just forget the photo resistor and say I'm using a push button switch (because I can setup a push-button switch with a photo resistor and a relay). I want to be able to push the button and have the light turn on/off (kind of like a TV power button). I have outlined the circuit I need in the picture below.

**broken link removed**

So like I said, push (and release) the switch and the light turns on. Push (and release) the switch again, and the light turns off. Any help would be GREATLY appreciated.
 
Last edited:
It's not too complicated. One way is to use a D type flip-flop, such as a CD4013, with the switch output going to the clock input. The flip-flop alternates its output state for every clock. The output of the FF can drive a relay (solid-state type is best) to control the light.

You set the FF to alternate on each clock by connecting the D input to the /Q output. Connect all other inputs (not outputs) to ground. The FF can be powered from a 5V to 15V DC supply (a suitable wall-wort can supply that).
 
You, however, want to use a 3-way switch (single poll, double throw) so either the room wall switch or the photo switch can toggle the light to its opposite condition. To do that, you connect the NC contact of one switch to the NC terminal of the other and the NO contact of one switch to the NO contact of the other. You then use the C terminals of the two switches to complete the circuit. In other words, connect one C to the top of 2 in your drawing and the other C to the left of 3.
 
crutschow-

Thanks a ton, I PM'd you for some help.

Gary B-
Thank you....but I'm not sure that will work. Yes I do want to eventually be able to switch from both locations...but I haven't opened my wall up and I'm not sure if the light switch has an NO terminal.

Do all light switches have this? I think my switch might just have two terminals....one coonecting to AC power and the other to the bulb. So when the switch is on, ther terminals are connected, and vice versa. Idk though my knowledge is really rusty. I think the diagram below shows my circuit

**broken link removed**
 
Last edited:
It doesn’t, you have to replace the standard SPST with a 3-way available at hardware and home improvement stores everywhere.
 
How are you going to know where to point the laser when it is dark & you want to turn the light on ?
 
Ross-

Well I want to focus on one thing at a time, but I'll probably just add a Green LED to the circuit that turns on when the light is off.

Problem is I'll have to use a DC batter because I don't think LED's work with AC....
 
carbonzit-
Thank you! I will take start working on that when I get the rest of the circuit going.

crutschow-
I am trying to draw up your circuit on Circuit Logix simulator (student version). The problem is the D Flip-Flops have strange pin labels on them and I'm not quite sure what to do with them. Below is a picture:

**broken link removed**

The description on the program includes a Label-Value and Package:

1- Label Value: DFF | Package:DIP14
2- Label Value: DFFN | Package:DIP14
3- Label Value: 4013 | Package:DIP14
4- Label Value: 74F74 | Package:DIP14
5- Label Value: 4013 | Package:DIP14

Sorry for the repeat on 3 and 5....there is also one more not included in the picture with Label 74LS74 and package DIP14

Anyways...if anyone knows which one I should use and/or what I should do with them in the circuit that would be awesome:)

Thanks guys!
 
Last edited:
Okay sorry guys just scratch that last post, that simulator is crap. If anyone can check my work here (Url below) and tell me if that is the basic circuit, that would be great.

Code:
http://www.falstad.com/circuit/#%24+1+5.0E-6+10.20027730826997+50+5.0+50%0Av+160+112+240+112+0+1+40.0+5.0+0.0+0.0+0.5%0As+240+112+304+112+0+1+true%0A155+368+192+400+192+0+0.0%0Aw+304+224+304+112+0%0Aw+368+224+304+224+0%0Aw+368+192+368+144+0%0Aw+368+144+496+144+0%0Aw+496+144+496+256+0%0Aw+496+256+464+256+0%0Aw+464+192+528+192+0%0Aw+528+192+528+336+0%0Aw+144+336+144+112+0%0Aw+144+112+160+112+0%0Ap+528+336+144+336+1%0Ao+13+64+0+34+5.0+9.765625E-5+0+-1%0A

The wire probe on the bottom is meant to be the light bulb (you can't add them in this simulator).

EDIT: I actually think this link is the correct one, it uses a relay to maintain the AC power. I put an LED in place of the lightbulb (when it flashes the light will be on since LED's flash in AC power)
 
Last edited:
I'll say you need help ... (sorry, couldn't help myself)

First of all, big hint: don't put links (URLs) in [code][/code] tags. Use the link facility for that (the button with the blue globe and yellow link, or just use [url=<url>][/url]. That link was too damned long.

What was that thing, anyhow? I actually did get a simulator window to pop up, but I have no idea what to do with it.

You certainly cannot connect a flip-flop to the AC coming from a power circuit. They run (usually) on 5 volts DC.

Where do you get 40 Hz from? Power line frequency is 50 or 60 Hz.

Anyhow, I'm sure someone will be along shortly to help you with those flip-flops and such.
 
Last edited by a moderator:
I'll say you need help ... (sorry, couldn't help myself)

First of all, big hint: don't put links (URLs) in [code][/code] tags. Use the link facility for that (the button with the blue globe and yellow link, or just use [url=<url>][/url]. That link was too damned long.

What was that thing, anyhow? I actually did get a simulator window to pop up, but I have no idea what to do with it.

You certainly cannot connect a flip-flop to the AC coming from a power circuit. They run (usually) on 5 volts DC.

Where do you get 40 Hz from? Power line frequency is 50 or 60 Hz.

Anyhow, I'm sure someone will be along shortly to help you with those flip-flops and such.

I'm sorry, you must have not seen my links. I did use the link tool (notice the text "check my work here" has a hyperlink on the word "here" and "think this link" also has a hyperlink in my edit). Sorry I will label the circuit below.

**broken link removed**

1-AC power. I didn't set the HZ and voltage exactly right since this drawing was mostly for schmatic purpose so some one could see if I got the circuit right.
2-Push-Button switch. This will be replaced by a Photoresistor and Relay. If you push and release the switch the lightbulb will change states.
3-D Flip-Flop
4-Resistor. Since the relay will have to be held on the while the light is on, I want to resist as much current as possible so my electric bill doesn't shoot up.
5-Relay. When relay is on, light turns on.
6-LED light taking place of lightbulb.

I was trying to make the circuit crutschow talked about in the first reply on this thread. He seemed to know what he was talking about, and the simulation worked for what I wanted. I haven't ever tried connecting a D Flip-Flop to AC power in real life.
 
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top