light switch rf control

Hello everyone, I'm new in the area and having trouble getting the code to work.
I bought this switch:
http://www.ebay.com/itm/AC-220V-1-Channel-RF-Wireless-Remote-Home-wall-light-Control-Switch-86-Type-/171122633504?pt=Home_Automation_Controls_Touchscreens&hash=item27d7b42b20

And i`m trying to use my arduino to turn on/off this switch, using
http://www.ebay.com/itm/433Mhz-WL-RF-Transmitter-Receiver-Module-Link-Kit-for-Arduino-ARM-MCU-Wireless-/380717845396?pt=LH_DefaultDomain_0&hash=item58a48d4b94

All code I saw online and the examples on the software itself, did not work unfortunately.
I'd appreciate some guidance

Thanks

ok
Got this from my receiver but could not use it :frowning:

Decimal: 5592405 (24Bit) Binary: 010101010101010101010101 Tri-State: FFFFFFFFFFFF PulseLength: 510 microseconds Protocol: 1
Raw data: 15816,468,1560,1472,544,464,1564,1468,552,460,1568,1464,556,460,1568,1464,548,460,1572,1464,552,460,1568,1464,552,460,1572,1460,556,456,1572,1460,556,456,1576,1460,556,452,1572,544,32,196,12,312,40,52,16,36,180,

Decimal: 5592405 (24Bit) Binary: 010101010101010101010101 Tri-State: FFFFFFFFFFFF PulseLength: 509 microseconds Protocol: 1
Raw data: 15816,468,1560,1472,544,468,1560,1472,544,468,1564,1472,544,464,1564,1472,544,468,1564,1468,548,464,1564,1472,544,468,1564,1472,544,464,1568,1464,548,468,1564,1468,548,464,1568,1468,548,464,1564,12,660,16,36,72,716,

Exactly how did you try to use this code?

spch:
Exactly how did you try to use this code?

At first I tried to use with arduino software sample (RCswitch),
And then I tried to find an example online.
But to be honest I do not really know what I'm doing :frowning:

Thank you

You see, it really looks like switch that could be controlled by RC-Switch library. I guess that is what you've used to get switch code (5592405).

You can try it with the following code:

/*
  Example for 
  
  http://code.google.com/p/rc-switch/
  
  Need help? http://forum.ardumote.com
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

 
  // Transmitter is connected to Arduino Pin #10  
  mySwitch.enableTransmit(10);

}

void loop() {

  /* Same switch as above, but using decimal code */
  mySwitch.send(5592405, 24); // turn in on (off)
  delay(3000);  // pause for 3 seconds
  mySwitch.send(5592405, 24); // turn it off (on)

  delay(10000); // pause for 10 seconds
}

This should turn your switch on (or off, depending on its initial state), turn in off (on) after 3 seconds, wait 10 seconds and repeat it all again.

Transmitter data pin should be connected to Arduino pin #10, GND to Arduino GND, VCC to Arduino 5V or Vin. Generally 5V is enough. Don't forget to solder antenna (about 165 mm of single or multicore wire) to ANT terminal of transmitter. Missing antenna significantly reduces TX range, wich could be the reason why your switch was not working with Arduino.

You can also open remote control and check encoder chip type. This can give you clue for searching the right control library (if it exists).

Sincerely,
Sergey.

spch:
You see, it really looks like switch that could be controlled by RC-Switch library. I guess that is what you've used to get switch code (5592405).

You can try it with the following code:

/*

Example for
 
  GitHub - sui77/rc-switch: Arduino lib to operate 433/315Mhz devices like power outlet sockets.
 
  Need help? http://forum.ardumote.com
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

// Transmitter is connected to Arduino Pin #10 
  mySwitch.enableTransmit(10);

}

void loop() {

/* Same switch as above, but using decimal code */
  mySwitch.send(5592405, 24); // turn in on (off)
  delay(3000);  // pause for 3 seconds
  mySwitch.send(5592405, 24); // turn it off (on)

delay(10000); // pause for 10 seconds
}




This should turn your switch on (or off, depending on its initial state), turn in off (on) after 3 seconds, wait 10 seconds and repeat it all again.

Transmitter data pin should be connected to Arduino pin #10, GND to Arduino GND, VCC to Arduino 5V or Vin. Generally 5V is enough. Don't forget to solder antenna (about 165 mm of single or multicore wire) to ANT terminal of transmitter. Missing antenna significantly reduces TX range, wich could be the reason why your switch was not working with Arduino.

You can also open remote control and check encoder chip type. This can give you clue for searching the right control library (if it exists).

Sincerely,
Sergey.

Thank you very much,
I'm really at a loss .. I did exactly what you said and it still does not work

I thing you put a wire 17cm for antenna . Also what is the distanse you try to send (Arduino Tx Modula to Wall switch) ?

And the Wall switch it is also 433Mhz like the pair rf modules you get ?

And in arduino you connect the Tx module pin to Arduino Pin #10 i hope.

tasosstr:
I thing you put a wire 17cm for antenna . Also what is the distanse you try to send (Arduino Tx Modula to Wall switch) ?

And the Wall switch it is also 433Mhz like the pair rf modules you get ?

And in arduino you connect the Tx module pin to Arduino Pin #10 i hope.

OK, I tried to extend the antenna.
Regarding the distance, I even tried to put it in front of the switch.

working frequency of the switch is 433 MHZ.

And of course I connected it in the right place.

Thank you

The RF can make you crazy ... :0

I have meet in past crazy things about it :0

Try a min distance of 50 Cm .

I thing also you use this GitHub - sui77/rc-switch: Arduino lib to operate 433/315Mhz devices like power outlet sockets.

So if the code you have decode from the remote it is correct then try to send more than one time maybe need 2 or 3 or more with a delay of 300.

Then if you have another arduino board it is good to connect the receiver there and check if the arduino with the Tx Module send the same message.

Good Luck :wink:

The rc switch library relies on the remote being controlled having a Sc2272 or similar decoder chip inside it.
Whilst this chip is pretty common, its not universal.
You may have to pull the remote switch apart to see what it uses.

tasosstr:
The RF can make you crazy ... :0

I have meet in past crazy things about it :0

Try a min distance of 50 Cm .

I thing also you use this GitHub - sui77/rc-switch: Arduino lib to operate 433/315Mhz devices like power outlet sockets.

So if the code you have decode from the remote it is correct then try to send more than one time maybe need 2 or 3 or more with a delay of 300.

Then if you have another arduino board it is good to connect the receiver there and check if the arduino with the Tx Module send the same message.

Good Luck :wink:

Thank you ... I tried, unfortunately, still no response from the switch

mauried:
The rc switch library relies on the remote being controlled having a Sc2272 or similar decoder chip inside it.
Whilst this chip is pretty common, its not universal.
You may have to pull the remote switch apart to see what it uses.

I took apart the switch, the chip says "BX R315A"

Arduino chip says "JDQ R433A"

Does that help somehow? How do I proceed from here?

Thank you all

Well, I guess I'm just stupid.
Probably this is what I need:
http://www.ebay.com/itm/400572503417?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

I am not i agree with you here "Well, I guess I'm just stupid." Every day you learn something new :wink: No one born to know everything :slight_smile:

For this "Probably this is what I need:
http://www.ebay.com/itm/400572503417?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649"

I agree :wink:

Have a nice time and good programming codes ... :slight_smile:

Try this sketch:
If it doesn't work, try changing DELAYSHORT to 510

// Connection:
// Vcc -> Arduino +5V
// Gnd -> Arduino GND
// Data-> Arduino D10
// ANT -> a short wire

int sendPin = 10;

// #define DELAYSHORT 510
#define DELAYSHORT 160
#define DELAYLONG 500

static void ookPulse(int on, int off) {
digitalWrite(sendPin, HIGH);
delayMicroseconds(on);
digitalWrite(sendPin, LOW);
delayMicroseconds(off);
}

static void pt2262Send(uint16_t signature, uint8_t command) {
byte i, k;
// send 16 times
for(k=0;k<16;k++) {
// send signature first
for(i=0;i<16;i++) {
if((signature>>(15-i)) & 0x1) {
ookPulse(DELAYLONG, DELAYSHORT);
} else {
ookPulse(DELAYSHORT, DELAYLONG);
}
}
for(i=0;i<8;i++) {
if((command>>(7-i)) & 0x1) {
ookPulse(DELAYLONG, DELAYSHORT);
} else {
ookPulse(DELAYSHORT, DELAYLONG);
}
}

// end with a '0'
ookPulse(DELAYSHORT, DELAYLONG);

// short delay
delay(5);
}
}

void setup() {
pinMode(sendPin, OUTPUT);

}

void loop() {
// take the first 16 bits(marked 'z')and the remaining 8 bits(marked 'y') of the "Binary:" value from the sniffer results and place as follows:
// pt2262Send(0bzzzzzzzzzzzzzzz, 0byyyyyyyy);

pt2262Send(0b0101010101010101, 0b01010101);

delay(5000);
}

@sp_mike Hello friend thanks for the code, but the friend has problem on hardware, difference frequency 433Mhz on Arduino and 315A on switch, that's why. :wink:

Thanks for letting me know. Sorry that I couldn't help.

@sp_mike It is nice you're help my friend thank you :wink:

Sometimes we read quickly the post and don't get all the details (include and me :slight_smile: ) this is logic when we don't have enough time :wink:

Have a nice programming :slight_smile:

OOPS
Check that the switch use 433Mhz. May be it is not the same with your transmitter 433Mhz.
In the Switch specification :
working frequency: 315 MHZ 433 MHZ 430 MHZ 303 MHZ
When you order, you must specify the exact frequency that meet to your transmitter.