Closed eadmaster closed 5 months ago
rpi-rf uses the rc-switch format, which is very limited, although for simple uses it can be useful.
Direct capture of codes in picode format is implemented for microcontrollers like as Arduino or similar pilight-usb-nano
However, if capturing with rpi-rf is enough for you, it will be easy to add a translation option between formats, perhaps in the python package pyPicode
Let me think about it.
Best regards. Jorge.
@eadmaster,
For an early test, the command rpi-rf_send -p 175 -t 1 4478268
generates this pulse train, which can be easily converted to picode format with the picoder tool.
picoder convert -t "175,525,525,175,175,525,175,525,175,525,525,175,175,525,175,525,175,525,525,175,175,525,525,175,175,525,525,175,175,525,525,175,175,525,175,525,525,175,525,175,525,175,525,175,175,525,175,525,175,5425"
c:01100101011001010110011001100110010110101010010102;p:175,525,5425@
This code is very similar to the "clarus_switch" protocol, since by simply increasing the synchronization pulse a little it can be decoded:
picoder decode -s "c:01100101011001010110011001100110010110101010010102;p:175,525,5500@"
{
"protocols": [{
"clarus_switch": {
"id": "A3",
"unit": 20,
"state": "off"
}
}]
}
And this way it is very easy to generate similar codes, for example, to turn on the same switch it would be:
picoder encode -f '{"clarus_switch":{"id":"A3","unit":20,"on":1}}'
c:01100101011001010110011001100110010110100101101002;p:180,540,6120@
Try this picodes to see if we are on the right track.
Thanks. Jorge.
thanks for your help, unfortunately i'm having some issues with the FS1000A transmitter currently, i am trying to figure out if i've got a defective unit or not. If i manage to get it working i'll update the issue.
The FS1000A transmitter is really bad, try to get another one with better quality, Aliexpress is ok for this:
More info here: http://x311.blogspot.com/2017/10/comparison-of-cheap-rf-modules-with-ask.html
Good luck!
I also have a CC1101 module that should be compatible, so i am trying to use that instead before the next aliexpress order :-).
So far the module gets recognized by this script, but it is not reading the signals coming from my remote.
Using the CC1101 is easily possible with any Arduino.
@eadmaster
If you still want to use RCSwitch to capture or generate RC codes, I have implemented a utility to encode and decode RC codes into pulse trains that can be easily converted to PICODE format.
Good luck!
Finally, I developed a Python module to wrap the C++ RCSwitch Common Library to easily translate RCSwitch codes to PiCode string format.
This way you can translate the command you needed (rpi-rf_send -p 175 -t 1 4478268
) into picode format like this:
>>> import pypicode as picode
>>>
>>> from pyRCSwitch import RCSwitch
>>> mySwitch = RCSwitch()
>>>
>>> mySwitch.setProtocol(1, 175)
>>>
>>> picode.pulseTrainToString( mySwitch.send(4478268, 24) )
'c:01100101011001010110011001100110010110101010010102;p:175,525,5425@'
I hope I have been helpful. Bests regards.
ok, i've managed to write this sketch to an ESP32.
I am getting the "CC1101 SPI Connection Error". My CC1101 is wired like this:
am i missing something?
EDIT: maybe some pins must be redefined in that script, i am able to get "CC1101 initialized" correctly with this.
UPDATE: after adding these lines in the setup() function, now it seems to init the module correctly:
byte sck = 14;
byte miso = 12;
byte mosi = 13;
byte ss = 20;
int gdo0 = 5;
int gdo2 = 4;
ELECHOUSE_cc1101.setSpiPin(sck, miso, mosi, ss);
ELECHOUSE_cc1101.setGDO(gdo0, gdo2);
ELECHOUSE_cc1101.Init();
EDIT: nevermind, i've found i had the SPI CS
not connected correctly.
which method do you recommend to obtain rf signals in Picode format?
I am able to read signals using this script , but the format is a bit different:
(i'd like to clone signals sent from an outlet remote)