TV Bed Photon Control

Morning everyone first post here & thanks for reading.

I have purchase a Photon wifi development board with the intention of getting it to control my tv bed motor. This device is controlled by RF on either 315-433hmz and support two commands, up/down. Is it possible to add a RF transceiver to the development board and have it learn the signal/command?

I have got advice about connecting the device directly up to the control board, but this is something I would not be comfortable with as if messed up it cannot be replaced.

Any help or advice is greatly appreciated.

Yes, there are some threads abour RF and 433 around - but AFAIK mostly about serial wire replacement.
So knowing what protocol/command your device needs these might or might not help.

But I’d also go for the local approach. Has your device no input for an ext switch or such?
Have you got a link to know what thing we are talkning about?

1 Like

The remote board.

This is the main board.

Ideally I want my photon to replace the remote control. I have ordered a 433mhz transmitter and receiver from amazon. As far as I am aware I can learn the remote codes through the photon and receiver and then set the transmitter to send thesee codes.

Lastly Imy looking to get this addessay into my current smartthings setup.

It looks as if this daughter board was detachable, which would allow you to add a custom board instead without doing any permanent harm to the whole thing and with the Photon on this daughter board you then have got rid of the remote at the same time and since the Photon will be talking to your WiFi you are also ready to integrate into any smart home that can talk to the Photon.

Another route would be the two DIN sockets to which you could attach a Photon based contraption.

1 Like

Are the DIN sockets those two large circle connectors where one of the leads connects to lift motor?

I’m not great with electrical hardware as you might has guessed.

Yup, and AFAIK the other would take a wired control unit - which is only some sort of fancy buttons and maybe some logic if you get an “interactive” control unit with display to show height and error codes.

1 Like

What you want to do should be very do-able. Our own @wgbartley did a [write up] (https://www.hackster.io/wgbartley/particle-internet-button-434-mhz-remote-6ea62a) on something similar

2 Likes

This is pretty much it.
I have ordered the following.
Particle photon WiFi development kit
433mhz transmitter and receiver. Two separate chips.

This should be all the hardware I need to emulate this?

I don’t think we have a write up anywhere on how to detect and clone the signal using just a Photon. Garrett used a couple of extra pieces of hardware to decode the signal and then encoded it into his Photon firmware. If you want to try without that hardware feel free; keep us posted on the progress.

That’s all the hardware you need to emulate. You may be able to sniff the RF with the receiver and manually decode it using only the Photon. If that proves to be too difficult, I would recommend an SDR (software defined radio) like this one. At $21, it’s not a bad price and definitely worth the investment just for what you can learn and do with it. If you’re interested in going down that road, check out http://www.rtl-sdr.org as well.

One of these days, I’ll set aside the time to play with the transceivers @harrisonhjones sent me! :wink:

Afternoon Folks, would someone mind having a look at the bottom of this thread,

I Would Like to make my photon and jump between both of these settings via smartthings with a simple one button press.

When Photon On D3 High D0 Low TV bed is down
When Photon On D3 Low D0 High TV bed is up

Is there an way to make it a single button press to jump between these settings?

From what I can see I need to get the photon to do the following

As default pins D0 (Up pin) and D3(Down pin) need to default at “low”
In my head I press the On button in Smartthings. This tells the photon to set D0 as High for 15 seconds to put the TV to the perfect position. After 15 seconds it reverts D0 to Low and leaves the TV in position.

When I press the Off button in Smartthings, Photon changes D3 from Low to High for 20 seconds to put the TV down. After 15 seconds it reverts D3 to Low .

I am not sure how to make any of this happen due to 0 coding experience. Any help would be greatly appreciated.

I see you have opted for my proposal to “skip” the RF module for now (IMHO :+1: a good choice :wink: )

On the smartthings site, I see you using the Tinker App, but this app is not quite kitted out for momentary switch applications, but on the firmware side something like this would be easy.
If you want to test my own Particle.functions() before writing a dedicated app, I quite like these two sites
http://suda.github.io/particle-web-interface/
http://jordymoors.nl/interface/

But on the firmware side you could do something like this

const int pinUP       = D0;
const int pinDOWN     = D3;
const uint32_t msUP   = 15000;
const uint32_t msDOWN = 20000;


uint32_t msToMove;                         // milliseconds to keep moving
uint32_t msMoveStarted;                    // started moving at this time
void setup()
{
  pinMode(pinUP  , OUTPUT);
  pinMode(pinDOWN, OUTPUT);

  Particle.function("UP"  , startUp);      // just for ease of use two seperate functions
  Particle.function("DOWN", startDown);    // could be incorporated into one with param
}

void loop()
{
  if (msToMove > 0 && millis() - msMoveStarted > msToMove)
  { // stop all motion after set time
    digitalWrite(pinUP  , LOW);
    digitalWrite(pinDOWN, LOW);
    msToMove =                           // reset flags for next round
    msMoveStarted = 0;
  }
}

int startUp(String param)
{
  digitalWrite(pinDOWN, LOW);            // stop any down motion (just in case)
  digitalWrite(pinUP  , HIGH);           // start moving up
  msToMove = msUP;                       // for set up time
  msMoveStarted = millis();              // count from now
  return msToMove;
}

int startDown(String param)
{
  digitalWrite(pinUP  , LOW);            // stop any up motion (just in case)
  digitalWrite(pinDOWN, HIGH);           // start moving down
  msToMove = msDOWN;                     // for set down time
  msMoveStarted = millis();              // count from now
  return msToMove;
}
2 Likes

I did a factory reset on my photon last night and uncalimed it from the build website. When I try to pair it via the android app I get the following error.
“please try running setup again after resetting you Photon and putting it back in the blinking blue listen mode if needed”

Dark blue light is blinking but it will not pair at all. I am struggling to flash it VIA USB.

If you want to flash via USB you can try DFU Mode particle flash --usb firmware.bin or
in Listening Mode particle flash --serial firmware.bin

There is no factory reset on Photon. What exactly did you do? Have you just cleared the credentials?
If you have CLI you’d do paricle serial wifi or with a serial monitor (e.g. PuTTY) you’d just hit w and follow the instructions.

1 Like

Firstly I unpaired it from the build website last night. I then Held the Setup button for 3 seconds to get it in the discover state.

Smartphone app can see it go but will not pair.

Windows PC device manager can see the Photon. libusbK USB Devices > Photon DFU Mode

I pasted the following into cmd with no success:
particle flash --usb firmware.bin
particle flash --serial firmware.bin

‘particle’ is not recognized as an internal or external command,
operable program or batch file.

Have you not installed CLI?
If you already got node, just execute npm install -g particle-cli.
If not try this installer

1 Like

C:\Users\Admin>npm install -g particle-cli
’CALL “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” prefix -g’ is not recognized as an internal or external command,
operable program or batch file.
/

serialport@2.0.6 install C:\Users\Admin\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport
node-pre-gyp install --fallback-to-build

npm ERR! Windows_NT 10.0.10240
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install” “-g” "particle-cli"
npm ERR! node v4.4.2
npm ERR! npm v2.15.0
npm ERR! file C:\program files\misc
npm ERR! path C:\program files\misc
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\program files\misc

npm ERR! serialport@2.0.6 install: node-pre-gyp install --fallback-to-build
npm ERR! spawn C:\program files\misc ENOENT
npm ERR!
npm ERR! Failed at the serialport@2.0.6 install script ‘node-pre-gyp install --fallback-to-build’.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs serialport
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR!
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Admin\npm-debug.log

installed that .exe. I am guessing I am installing that libusbK (v3.0.7.0)?

try npm install -g serialport before this then - or even better try the installer.

BTW: Your Windows build looks old too :wink:

1 Like

I noticed the nodeJS folder is empty on this particle installer. Does that sound about right?