Intergrating A Tv Bed Lift Mechanism

Kyle,

As to the difficulty level, it really depends on your experience. I believe most of the “heavy lifting” is already done. I am happy to assist you in using my ST_Anything library and ST_Anything_RCSwitch.ino example sketch. What I really have a harder time helping with is the specifics of the RF Arduino code. I simply used the RCSwitch library when I was helping @keithcroshaw to try and integrate some RF devices into SmartThings. Keith supplied me with the RF codes he successfully “snooped” to put into my Arduino sketch. I believed he used a sample application to capture these RF code sequences using one of the inexpensive RF receivers for the Arduino. I designed the ST_RCSwitch library class to allow users to supply whatever RF code they want for the “on” command as well as for the “off” command. These codes are entered into the Arduino Sketch (.ino file) not in the library. I am trying to keep the library calls as generic and reusable as possible.

Here is the line of code which would have to be changed in the ST_Anything_RCSwitch.ino sketch based on your specific Up/On and Down/Off RF codes:

 static st::EX_RCSwitch executor1(F("rcswitch1"), PIN_RCSWITCH, 35754004, 26, 18976788, 26); 

And here is what each field in the above call means (from the header of the EX_RCSwitch.cpp file):

st::EX_RCSwitch() constructor requires the following arguments
 - String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
 - byte transmitterPin - REQUIRED - the Arduino Pinused as a digital output for the RCSwitch object's transmitter pin
 - unsigned long onCode - REQUIRED - the "on" code for RCSwitch send() command
 - unsigned int onLength - REQUIRED - the "on" code's length for RCSwitch send() command
- unsigned long offCode - REQUIRED - the "off" code for RCSwitch send() command
- unsigned int offLength - REQUIRED - the "off" code's length for RCSwitch send() command
- bool startingState - OPTIONAL - the value desired for the initial state of the switch.  LOW = "off", HIGH = "on"

If you can get the TV motor moving using just an Arduino UNO R3 and the RF Transmitter, I can help you get it seamlessly incorporated into SmartThings (assuming you can get a hold of a ThingShield, as they’ve been out of stock for a while. More due in within a week or so, according to @mager )

Before you start buying components, the big question is whether or not your RF remote control can be emulated by one of the inexpensive RF Tx/Rx module pairs. You’ll first need to know what frequency your remote control operates at. I have seen 433Mhz as well as 315Mhz Rceiver/Transmitter pairs which can be had for under $10 on Amazon.com. Even cheaper on ebay if you have time to wait for delivery from China (usually about 10-14 days.)

If your remote control operates at a different RF frequency, I am not sure what your options are.

Note: If you can get the RF Transmitter attached to an Arduino working, I may have another incredibly inexpensive way for you to create the entire solution for under ~$30. You could tear apart a $15 Cree lightbulb to get its Zigbee board, buy a $5 Arduino Nano on Ebay, and a $5 RF Tx/Rx pair of modules from ebay.

Take a look at my example of a super inexpensive way of using the Cree Bulb’s Zigbee board to allow one-way ST Integration at:

Since you’re just sending data to the TV Motor Controller (i.e. simulating a remote control) there is really no reason for any two-way feedback back to the ST Cloud. The Cree Bulb Arduino code that I wrote would permit you to send up to 100 unique RF commands. By setting the DIM Level in the ST App, the Zigbee board sends a corresponding PWM signal to the Arduino, which in turn is deciphered into the dim level and executes corresponding code. You could assign DIm Level 1 to your UP command and Dim Level 2 to your down command.

Just another idea! More food for thought!

Also, you could use my Cree bulb hack/solution to fire a relay if desired, instead of sending RF signals. The Arduino would simply see the Dim Level change to “1” and then turn on a digital output (which is connected to a relay) for a pre-determined amount of time or until a digital input changes state (i.e. a limit switch.) When the Dim Level changed to a “2”, a different relay could be fired. If the Dim Level was set to “0” all motion could be stopped by turning off both relays.

You’ve got a fun project! Enjoy it!

Dan

1 Like