Shop OBEX P1 Docs P2 Docs Learn Events
Automatic Door — Parallax Forums

Automatic Door

orrinbareorrinbare Posts: 32
edited 2012-01-19 22:12 in Robotics
I am making an automatic door for our chicken house. I'm using the basic stamp 2 as the brain, 2 relays to control a 2 directional motor, 2 limit switchs to detect door open and door shut, a pushbutton to override the automatic control and open the door if shut or shut the door if its open. I'm using the DS1302 and 3V battery backup to keep track of time. I need the door to open and close at a certain time of day. i have a basic idea of what the program needs to do, but i could use some advice from any more experienced programmers.
my idea for the program:
(this isn't in pbasic obviously)
DO
if the pushbutton is pushed, decide if the door is open or closed then close/open it then return to the program start
if the button is NOT pushed then look up what time it is from the DS1302 and if it is time to open or close the door, do so, if not return to start
LOOP

one problem with the above program is that the program will be DO-LOOPING 24/7, can the bs2 handle that? my ideal service time for this will be several years if it is up to it.

another problem scenario: its 5:00, my bs2 reads it is time to open the door, reads that the limit switches indicate the door is down. the bs2 runs the motor to open the door but the door binds in the tracks. the motor is in a bind and it won't shut off until the door triggers the other limit switch. i can't figure out how to make it so it will shut off when the switch closes OR after 15 seconds.

Comments

  • orrinbareorrinbare Posts: 32
    edited 2012-01-19 22:12
    42 views and no replies? i actually figured it out over a space of about five hours, its probably not perfect, but it seems to work and fits in the space with just a little left over...
Sign In or Register to comment.