Shop OBEX P1 Docs P2 Docs Learn Events
Motion Control Telephone lift — Parallax Forums

Motion Control Telephone lift

I am new to programming. I need to move two panels in sequence. They will be driven by DC powered motors on rack gears. I have everything built and now need to move it.
Please view the attachment showing the workings and basic parts.
Any help would be much appreciated

The sequence of movements:

sequence:

1- Phone rings or up button pushed
2- upper cover panel slides to open position and stops (proximity sensor)
3- lower table moves to upper position and stops (Proximity sensor)
Panels will stay in thse positions unless option 4 is pushed. This will put the unit back in waiting for sequence 1.

4- optional: down button pushed
reversing sequence to down position
2550 x 3300 - 623K

Comments

  • $WMc%$WMc% Posts: 1,884
    You'll have to connect a cell phone to your Stamp in order to work with another cell phone. Or you could add WiFi to your stamp. if you stay in range.
    You'll have to write to code for both.
    We can help you with this if you show enough interest.
  • 72sonett72sonett Posts: 82
    edited 2018-03-24 21:06
    Reading your post I am thinking of a BS2 with some switches and a dual motor controller, and this program:
    ' telephonelift.bs2
    
    ' {$STAMP BS2}                      ' Select BS2 as target module
    ' {$PBASIC 2.5}                     ' Select PBASIC 2.5 as language
    
    'sequence:
    '1- phone rings or up button pushed
    '2- upper cover panel slides to open position and stops
    '3- lower table moves to upper position and stops
    '   Panels will stay in these positions unless option 4 is pushed. This will put the unit back in 
      waiting for sequence 1.
    '4- optional: down button pushed
    '   reversing sequence to down position
    
    ' ======================= [variable declarations ] ================
    true          CON 1       ' boolean constants
    false         CON 0
    
    ' input pins with switches:
    coverisclosed PIN 0
    coverisopen   PIN 1
    tableisup     PIN 2
    tableisdown   PIN 3
    movephoneup   PIN 4
    movephonedown PIN 5
    phonerings    PIN 6
    
    'output pins motor control through L298H dual H-bridge
    enableA       PIN 7       ' upper motor on/off
    dirA1         PIN 8       ' forward/reverse upper motor
    dirA2         PIN 9
    enableB       PIN 10      ' lower motor on/off
    dirB1         PIN 11      ' forward/reverse lower motor
    dirB2         PIN 12
    
    ' ========================= [ main ] ========================
    DIRS = %1111111110000000  ' set pins 0..6 input (0), 7..15 output (1)
    
    DO
      DO           ' wait
      LOOP UNTIL (phonerings = true) OR (movephoneup = true) ' phone rings or up switch pressed
      GOSUB opencover
      GOSUB movetableup
    
      DO           ' wait
      LOOP UNTIL (movephonedown = true)   ' down switch pressed
      GOSUB closecover
      GOSUB movetabledown
    LOOP           ' forever
    END
    ' ==========================[ end main ] ==============
    ' ------------------------ [subroutines ] -------------
    opencover:        ' opens the cover
      HIGH dirA1      ' set upper motor to turn one way
      LOW  dirA2
      HIGH enableA    ' turn upper motor on
      DO             ' run upper motor
      LOOP UNTIL (coverisopen = true)  ' cover open switch is pressed
      LOW enableA     ' stop upper motor
    RETURN
    ' ---------------------------------------
    closecover:    ' closes the cover
      LOW  dirA1      ' set upper motor to turn other way
      HIGH dirA2
      HIGH enableA    ' turn upper motor on
      DO             ' run upper motor
      LOOP UNTIL (coverisclosed = true)  ' cover closed switch is pressed
      LOW enableA     ' stop upper motor
    RETURN
    ' ---------------------------------------
    movetableup:      ' moves the telephone table  up
      HIGH dirB1      ' set lower motor to turn one way
      LOW  dirB2
      HIGH enableB    ' turn lower motor on
      DO              ' run lower motor
      LOOP UNTIL (tableisup = true)  ' table up switch is pressed
      LOW enableB     ' stop lower motor
    RETURN
    ' ---------------------------------------
    movetabledown:    ' moves the telephone table down
      LOW  dirB1      ' set lower motor to turn other way
      HIGH dirB2
      HIGH enableB    ' turn lower motor on
      DO              ' run lower motor
      LOOP UNTIL (tableisdown = true)  ' table down switch is pressed
      LOW enableB     ' stop lower motor
    RETURN
    ' ------------------------ [end subroutines ] -----------------
    ' ========================== [end program ] ==========================
    

    but I do not know how to connect a switch (SW7 in the schematic) or another type of sensor to a telephone to check if it is ringing. Maybe somebody else has an idea...
    2561 x 1199 - 124K
  • kwinnkwinn Posts: 8,697
    Perhaps a microphone and an opamp would be a better choice for detecting a phone ring. Should work for a cell phone and POTS phone with no need to connect the phone to the stamp.
  • This is grate. Yes someone has a switch that will work. Let me load this and get back to you.
    Thanks a lot
    David
  • 72sonett72sonett Posts: 82
    edited 2018-03-25 19:25
    Maybe a Parallax sound impact sensor in the box so it will only pick up sound from the ringing telephone.

    29132.png?itok=i8y1_IQP
  • ddsparallaxddsparallax Posts: 3
    edited 2018-04-12 04:31
    I am currently testing, thanks for the help. Much appreciated.
    David
  • How is it going?
    In the earlier schematic I forgot the 220 ohm resistors on the IN ports of the BS
Sign In or Register to comment.