Hi,
For a while ago my wife asked me to integrate a TV into a small cabinet/commode (not sure what word to use). I’m using a standard TS-700A lift for lifting the TV up and down.
I didn’t like how they solve the integration by simply using a big hinged lid that stay up as long as the TV is visible. Like you can see in this video:
Or having the lid on top of the TV like this one:
So I got an idea of using a 645MG servo to slide the whole top plate forward and back under the TV. Also using a small HS-322 servo for moving the little hatch that cover the tvlift. For controlling the servos I’m using a BB2 with a BAP24. I added two micro-switches for knowing when the TV is in position. I’m also using a switch that is serial connected with the TV-lift motor, the switch is enabled when the top plate is completely open.
I’m still not finished renovating the cabinet/commode. The doors are not mounted and it need some painting ++. But this video gives you a demo of how it works.
The video is unlisted.
My little son (soon to be 11 months) almost got hit by the top plate…
Pardon for some norwegian speech. Didn’t plan to post this low quality cell-phone video. I’ll make a better official youtube video using a better camera when its finished.
The code is very simple. I’m using the simple SERVO command. Using analog servos is recommended when you don’t want to have them powered all the time. They loose the torque if they doesn’t get the pwm signal.
The complete code looks like this: (Could probably be made even more simple, I guess…)
[code];*****************************************************************************
;******************** Kommode project, TV lift *******************************
;*****************************************************************************
;Hacked TS-700A with a top sliding plate controlled using a Atom Pro 24 on BB2
;Written by Kåre Halvorsen aka Zenta
;21. October 2011
;Ver 1.0
;
;________________________________
;Define ports:
HingeServoPin con P0
PlateServoPin con P1
UppCmdPin con P4
DownCmdPin con P5
UpperSwitchPin con P8
LowerSwitchPin con P11
LedA con P12 ;red Led
LedB con P13 ;green Led
LedC con P14 ;yellow Led
SpeakerPin con P9
;________________________________
;Constants
OpenPlatePos con 2000
ClosePlatePos con -1900
OpenHingePos con -1200
CloseHingePos con 850
;________________________________
;Variables
UppCommand var bit
DownCommand var bit
UpperSwitch var bit
LowerSwitch var bit
PlateServoPos var sword
HingeServoPos var sword
TopPlateIsOpen var bit ; Set to 1 if the top plate is closed, set to 0 if open
;Init:
Pause 10
DIR4 = 0
DIR5 = 0
DIR8 = 0
DIR11 = 0
high LedB
high LedC
low LedA
Sound SpeakerPin,[100\2000]
pause 300
low LedB
Sound SpeakerPin,[100\3000]
pause 300
low LedC
Sound SpeakerPin,[100\4000]
pause 300
high LedA
high LedB
high LedC
TopPlateIsOpen = 0 ;I assume that the top plate is closed at startup
;===============================================================
;Main loop
;===============================================================
main:
GOSUB ReadInputs
IF (TopPlateIsOpen = 1) AND ((LowerSwitch = 1)OR(UpperSwitch = 1)) THEN
GOSUB CloseTopPlate
ENDIF
GOSUB ReadInputs
IF ((UppCommand = 1) AND (LowerSwitch = 1)) OR ((DownCommand = 1) AND (UpperSwitch = 1)) THEN
GOSUB OpenTopPlate
ENDIF
goto main
;===============================================================
ReadInputs:
Input UppCmdPin
Input DownCmdPin
Input UpperSwitchPin
input LowerSwitchPin
UppCommand = IN4
DownCommand = IN5
UpperSwitch = IN8
LowerSwitch = IN11
;Update LED status
IF UpperSwitch = 1 Then
Low LedA
ELSE
high LedA
ENDIF
IF LowerSwitch = 1 Then
low LedB
ELSE
high LedB
ENDIF
IF ((UppCommand = 1) OR (DownCommand = 1))Then
low LedC
ELSE
high LedC
ENDIF
return
;-------------------------------------------------------------
;Use the simple servo command since I don’t want the servo to hold the position forever. Use analog servos!
OpenTopPlate:
IF (LowerSwitch = 1) THEN ;We want to open the little hatch before sliding the top plate
for HingeServoPos = CloseHingePos to OpenHingePos step -50
servo HingeServoPin,HingeServoPos,0
pause 17
next
ENDIF
for PlateServoPos = ClosePlatePos to OpenPlatePos step 30
servo PlateServoPin,PlateServoPos,0
pause 17
next
Sound SpeakerPin,[50\2000]
TopPlateIsOpen = 1
pause 3000 ;take long brake so that the lift can get a chance to lower TV
return
;-------------------------------------------------------------
CloseTopPlate:
for PlateServoPos = OpenPlatePos to ClosePlatePos step -30
servo PlateServoPin,PlateServoPos,0
pause 17
next
TopPlateIsOpen = 0
IF (LowerSwitch = 1) THEN ;We want to close the little hatch after sliding the top plate
for HingeServoPos = OpenHingePos to CloseHingePos step 20
servo HingeServoPin,HingeServoPos,0
pause 17
next
servo HingeServoPin,HingeServoPos,50 ;Hold the position for 1 sec
ENDIF
return
;-------------------------------------------------------------
[/code]
I hope it was ok that I posted it here, even if it isn’t a robot…