akirjavainen / markisol

Arduino control for Markisol protocol 433.92MHz window shades and BF-101, BF-301, BF-305 remotes
GNU General Public License v3.0
22 stars 3 forks source link

Shade nudges instead of continuous movement #4

Closed mcpacific closed 3 years ago

mcpacific commented 3 years ago

Using the example sketches, I'm able to command the shades to go up, down, stop, etc. However, they only nudge. For example, I would like the shades to go all the way down. On my BY-305 remote I accomplish this by holding down the relevant button. How do I accomplish the same thing here? I've tried increasing the REPEAT_COMMAND value, but that doesn't seem to help.

akirjavainen commented 3 years ago

This could be a newer/different remote than what I've had, with different commands or functions. Can you read in the remote commands via RemoteCapture.ino, especially while holding the up/down button down? Using the copied commands, you should be able to do what the original remote does. I'd be also interested in what kind of commands these are.

drphungky commented 3 years ago

Working so unable to get into details, but see my comment here for outline of hold vs tap: https://github.com/akirjavainen/markisol/issues/3

Basically, in the second set of 8 commands, the checksums change on a hold command. This doesn't happen on a BF-305, as confirmed by akir and my latest testing. They seem to only do hold commands, and the checksums don't change. My BY-305 (and yours apparently) do taps AND holds, and it changes the checksums that I still haven't figured out. I'll try to upload my decodes later.

drphungky commented 3 years ago

Also, I haven't reviewed the capture code you wrote akir, but if it only captures the first message or set of 8 messages and doesn't differentiate latter signals, it may not capture the change. I did all my capturing manually with Universal Radio Hacker and an SDR antenna.

akirjavainen commented 3 years ago

The capture code should capture each command no problem. But since this is a new feature or variation of the protocol, it would have to be tested to confirm this.

drphungky commented 3 years ago

So a remote tap signal is one 8 message block, whereas the hold signal is the same 8 message block, followed by a DIFFERENT 8 message block, which then repeats as long as the button is held down (only necessary to get one block though). Are you saying your program captures the entire signal, and would get each 8 message block and note they have separate compositions? Sorry for what's likely a basic question, but again I'm at work and can't dig into the code.

akirjavainen commented 3 years ago

That shouldn't be a problem. Every command (and command repetition) should output to the serial log ("hold" commands most likely reported as "unknown"). Let me know your results when you get to try it!

mcpacific commented 3 years ago

Here are the capture code output for one shade (up, down, stop):

20:26:58.819 -> Successful capture, full command is: 01111101100101111000001100001000100100011
20:26:58.819 -> Remote control (unique) ID: 0111110110010111
20:26:58.819 -> Channel: 1
20:26:58.819 -> Command: UP
20:26:58.819 -> Remote control model: UNKNOWN/NEW
20:26:58.819 -> 
20:29:03.389 -> Successful capture, full command is: 01111101100101111000100000001000100111001
20:29:03.389 -> Remote control (unique) ID: 0111110110010111
20:29:03.389 -> Channel: 1
20:29:03.389 -> Command: DOWN
20:29:03.389 -> Remote control model: UNKNOWN/NEW
20:29:03.389 -> 
20:29:06.376 -> Successful capture, full command is: 01111101100101111000101010000000000100001
20:29:06.376 -> Remote control (unique) ID: 0111110110010111
20:29:06.376 -> Channel: 1
20:29:06.376 -> Command: STOP
20:29:06.423 -> Remote control model: UNKNOWN/NEW

Also, when I view my BY-305's LED, when I hold down a button it seems to pulse -> pause ~0.2 sec -> pulse the code. When I capture with the hold press, it just repeats the same code. For example:

10:06:27.954 -> Successful capture, full command is: 01111101100101111000001100000000100110011
10:06:27.954 -> Remote control (unique) ID: 0111110110010111
10:06:27.954 -> Channel: 1
10:06:27.954 -> Command: UP
10:06:27.954 -> Remote control model: UNKNOWN/NEW
10:06:27.954 -> 
10:06:28.746 -> Successful capture, full command is: 01111101100101111000001100000000100110011
10:06:28.746 -> Remote control (unique) ID: 0111110110010111
10:06:28.746 -> Channel: 1
10:06:28.746 -> Command: UP
10:06:28.746 -> Remote control model: UNKNOWN/NEW
akirjavainen commented 3 years ago

This is interesting. If the "hold" command indeed is an own unique command, perhaps it has a different preamble than other commands. Thus, the capture code doesn't recognize it at the moment.

Even more interesting is that bits 25-32 that indicate the remote model, seem to be changing with almost every command. There's 0x0, 0x8 and 0x80 in your captured commands. Perhaps all of the last 17 bits follow some new kind of logic with the BY-305.

mcpacific commented 3 years ago

It is a bit peculiar. I ran capture again, but this time I paid a bit more attention to the LED on the top of the remote. Apparently there are four blocks (this is for "up-hold":

12:04:27.295 -> Successful capture, full command is: 01111101100101111000001100001000100100011
12:04:27.295 -> Remote control (unique) ID: 0111110110010111
12:04:27.295 -> Channel: 1
12:04:27.295 -> Command: UP
12:04:27.295 -> Remote control model: UNKNOWN/NEW
12:04:27.341 -> Remote control ID (DEC): 32151
12:04:27.341 -> Trailing bits: 291
12:04:27.341 -> 
12:04:27.483 -> Successful capture, full command is: 01111101100101111000001100001000100100011
12:04:27.529 -> Remote control (unique) ID: 0111110110010111
12:04:27.529 -> Channel: 1
12:04:27.529 -> Command: UP
12:04:27.529 -> Remote control model: UNKNOWN/NEW
12:04:27.529 -> Remote control ID (DEC): 32151
12:04:27.529 -> Trailing bits: 291
12:04:27.529 -> 
12:04:28.039 -> Successful capture, full command is: 01111101100101111000001100000000100110011
12:04:28.039 -> Remote control (unique) ID: 0111110110010111
12:04:28.039 -> Channel: 1
12:04:28.039 -> Command: UP
12:04:28.039 -> Remote control model: UNKNOWN/NEW
12:04:28.039 -> Remote control ID (DEC): 32151
12:04:28.039 -> Trailing bits: 307
12:04:28.039 -> 
12:04:28.226 -> Successful capture, full command is: 01111101100101111000001100000000100110011
12:04:28.226 -> Remote control (unique) ID: 0111110110010111
12:04:28.272 -> Channel: 1
12:04:28.272 -> Command: UP
12:04:28.272 -> Remote control model: UNKNOWN/NEW
12:04:28.272 -> Remote control ID (DEC): 32151
12:04:28.272 -> Trailing bits: 307
drphungky commented 3 years ago

Don't have time to clean up the file, but here are all the commands I captured:

https://docs.google.com/spreadsheets/d/1uxgHA3m4bGV_dOHICTFxoSRkzpOmU81s-C7daMg4SL8/edit?usp=sharing

Remote 1 is a BY-305, Remote 2 is a BF-305. Message is a grouping of 8 bursts. You can ignore the difference in bursts as I found none, but those were supposed to be each of the 8 signals in a message (a message being the 11111111111000000011111 AGC, then the 41 tribits and the trailing 111).

drphungky commented 3 years ago

Also, here's an example of difference in protocol in a Channel 4 down hold:

Actual waves: image

Portion of Protocol (1111s at the end are the beginning of the AGC). image

mcpacific commented 3 years ago

I'm pretty new to all this so I don't quite understand the waveforms etc. but I did get it to work. With some trial and error, I determined the second command for each action captured was the "hold" command (and the first command for each is tap). I therefore modified by code to use the full command for Down (hold), Stop (tap), and Up (hold).

#define SHADE_DOWN_EXAMPLE                 "01111101100101111000100000000000100100101" // DOWN button (hold)
#define SHADE_STOP_EXAMPLE                 "01111101100101111000101010000000000100001" // STOP button (tap)
#define SHADE_UP_EXAMPLE                   "01111101100101111000001100000000100110011" // UP button (hold)

Then inside of loop():

Serial.println("Sending down command");
sendMarkisolCommand(SHADE_DOWN_EXAMPLE);
delay(5000);

Serial.println("Sending stop command");
sendMarkisolCommand(SHADE_STOP_EXAMPLE);
delay(5000);

Serial.println("Sending up command");
sendMarkisolCommand(SHADE_UP_EXAMPLE);
delay(15000);

Works perfectly! Now I just need to figure out how to get interface with Alexa. :)