Shop OBEX P1 Docs P2 Docs Learn Events
Question about 555 timer — Parallax Forums

Question about 555 timer

eagletalontimeagletalontim Posts: 1,399
edited 2011-12-17 20:47 in General Discussion
I have a circuit that is detecting dark spots for a project I am messing with. I have the whole circuit completed, but I have found that I need to add a 2 second time delay to the photocell trigger to prevent small changes in light for a short period from activating the circuit. Once the 2 seconds are up and the device is still detecting dark below the threshold, it will then activate the 555 timer to run another circuit. How would I add a 2 second delay to the photocell trigger without adding another 555? Currently, the photocell is connected to a 4401 transistor where the base is pulled up via a 10k resistor and the photocell is connected to pull down the base to activate the trigger on the 555. Is there some way to add a capacitor to that part of the circuit to charge before activating the trigger on the 555?

Comments

  • ercoerco Posts: 20,259
    edited 2011-12-04 12:41
    Using the 555 as a one-shot? Obviously a 556 is 2 555s in one package, is that an option?
  • kwinnkwinn Posts: 8,697
    edited 2011-12-04 14:17
    The 555 is a very versatile chip and can probably do what you want without adding a second one. Post your circuit and a timing diagram so we can see exactly what you are trying to do.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-04 15:35
    Dark-Sensor.jpg
    Ok, Here is an attached Image of my schematic. Hopefully you can understand it or read it. I don't usually draw out my schematics on the computer. Let me know if you have any questions.
    1000 x 755 - 36K
  • kwinnkwinn Posts: 8,697
    edited 2011-12-04 19:41
    I redrew your schematic (attached) to make it a little clearer to me and have some questions.

    1- You have a PNP transistor (4401) in your schematic but a 2N4401 is an NPN. What transistor do you have there and is it connected as shown in the schematic?

    2- Do you have a part number for the photocell or can you measure it's resistance in light and dark conditions?

    3- Can you check your circuit against my schematic and verify that they match?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-05 02:25
    Oops. The Transistor is an NPN, not PNP. Missed that when I drew it. The photocell pulls down the base while there is light to keep the transistor below the threshold of the 555 trigger. I am not sure of the part number. It came from an assortment pack from radioshack. You schematic does look correct. Sorry for the ugly one I drew :p
  • kwinnkwinn Posts: 8,697
    edited 2011-12-05 17:32
    I am a bit surprised your circuit works with that NPN transistor. As shown in your schematic it is wired in backwards.

    I have attached a simpler circuit that should do what you want. A 100K pot for RDELAY and 22uF for CDELAY should get you close to a 2 second delay. The actual delay also depends on the characteristics of the photosensor so I cannot be more precise.

    The value of RA has to be calculated. You need to measure the dark resistance of the photocell (lets call that RD) and the light resistance (RL).

    RA = (RD+RL)/4

    Use a standard resistor value as close to the calculated value or a pot that can be adjusted to that value.
  • kwinnkwinn Posts: 8,697
    edited 2011-12-08 17:48
    Any progress with this?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-14 15:58
    After a little tinkering, I finally got the timing right with a 10K resistor. The problem I have now is the circuit automatically comes on even if there is light as soon as voltage is put to it. Is there a way to not have that happen?

    I also noticed that as you turn the potentiometer up, the delay goes up as well. Is there a way to fix that?

    And..... The pre-delay works perfect, but if the potentiometer is still in the dark for 30 seconds, then hits light, the "after" delay does not work. It's like the cap for the "in-light" delay charges even in the dark. Any ideas?
  • kwinnkwinn Posts: 8,697
    edited 2011-12-14 17:40
    Are you using the circuit from post #7 ?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-15 06:50
    Yes, I disassembled my other one and wired it like the one you posted in #7. I rewired the POT to fix the pre-delay which is working properly now, but I still can't figure out how to fix the delay that is supposed to be there after the light is above the threshold. The delay is about 26 seconds once the light goes from dark to light, but if the sensor is in the dark for 30 seconds, the delay when back in light is only a few seconds. Basically, the timer is supposed to reset after it encounters dark. Once back in light, it will begin it's 26 second count. If it runs through dark during the 26 seconds, the timer is reset.
  • kwinnkwinn Posts: 8,697
    edited 2011-12-15 20:45
    As I understand what you posted, you want this circuit to:

    1 - Do nothing while the photocell is exposed to light.

    2 - When the photocell is in darkness for more than 2 seconds it triggers a 33 second positive pulse out on pin 3.

    3 - The circuit then requires the photocell be exposed to light for at least 2 seconds to charge Cdelay.

    About the only thing that can be done to improve this circuit is to add a diode in parallel with Rdelay to charge Cdelay faster when the photocell is exposed to light if that is required.

    When the photocell is exposed to light it's resistance decreases causing the voltage at the junction of Ra, Rdelay, and the photocell to increase. This voltage charges capacitor Cdelay through the potentiometer Rdelay. As long as the voltage on pin 2 is above 4V the 555 will not be triggered. When the photocell is not exposed to light it's resistance increases, reducing the voltage at the junction, and the capacitor discharges through Rdelay. Once the voltage on pin 2 drops below 4V the circuit will be triggered.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-15 21:23
    Basically that is correct. Once the circuit is triggered after the 2 second delay of dark, the other delay cap should not be charging while in dark. Once back in light, the second delay kicks in and keeps the circuit on for about 26 seconds. Right now, that is not working since after the circuit has been in the dark for over 30 seconds then brought into the light, the output instantly turns off without a delay. The circuit also activates as soon as power is put to it.
  • kwinnkwinn Posts: 8,697
    edited 2011-12-16 18:45
    Nothing to be done about the circuit activating as soon as power is put to it. That is inherent in the design. The Cdelay capacitor is discharged at power up and needs to charge to >4V by having sensor in light.

    Not too clear on what you mean by the "second delay" kicking in. Perhaps you could elaborate on what you are using the circuit for?
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-16 20:45
    It is a basic headlight control for my car. I was messing with it at first for a robot that had a wireless cam on it, but it got way too complicated and expensive. Now that I have moved it to my car, what I am trying to prevent is having the headlights turn on and off too often just because of slight light changes. So basically, if I pass under an overpass on the highway, the lights will not turn on unless I am in the shadow of the overpass for more than 2 or 3 seconds which is the first delay. Once the circuit has been activated to turn the lights on, the lights will continue to be on while it is dark enough. If say after 2 minutes of having the circuit on, I pass under a bright street light, I don't want the circuit turning off, then back on. That is what the second delay is for. It will keep the lights on for a duration of around 30 seconds. Any time the photocell hits a dark spot below the threshold set by the POT within the 30 seconds, the second delay timer should be reset back to start the count over again.
  • kwinnkwinn Posts: 8,697
    edited 2011-12-16 21:46
    Aha, so you want to turn the lights on after about 2 seconds of low light level and then back on after about about 30 seconds of high light level. That we can do. I will post a schematic tomorrow afternoon/evening.
  • kwinnkwinn Posts: 8,697
    edited 2011-12-17 18:36
    Here is the new schematic. As before the timing is somewhat dependent on the type/resistance of the photocell so you may want to use pots for R1/R2 to find the values you want.
  • kwinnkwinn Posts: 8,697
    edited 2011-12-17 18:40
    Sorry, I seem to be having ongoing problems uploading files. I will try again.

    No luck on my second or third try.

    Have to go out for a couple of hours. PM your email address to me and I will email the diagram to you. I will also try to post it again but I am not optimistic. This problem seems to be getting worse day by day.
  • eagletalontimeagletalontim Posts: 1,399
    edited 2011-12-17 20:47
    PM sent. I have had problems with the new upload function as well.
Sign In or Register to comment.