Best practice for switching an RF remote?

Hi everyone,

A very simple question, I hope, but one that is perhaps a matter of opinion so I’ve not found a definitive answer by myself!

I have some LED lighting that is controlled by an RF remote. I want to incorporate it into my ‘smart home’ setup but RF remotes appear to be tricky in that sense. Hence, disassembling the remote seemed to be the easiest route. It ran off a 3V LR2302 and I thought the photon would be a good way of both powering the board and ‘pushing’ the buttons.

I’ve identified the appropriate vias in the pcb and provided power. Basically everything works fine and I can control my lights just by completing the circuit between the two vias.

The question is what is the best way to do this with the photon? With a BJT? Or is it better to use an optocoupler and keep things separate? Or perhaps there’s an even simpler way!?

Thanks

Do the contacts close to GND or to 3V?
Have you tried power the device off 3.3V already and it doesn’t mind?

If the answer to the second is yes, you could go the least effort way (which isn’t best practice tho’) and directly drive the contacts HIGH or LOW (with a 100Ω series resistor - if even needed) and then change pinMode() back to INPUT to go hi-Z again.

Hi @DGJC

The advice from @ScruffR is great and if your remote switches the inputs to +V or GND, you have an easy path.

If, however, the remote uses a scanned keyboard where columns of switches are enabled and then common rows are the inputs, you can still make it work. It will be easy to tell if your switches are scanned if you have a scope.

The “trick” to replacing a switch in this case is a little part called a CMOS transmission gate or bilateral switch. It is a device like a switch in that current can flow from input to output when the control is enabled, and the nice thing is that it doesn’t really care what is on the input/output as long it is within the voltage specs. Here is the data sheet for a quad device:

http://www.ti.com/lit/ds/symlink/cd4066b.pdf

1 Like

Hi, your scenario reminds me of what this guy did with his garage remote control, in line with what Scruffr mentioned above:

1 Like

Gentlemen,

All excellent advice and very helpful! Sorry for the painfully late reply, work took me away and separated me from my project for a couple of months.

I took the suggested (quad) bilateral switch route and have it all up and running - it replicates the button push for the four most useful buttons on the original RF remote. Everything works perfectly.

To extend the functionality I roped in google assistant and declared a couple of particle functions. One is a simple on/off and it functions as expected. The second takes an argument (IFTTT call function with text ingredient) and chooses one of the three remaining buttons (for light level). The function works as expected with all the defined options when I call it from the console. However, it doesn’t work via IFTTT. IFTTT lists the function when I setup the applet but google assistant doesn’t recognise the trigger. I’ve tried changing the trigger to very random things in case there’s some conflict but it still doesn’t work. Which makes me unsure of where the problem lies. I feel unsure about particle.function using int and not string so maybe I’ve got horribly confused somewhere. Though I would have thought would cause it to fail in the console too. Does anyone have any experience of troubleshooting these things? Any advice or pointers would be gratefully received.

Thanks as ever


int ledpower = D1;
int ledboard = D7;
int led100 = D2;
int led50 = D3;
int led25 = D4;
int toggle (String toggle);
int lightPercent (String command);

void setup() {


  pinMode(ledpower, OUTPUT);
  pinMode(ledboard, OUTPUT);
  pinMode(led100, OUTPUT);
  pinMode(led50, OUTPUT);
  pinMode(led25, OUTPUT);
  Particle.function("KitchenLight", toggle);
  Particle.function("LightLevel", lightPercent);

};


void loop() {
};

int toggle (String KitchenLight) {
    digitalWrite(ledpower, HIGH);
    digitalWrite(ledboard, HIGH);

    delay(120);

    digitalWrite(ledpower, LOW);
    digitalWrite(ledboard, LOW);

    Particle.publish("Kitchen Lights", "On");
};

int lightPercent (String command) {
    if(command == "100%"||command == "Max"||command == "Full") {
    digitalWrite(led100, HIGH);
    digitalWrite(ledboard, HIGH);
    
    delay(120);

    digitalWrite(led100, LOW);
    digitalWrite(ledboard, LOW);
    
    Particle.publish("Kitchen Lights", "Full");
    return 1;
    }
    else if(command == "50%"||command == "Half") {
    digitalWrite(led50, HIGH);
    digitalWrite(ledboard, HIGH);
    
    delay(120);

    digitalWrite(led50, LOW);
    digitalWrite(ledboard, LOW);
    
    Particle.publish("Kitchen Lights", "Half");
    return 1;
    }
    else if(command == "25%"||command == "Low") {
    digitalWrite(led25, HIGH);
    digitalWrite(ledboard, HIGH);
    
    delay(120);

    digitalWrite(led25, LOW);
    digitalWrite(ledboard, LOW);
    
    Particle.publish("Kitchen Lights", "Low");
    return 1;
    }
    else return -1;

};