Controlling Blinds.com RF Dooya Motors with Arduino and Vera
-
Awesome work!
Is three anyway to copy a ROLLING code?
-
Awesome work!
Is three anyway to copy a ROLLING code?
-
@C.r.a.z.y. Not sure but I'm guessing it wouldn't be as easy as this since it is used for security. I would guess there is some key that it uses to generate the codes and you would need to figure that out. All just guesses though.
This post is deleted! -
433mhz-outlet
please check this ; -
Here is the updated code for 1.4 if anyone needs it...
https://codebender.cc/sketch:67780great to see the update... gives me another thing to do!
-
Here is the updated code for 1.4 if anyone needs it...
https://codebender.cc/sketch:67780@petewill Thank you Pete. I tried this code and found 9 devices. I changed 433 codes but didnt work.
Before mySensors how can i test the 433 code if it works or not?
Are these settings correct?
1101010101011100000000110
1101010101011100000011000define SEND_DATA 3 //Data pin for RF Transmitter
define ZERO_HIGH 270 //Delay for the high part of a 0 in microseconds
define ZERO_LOW 950 //Delay for the low part of a 0 in microseconds
define ONE_HIGH 910 //Delay for the high part of a 1 in microseconds
define ONE_LOW 300//Delay for the low part of a 1 in microsecondsAudocity file : http://1drv.ms/1wmgh2e
-
@C.r.a.z.y. This code is designed specifically for my blinds. You will need to modify it for your outlets based on the pattern of the code that is being sent. I took a look at your audacity file but I'm not exactly sure what I'm looking at. Did you press the On button 3 times then the Off button 3 times?
As far as testing, what I did was just start with one command (On or Off in your case) and put it all in the loop function. Just put it an if statement so it only executes once. It will execute once when you plug in the arduino. Then you can get it sending the right codes correctly and not worry about the Vera setup. -
@C.r.a.z.y. Also, I forgot to mention this in my post above but you may want to consider making outlets with HEKs sketch. That's what I ended up doing because then I could see the status. With the RF stuff you can only send a signal but you don't get an acknowledgment as to if it worked or not.
EDIT: I made my own outlets using HEKs relay sketch. That's how I see the status. I didn't end up using RF for outlets although I had originally planned to. I realized I wasn't very clear in my post above.
-
@C.r.a.z.y. Also, I forgot to mention this in my post above but you may want to consider making outlets with HEKs sketch. That's what I ended up doing because then I could see the status. With the RF stuff you can only send a signal but you don't get an acknowledgment as to if it worked or not.
EDIT: I made my own outlets using HEKs relay sketch. That's how I see the status. I didn't end up using RF for outlets although I had originally planned to. I realized I wasn't very clear in my post above.
@petewill thank you Pete. I will try to modify at least i will sent rf code. Yes audocity file pressed 3 times on + 3 times off..
-
I think these are not the same with youtube video?
define SEND_DATA 3 //Data pin for RF Transmitter
define ZERO_HIGH 270 //Delay for the high part of a 0 in microseconds
define ZERO_LOW 950 //Delay for the low part of a 0 in microseconds
define ONE_HIGH 910 //Delay for the high part of a 1 in microseconds
define ONE_LOW 300//Delay for the low part of a 1 in microsecondsI read one of my remote with RC-Switch but other remote didnt work with RC-Switch.
Your method is more general because RC-Switch only reads some kind of chipsets... SC5262 / SC5272, HX2262 / HX2272, PT2262 / PT2272, EV1527, RT1527, FP1527 or HS1527
How can i convert this data to 32bit?
1101 0101 0101 1100 0000 0011 0first 4 bits 0000 in your sketch + 25 bits from my remote = 29 bits
-
@C.r.a.z.y. I am doing my best to understand but I think I'm still missing something. Basically what you want to do is to reproduce the pattern you recorded in Audacity. I did this somewhat crudely with blindAction function (someone smarter than me could code it much better but it works). You will need to modify (and probably rename) this function to meet your needs. In this function I call other functions (fourBits and eightBits) to actually send the RF signal out. I would start with these methods to get your timings right. You can then record what you send out in Audacity and compare. After you have got this working with one command you can work on interfacing it with Vera. I hope that helps a little.
-
@C.r.a.z.y. I am doing my best to understand but I think I'm still missing something. Basically what you want to do is to reproduce the pattern you recorded in Audacity. I did this somewhat crudely with blindAction function (someone smarter than me could code it much better but it works). You will need to modify (and probably rename) this function to meet your needs. In this function I call other functions (fourBits and eightBits) to actually send the RF signal out. I would start with these methods to get your timings right. You can then record what you send out in Audacity and compare. After you have got this working with one command you can work on interfacing it with Vera. I hope that helps a little.
@petewill Thank you i know you are very helpful. I tried to copy my remote to an universal remote learner(which has no name chipset) but it didnt copy. It is hard to understand and solve for a newbie.
I simply tried to send 10101010codes with this sketch https://code.google.com/p/rc-switch/wiki/HowTo_Send?tm=6 and didnt work.
Something interesting i found while tranmitting,
If i remove the delay () than signal is always sent. I made a jammer! :) Any of my 433 remotes didnt work!I want to learn if any universal remote learner with EV1527 Chipset works with RCSwitch?
My plan is to copy some remote codes to EV1527 universal remote and read the code from serial with RCSwitch-rfSniffer.Now i will try IR SENDER-RECEIVER http://www.mysensors.org/build/ir maybe i can get new ideas for 433mhz things..
-
@C.r.a.z.y. Yeah, I couldn't get the automatic "sniffers" to work for me either. Hopefully you're able to get it working. Remember, just focus on sending the 1's and 0's pattern. Start your code with that then expand when you get that part working. One thing that may help is to record what you're sending in Audacity again. That way you can compare the waveforms and see what needs to be modified with the code.
-
@C.r.a.z.y. Yeah, I couldn't get the automatic "sniffers" to work for me either. Hopefully you're able to get it working. Remember, just focus on sending the 1's and 0's pattern. Start your code with that then expand when you get that part working. One thing that may help is to record what you're sending in Audacity again. That way you can compare the waveforms and see what needs to be modified with the code.
@petewill Comparing is great idea thanks i will try this!
-
@petewill Comparing is great idea thanks i will try this!
@C.r.a.z.y. You have probably already figured out a solution but I finally was able to make a video of my MySensors "Smart Plug". Here is the link: http://forum.mysensors.org/topic/775/8-lamp-outlet-smart-plug-module
Just another way of doing what you're trying to do, but this way you will get the status reported instead of just hoping the outlet turned on. -
I'm trying to do the same but my RF code is different. The number of bits is the same. I have first 20 bits witch I can set for remote 1;2;3 but the last 20 bits depands on command.
I delete remote1Bits4, and channel (child_Id) and add eightBits action1;2;3 for up\down\stop But it dont work.
Could you check this code changes, please?Remote 1
1100 01111100 01001000 00110000 0011 01011110 up
1100 01111100 01001000 10100000 0011 01010111 stop
1100 01111100 01001000 10000000 0011 01010100 down
Remote2
0100 01110010 01001000 00110000 0011 01011110 up
0100 01110010 01001000 10100000 0011 01010111 stop
0100 01110010 01001000 10000000 0011 01010100 down
Remote3
1110 00100100 01001000 00110000 0011 11101000 up
1110 00100100 01001000 10100000 0011 11100001 stop
1110 00100100 01001000 10000000 0011 11100011 down/* // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // version 2 as published by the Free Software Foundation. // // DESCRIPTION // This sketch provides a way to control blinds from www.blinds.com using a 433MHz RF // signal. The motors in the blinds are Dooya DV24CE motors. // // Watch a video of everything working together here: https://www.youtube.com/watch?v=EorIqw-9eJw // // The sketch is based on Henrik Ekblad's <henrik.ekblad@gmail.com> MySensors project // (http://www.mysensors.org). Credit also goes to Ray (http://rayshobby.net/?p=3381) // for instruction on how to decode the RF signal from the remote as well as code for // sending the RF signal. // // Developed by Pete B. // // REVISION HISTORY // Version 1.0 - March 19, 2014 - Original Program // Version 1.1 - April 17, 2014 - Added support for multiple remotes that are programmed from blinds.com // Version 1.2 - May 16, 2014 - Added gw.send() to update Vera blinds up/down status // Version 1.3 - Nov 21, 2014 - Upgraded code to work with MySensors v1.4 */ //Include Vera related libraries #include <MySensor.h> #include <SPI.h> #include <EEPROM.h> #include <RF24.h> //Define Constants #define SEND_DATA 3 //Data pin for RF Transmitter #define ZERO_HIGH 395 //Delay for the high part of a 0 in microseconds #define ZERO_LOW 687 //Delay for the low part of a 0 in microseconds #define ONE_HIGH 750 //Delay for the high part of a 1 in microseconds #define ONE_LOW 333//Delay for the low part of a 1 in microseconds //Vera related constants // Set NODE_ID to something unique in your sensor network (1-254) // or set to AUTO if you want gw to assign a NODE_ID for you. #define NODE_ID auto /* //List all your blinds here. These will have to be added as child nodes in setup() //The numbers will be used to assign the different remotes in the remote() method //So, make a note of which blind uses which remote then add it to the if statement //in remote(). This is referred to as the blindNumber in remote(). */ #define NUMBER_OF_BLINDS 3 //Child Node Numbers //Family Room = Node 1, Remote 2, Channel 1 //Kitchen = Node 2, Remote 2, Channel 2 //Dining Room = Node 3, Remote 2, Channel 3 //Kid's Room = Node 4, Remote 1, Channel 1 //Kids's Room = Node 5, Remote 1, Channel 2 //Guest Room = Node 6, Remote 1, Channel 3 //Master Bedroom = Node 7, Remote 1, Channel 4 //Master Closet = Node 8, Remote 1, Channel 5 //Living Room = Node 9, Remote 2, Channel 4 MySensor gw; /* //These 28 standard bits appear at the beginning of each transmit sequence: //0111011100000101010111001011. They are then followed by 12 other //bits depending on the command being sent to the blind. These bits //distinguish between the different remotes. //Because I'm not good at Arduino coding I needed to use someone else's //code to send the bits. They only used 8 bits and I couldn't get any //more to send. Because if this I have broken up the 28 bits into 8 bit //sections. Make sure to put 4 zeros at the beginning of the first //sequence. They will be ignored later in the code. //I added support for multiple remotes so you don't have to reprogram //anything when you buy more blinds. Just add the additional remote codes. */ //Remote One unsigned char remote1Bits1 = 0b00001100; //integer value of the 28 bit standard sequence referenced above. "0b" prefix is for ?? unsigned char remote1Bits2 = 0b01111100; unsigned char remote1Bits3 = 0b01001000; //Remote Two unsigned char remote2Bits1 = 0b00000100; //integer value of the 28 bit standard sequence referenced above. "0b" prefix is for ?? unsigned char remote2Bits2 = 0b01110010; unsigned char remote2Bits3 = 0b01001000; //Remote Three unsigned char remote3Bits1 = 0b00001110; //integer value of the 28 bit standard sequence referenced above. "0b" prefix is for ?? unsigned char remote3Bits2 = 0b00100100; unsigned char remote3Bits3 = 0b01001000; //Remote codes will be put in standardBits with remote() method, depending on which remote is used unsigned char standardBits1 = 0b00000000; unsigned char standardBits2 = 0b00000000; unsigned char standardBits3 = 0b00000000; void setup() { gw.begin(incomingMessage, NODE_ID); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Blind Control", "1.3"); // Register sensors to gw (they will be created as child devices) for (int i = 0; i < NUMBER_OF_BLINDS; i++) { gw.present(i + 1, S_COVER); } } void loop() { gw.process(); } void incomingMessage(const MyMessage &message) { Serial.print("Blind Channel: "); Serial.println(message.sensor); Serial.print("Message Data: "); Serial.println(message.data); Serial.print("Message Type: "); Serial.println(message.type); int incomingBlindData = atoi(message.data); if (message.type == V_STOP) //Stop { //unsigned char i; for(uint8_t i = 0; i < 2; i++) { blindAction(message.sensor, 3); //blindAction(channel, action) action: 1=up, 2=down, 3=stop delay(50); } Serial.println("STOP command"); } else if(incomingBlindData == 100 || message.type == V_UP) //100 = Open/Up { //unsigned char i; for(uint8_t i = 0; i < 2; i++) { blindAction(message.sensor, 1); delay(50); } Serial.println("UP command"); //gw.sendgw.send(message.sensor, V_DIMMER, 100); // Update Vera with status of blinds (up/down) MyMessage blindMsg(message.sensor, V_DIMMER); //may need to assign message.sensor to a variable if this doesn't work gw.send(blindMsg.set(100)); // Update Vera with status of blinds (up/down) } else if (incomingBlindData == 0 || message.type == V_DOWN) //0 = Closed/Down { //unsigned char i; for(uint8_t i = 0; i < 2; i++) { blindAction(message.sensor, 2); delay(50); } Serial.println("DOWN command"); MyMessage blindMsg(message.sensor, V_DIMMER); //may need to assign message.sensor to a variable if this doesn't work //gw.send(message.sensor, V_DIMMER, 0); // Update Vera with status of blinds (up/down) gw.send(blindMsg.set(0)); // Update Vera with status of blinds (up/down) } } void remote(int remoteNum) { if (remoteNum == 1) //Which remote will be used? { standardBits1 = remote1Bits1; //Assign remote specific codes to standardBits variable used throughout the code standardBits2 = remote1Bits2; standardBits3 = remote1Bits3; } else if { standardBits1 = remote2Bits1; //Assign remote specific codes to standardBits variable used throughout the code standardBits2 = remote2Bits2; standardBits3 = remote2Bits3; } else { standardBits1 = remote3Bits1; //Assign remote specific codes to standardBits variable used throughout the code standardBits2 = remote3Bits2; standardBits3 = remote3Bits3; } } void fourBits(unsigned char bits) { unsigned char i; int delayTime; for(i = 0; i < 4; i++) { int highTime; int lowTime; delayTime = ((bits >> (3 - i)) & 1 ? 1 : 0); if (delayTime == 1) { highTime = ONE_HIGH; lowTime = ONE_LOW; } else { highTime = ZERO_HIGH; lowTime = ZERO_LOW; } digitalWrite(SEND_DATA, HIGH); delayMicroseconds(highTime); digitalWrite(SEND_DATA, LOW); delayMicroseconds(lowTime); } } void eightBits(unsigned char bits) { unsigned char k; int delayTime; for(k = 0; k < 8; k++) { int highTime; int lowTime; delayTime = ((bits >> (7 - k)) & 1 ? 1 : 0); if (delayTime == 1) { highTime = ONE_HIGH; lowTime = ONE_LOW; } else { highTime = ZERO_HIGH; lowTime = ZERO_LOW; } digitalWrite(SEND_DATA, HIGH); delayMicroseconds(highTime); digitalWrite(SEND_DATA, LOW); delayMicroseconds(lowTime); } } //Separator Delay Method (this is repeated frequently) void separatorDelay(boolean upDown) { if(upDown == true) { digitalWrite(SEND_DATA, LOW); delayMicroseconds(8020); } digitalWrite(SEND_DATA, HIGH); delayMicroseconds(4812); digitalWrite(SEND_DATA, LOW); delayMicroseconds(1479); } void endDelay() { digitalWrite(SEND_DATA, LOW); delayMicroseconds(51895); //Time of delay at the end of each sequence } void blindAction(int a) { //c or channel: Order on the remote from left to right 1-16 available //a or action: 1=up, 2=down, 3=stop unsigned char action; //8 action bits. Only the first 4 bits are used in the up/down end sequence unsigned char action2; //Last 4 bits from the up/down end sequence unsigned char action3; //Last 4 bits from the up/down end sequence if(a == 1) { action = 0b00110000; //code for up action2 = 0b00110101; action3 = 0b00001110; } else if (a == 2) { action = 0b00010001; //code for down action2 = 0b00001110; action3 = 0b00001110; } else (a == 3) { action = 0b00010001; //code for down action2 = 0b00001110; action3 = 0b00001110; } int i = 0; //first 6 transmissions are the same for each blind action (up, down & stop) while(i < 6) { separatorDelay(false); //false unless in the last part of the up or down commands fourBits(standardBits1); eightBits(standardBits2); eightBits(standardBits3); eightBits(action); fourBits(action2); eightBits(action3); i++; } if (a == 3) //If a stop command is issued just send the end delay then exit the method { endDelay(); } else //No stop issued so run through the last sequence { separatorDelay(false); //send true because we are in the up/down end sequence so there is an additional delay fourBits(standardBits1); eightBits(standardBits2); eightBits(standardBits3); eightBits(standardBits4); eightBits(action); fourBits(action2); eightBits(action3); int j = 0; while(j < 3) { separatorDelay(true); fourBits(standardBits1); eightBits(standardBits2); eightBits(standardBits3); eightBits(standardBits4); eightBits(action); fourBits(action1); eightBits(action2); j++; } endDelay(); } }``` -
@tjay4x4 sorry for the delayed reply. Are you using blinds.com blinds or something else? This code is written specifically for my blinds.com (dooya motors). They have a sequence of very specific codes that I reproduced with the blindAction method. If your remotes have different sequences you will need to modify the code there. If you are using blinds.com blinds, maybe they changed the sequences? Also, do your up/down/stop commands look the same as mine?
-
@tjay4x4 sorry for the delayed reply. Are you using blinds.com blinds or something else? This code is written specifically for my blinds.com (dooya motors). They have a sequence of very specific codes that I reproduced with the blindAction method. If your remotes have different sequences you will need to modify the code there. If you are using blinds.com blinds, maybe they changed the sequences? Also, do your up/down/stop commands look the same as mine?
@petewill Thank you for reply!
I'm using not blinds.com and this is really big problem. :) I'm not a progarmmer, and now I have two ways
1 solder relays to remote buttons. In this case I destroy remotes. Or order another 3 remotes for donation.
2 ask somebody to change this sketch for a fee. It's better, but who can? -
@petewill Thank you for reply!
I'm using not blinds.com and this is really big problem. :) I'm not a progarmmer, and now I have two ways
1 solder relays to remote buttons. In this case I destroy remotes. Or order another 3 remotes for donation.
2 ask somebody to change this sketch for a fee. It's better, but who can?@tjay4x4 I think you will find many helpful people on this forum. If you are willing to learn a little about coding there will be people to help. I have been helped many times with coding questions.
Here is what you will need to do. First, you need to decode your signals. It seems you have done this already which is great. Once you have your signals decoded correctly you can test to make sure they work correctly by sending them without using anything but an arduino. This is done with this code:
digitalWrite(SEND_DATA, HIGH); delayMicroseconds(highTime); digitalWrite(SEND_DATA, LOW); delayMicroseconds(lowTime);SEND_DATA is the digital pin on the Arduino (defined above in the code) and the highTime/lowTime is how long it will remain high and low. You could literally do that for each 1 and 0 that is in your signal to make sure you have it correct. Once you have that down you can begin breaking it down into methods and patterns like I have..
Hopefully that helps.
Pete