mcauser / micropython-ys-rf34t

MicroPython examples using YS-RF34T 433MHz ASK/OOK UART transceivers
MIT License
9 stars 1 forks source link

Multiple switch #1

Closed garudaonekh closed 1 year ago

garudaonekh commented 2 years ago

Hi, I plan to use EsP32 to control multiple RF switches around the farm using this transmitter. Is it possible? I still do not quite understand how the rf switch work. I am afraid that when I turn on a switch all other switch will also turn on.

mcauser commented 2 years ago

Hi @garudaonekh

Normally with ASK/OOK based RF switches, you have a set of DIP switches in the remote / receiver, used to specify an address. This lets you run multiple pairs in parallel. Supporting One-One, One-Many, Many-One and Many-Many. eg. If you set two receiver switches with the same address, one remote button can toggle both switches.

If your remote has DIP switches (normally inside where the battery is), then it's most likely going to be ASK/OOK based, sending the same unencrypted bytes each time, and not more modern rolling-key FSK based which sends a unique code each key press.

Depending on where you are in the world, your remote will either operate on 315MHz or 433MHz. It should have something on the packaging, or sometimes on the back of the remote / receiver.

This YS-RF34T module is designed to work with 433MHz RF switches that use specific protocols (2262, 2260, 1527). They send 2x address bytes and a key byte. The address bytes represent the DIP switches, and the key byte to say the state of the device(s) - in the case of a switch, on/off. If your remote has multiple buttons, it's likely going to use the same address bytes, but a different key value for each button.

The YS module combines both transmitter and receiver sub-modules (each with their own antenna). This lets you RX a remote to learn it's address/key, then later TX the address/key to emulate the remote.

Not all RF switches use these common protocols. If you have an RTL-SDR dongle, you can capture the output of your remote to see if you can emulate it with the YS module. I put some details in the readme about how to capture using the URH program.

If you already have the YS module and a remote, you can skip a RTL-SDR capture by putting the YS module in RX mode and pressing a button on the remote. If it detects it and outputs the same codes for multiple key presses, you're good to go and can use the captured address + keys when you put the YS module in TX mode.

garudaonekh commented 2 years ago

Thanks for your elaborate explanation. I manage to use the switch learning mode and set the address from my controller so doing this way, I can assign any address I like. I think this achieve my goal. It can easily reach 100 meters with some obstacles.

I also have RTL-SDR which I used to decode weather station. Is this module able to decode RF433 signal from weather station as well? my weather station is 433.92

mcauser commented 2 years ago

It's unlikely the weather station would be emitting packets compatible with the YS module, even though they are on the same frequency band. The weather station is probably sending larger packets using FSK, whereas this module is ASK.

garudaonekh commented 2 years ago

I can reach 320 meters with this ys-rf34t module. My testing condition is on the road with a few trees and cars in between. I work on farm projects so distance is very concerned. I see that RXB series switch can reach longer distance somehow, this module can't receive this kind of signal when I try. Do you have any input on this?

https://www.aliexpress.com/item/4001201447598.html?spm=a2g0o.productlist.0.0.5209472cd1R8dZ&algo_pvid=3217f091-7bd9-400d-b3aa-a2f52e4b9fc4&algo_exp_id=3217f091-7bd9-400d-b3aa-a2f52e4b9fc4-2&pdp_ext_f=%7B%22sku_id%22%3A%2210000015283773340%22%7D&pdp_npi=2%40dis%21USD%211.5%211.42%21%21%21%21%21%402101e9d316611538926758621ef85a%2110000015283773340%21sea&curPageLogUid=eonHd5nEXbTv