Forum Update - Announcement about May 10th, 2018 update and your password.

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

  • 6 Comments sorted by Date Added Votes
  • 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.
    __Walt McDonald__

    The Truth is out there
    It's not rocket-surgery
    I see why we don't have any water,All of the pipes are full of wires!
    E=WMc2
    Now with WiFi
    Not in the Spin Bunch
    import RPi.GPIO as GPIO

    ABB M202 certified
    ABB M211 certified
  • 72sonett72sonett Posts: 80
    edited March 24 Vote Up0Vote Down
    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
    --
    MH
    BS2Sx
  • 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.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • 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: 80
    edited March 25 Vote Up0Vote Down
    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
    --
    MH
    BS2Sx
  • ddsparallaxddsparallax Posts: 3
    edited April 12 Vote Up0Vote Down
    I am currently testing, thanks for the help. Much appreciated.
    David
Sign In or Register to comment.