November 23, 2024, 08:58:38 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Double acting pneumatic door opener.

Started by pbronson, February 03, 2011, 11:51:38 AM

Previous topic - Next topic

pbronson

February 03, 2011, 11:51:38 AM Last Edit: February 03, 2011, 12:14:32 PM by JonnyMac
Here is what I would like to accomplish, using a Prop-1 with the POT and a 6 watt 4 way pneumatic valve.

1- Activate a 12 volt solenoid for one second to release the door latch.
2- Energize first pneumatic solenoid valve and hold for a min of 10 sec to a max of 60 sec based on the POT.
3- Deactivate first solenoid and activate second to close for 10 sec, then deactivate.

I would like to incorporate a PIR in the doorway to prevent the door from closing if there is someone in the way. A no movement time of 2 sec should be sufficient.

Trigger will be a push switch on Pin 6
Extend  on Pin 1
Retract on Pin 2
Door release solenoid on Pin 0

I hope this is enough information. If not, please let me know.
Thank you for the help.  Pete
T

T


JonnyMac

February 03, 2011, 04:23:29 PM #1 Last Edit: February 03, 2011, 04:37:53 PM by JonnyMac
Is the door release latch pulsed for one second before moving on to the next step, or is it turned on and then we wait one second, leaving it on during other steps?  This is important because your 6W valve is on the ragged edge of what the ULN can drive at 12v.

Does the PIR prevent moving on to step 3?
Jon McPhalen
EFX-TEK Hollywood Office

pbronson

The latch is pulsed on for one second then off. The PIR should prevent moving on to step 3 if there is movement.
The wattage is closer to 5 watts.
Thanks

bsnut

I will use a relay for your 6W valve and this will take care of any problems with wattage on the ULN.
William Stefan
The Basic Stamp Nut

JackMan

It appears to me that the door latch solenoid will still be energized when the pneumatic valve becomes energized to allow the door to open. How much current does the 12v door latch draw? Sounds like you might need 2 relays, 1 for the latch and 1 for the valve.

pbronson


I have been using the following program and it has worked quite well. I would like to add the PIR so the door will not close if there is someone in the doorway. The latch is just pulsed as the door will pop open when the latch is released. So far I have not needed a relay.

Thanks,

Pete




' =========================================================================
'
'   File...... Door_Access_v2.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Delay           = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Retract         = PIN2
SYMBOL  Extend          = PIN1
SYMBOL  Door            = PIN0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = W5


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs

  timer = 0                                     ' reset timer


' -----[ Program Code ]----------------------------------------------------

Main:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 200 THEN Main                      ' wait for 0.2 sec input

Read_Delay:
  POT Delay, 103, timer                         ' read pot, 5..255
  timer = timer / 5 + 9 * 1000                  ' scale to 10000 to 60000

Open_Sesame:
  Door = IsOn                                   ' activate actuator
  PAUSE 1000
  Door = IsOff

  Extend = IsOn
  Retract = IsOff
  PAUSE timer

  Extend = IsOff
  Retract = IsOn
  PAUSE timer

  GOTO Reset                                    ' reset everything


' -----[ Subroutines ]-----------------------------------------------------



JackMan

Got Ya. I haven't tested this but I think it will do what you want.



'   {$STAMP BS1}
'   {$PBASIC 1.0}
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Delay           = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  PIR             = PIN5
SYMBOL  Retract         = PIN2
SYMBOL  Extend          = PIN1
SYMBOL  Door            = PIN0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = W5


' -----[ Initialization ]--------------------------------------------------

Reset:
 PINS = %00000000                              ' clear all outputs
 DIRS = %00011111                              ' make P0-P4 outputs

 timer = 0                                     ' reset timer


' -----[ Program Code ]----------------------------------------------------

Main:
 PAUSE 5                                       ' loop pad
 timer = timer + 5 * Trigger                   ' update timer
 IF timer < 200 THEN Main                      ' wait for 0.2 sec input

Read_Delay:
 POT Delay, 103, timer                         ' read pot, 5..255
 timer = timer / 5 + 9 * 1000                  ' scale to 10000 to 60000

Open_Sesame:
 Door = IsOn                                   ' activate actuator
 PAUSE 1000
 Door = IsOff

 Extend = IsOn
 Retract = IsOff
 PAUSE timer

Close_Door:
 IF PIR = IsOn THEN Hold
 Extend = IsOff
 Retract = IsOn
 PAUSE timer

 GOTO Reset                                    ' reset everything

Hold:
 PAUSE 2000
 GOTO Close_Door

JonnyMac

Here's a very small modification of Jack's program that separates the output pins to help spread the heat across the chip (since you're using loads right on the edge of the ULN's capability), and an update of the final section the delays for the PIR.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Delay           = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  PIR             = PIN5

SYMBOL  Retract         = PIN4                  ' separated for thermal
SYMBOL  Extend          = PIN2                  '  management
SYMBOL  Door            = PIN0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = W5


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00010101                              ' set outputs

  timer = 0                                     ' reset timer


' -----[ Program Code ]----------------------------------------------------

Main:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 200 THEN Main                      ' wait for 0.2 sec input

Read_Delay:
  POT Delay, 103, timer                         ' read pot, 5..255
  timer = timer / 5 + 9 * 1000                  ' scale to 10000 to 60000

Open_Sesame:
  Door = IsOn                                   ' activate actuator
  PAUSE 1000
  Door = IsOff

  Extend = IsOn
  Retract = IsOff
  PAUSE timer

Check_PIR:
  timer = PIR * 2000
  PAUSE timer
  IF PIR = IsOn THEN Check_PIR

Close_Door
  Extend = IsOff
  Retract = IsOn
  PAUSE 10000

  GOTO Reset                                    ' reset everything
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

I agree with Jon's point here.
Quotehelp spread the heat across the chip (since you're using loads right on the edge of the ULN's capability
I would suggest you, to use a glue-on heat sink, so can draw more heat away from the ULN itself. But, relays are the best way to go if can't find the glue-on heat sinks.
William Stefan
The Basic Stamp Nut

pbronson

Thanks,

I will run it and let all know how it works.

Great to have these resources.

Pete

pbronson

A little help as I am just learning programming. Could you explain the following statements and what they do?

Thanks,

timer = timer + 5 * Trigger

timer = timer / 5 + 9 * 1000

I understand the second one is to scale but I am confused on the /5 + 9 * 1000

Thanks

JonnyMac

First,

The trigger loop has a 5ms delay (PAUSE 5) so this line

  timer = timer + 5 * Trigger

... will increment the value of "timer" as long as the trigger is active.  PBASIC 1 expressions are evaluated strictly left-to-right.  When that line runs it adds 5 to timer and then multiplies it by the trigger input which is either 1 (when active) or 0 (not active); when not active the value of "timer" is cleared to zero.


Second,

Again, math is evaluated left-to-right.  When you read the POT on a Prop-1 you're going to end up with a raw value of 5 to 255.  If you divide that by 5 you get 1 to 51.  Now add 9 and you get 10 to 60 (seconds).  Finally, multiply by 1000 and use that value with PAUSE.
Jon McPhalen
EFX-TEK Hollywood Office

pbronson