Shop OBEX P1 Docs P2 Docs Learn Events
555 Timer Help. — Parallax Forums

555 Timer Help.

Luke TYLuke TY Posts: 11
edited 2008-01-05 14:35 in BASIC Stamp
Hello all,

I am currently working on a remote controlled Ranch gate that will respond to headlight flashes using the photoresistor.
Pseudo Code is as follows.


Determine what time of day it is
Take initial reading, monitor and adjust sensitivity as time progreses and the RC time begins degradation.

Activitation

one flash - substantially higher than the current day light
pause 500
Wait for another flash
question - how do i Get the stamp to wait and sense at the same time? - 555 timer???

with 555 ( set 555 timer. while time is less than 15 seconds and # of flashes != 3 ) THEN keep sensing.

So.... This is pretty much the core of it. How do I operate this wonderful 555 timer with the stamp?

I've searched with

[noparse][[/noparse]/code]

                

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-03 18:33
    The easiest thing to do is not use the 555. You can use the sense routine as a time base and count how many times you look for another flash. If the count is more than some threshold you've set, then you have a delay more than 1/2 second. I know this time is only approximate, but it probably will be enough for your purposes. You could even use a table based on the RCTIME value which gives the threshold count for different light levels to adjust for the variable amount of time for the RCTIME.

    In terms of hooking up a 555 timer to a Stamp, you use one I/O pin for the trigger input to the 555 with a LOW acting as the trigger and HIGH as idle. The output of the 555 gets connected to another I/O pin in INPUT mode.

    Post Edited (Mike Green) : 1/3/2008 6:40:03 PM GMT
  • LilDiLilDi Posts: 229
    edited 2008-01-03 22:55
    the code might be something like:

    DO
    (Calibrate the sensor)
    LOOP WHILE "one flash not detected"

    READ time and date and other data and GOTO back to the DO/LOOP to wait for another "one flash"

    This is what Mike Green is referring to
  • Luke TYLuke TY Posts: 11
    edited 2008-01-04 00:17
    Okay. So in my severe state of ignorance let me go ahead and ask if there is a timer built into the stamp right now? I am using the board of education. LilDi, in your last post you had read time and date, can I do that from the stamp?
  • SandgroperSandgroper Posts: 62
    edited 2008-01-05 14:35
    You can use the PAUSE command and an interval variable to give you the interval you require.· In pseudo code, perhaps something like this:


    Check Sensor:

    If light sensor > threshold value then PAUSE 1000 (gives a one second pause)

    For interval = 1 to 10 : Read light sensor

    ··· IF light sensor > threshold value then goto open·gate routine

    ··· Pause 100

    Next

    Goto Check Sensor


    ·After the initial flash, the program waits for one second before taking the next reading.· Thereafter it reads the sensor once every 100 milliseconds for ten consecutive loops (= one second in total).· If the light sensor reading exceeds the threshold value during this time, the program jumps to the open gate routine.· If not, it goes back to the start of the program.·

    You can use the·NAP and/or SLEEP commands for saving power between cycles.·

    You could also time the length of the flashes by using a loop with an incremental counter.
Sign In or Register to comment.