Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp 2 about auto off program — Parallax Forums

basic stamp 2 about auto off program

HKfansHKfans Posts: 6
edited 2010-03-15 19:50 in BASIC Stamp
i am use basic stamp 2 for my project
the project i have use
Parallax 2x16 Serial LCD (Non-Backlit)
PING))) Ultrasonic Sensor
BASIC Stamp 2 Module
Memsic 2125 Dual-axis Accelerometer

i want to ask auto-off program

When I pressed the ON, not by ANY button after a few minutes, it will AUTOOFF
HOW TO WIRTE THE PROGRAM TO DO THAT?
THANK YOU FOR HELP

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-03-15 18:48
    Show us the code you have and perhaps we can give you some advice.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • HKfansHKfans Posts: 6
    edited 2010-03-15 18:55
    do you have any code is about auto off?
  • HKfansHKfans Posts: 6
    edited 2010-03-15 18:56
    Franklin said...
    Show us the code you have and perhaps we can give you some advice.

    i only follow paralax doc to write the program
  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-15 19:12
    There is no "auto-off" program. How you would write one depends on your existing program.

    You will need to build some additional hardware to turn off the power to the display and the sensors. There is no "ready made" hardware. It's not difficult. It mostly consists of a PNP switching transistor like a 2N3906, a few resistors, and a capacitor. The Stamp uses a SLEEP statement to drop into a low power state (read the chapter on the SLEEP and NAP statements in the BASIC Stamp Syntax and Reference Manual).

    It might be possible to provide power for the Accelerometer from a Stamp I/O pin, but the PING and the display require a little more than the Stamp could control directly. The limit is around 20mA.

    Post Edited (Mike Green) : 3/15/2010 7:18:19 PM GMT
  • HKfansHKfans Posts: 6
    edited 2010-03-15 19:34
    THANK YOU MIKE GREEN

    Post Edited (HKfan&#65363[noparse];)[/noparse] : 3/15/2010 7:41:40 PM GMT
  • HKfansHKfans Posts: 6
    edited 2010-03-15 19:43
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    Main:
    LOW 0 ' turn LED on
    STOP ' stop program

    THAT'S MEAN ALL SENSOR AND LCD DISPLAY OFF?
  • ercoerco Posts: 20,256
    edited 2010-03-15 19:50
    One way is have an SCR and a NC relay in series providing power to everything. Your "on" pushbutton simply triggers the SCR gate, and everything stays on afterward (must maintain minimum current flow through SCR). To turn off, trigger the relay to open up, which will interrupt the current flow temporarily, then the SCR will keep it off.

    Alternatively, if you only have a NO relay (like a reed relay), put that across your SCR (anode & cathode). To turn off the SCR, temporarily turn that NO relay on to short the SCR and it will stay off afterward.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.