sebmillet / RF433recv

Manage receiving codes from 433 Mhz RX device plugged on Arduino
GNU Lesser General Public License v3.0
6 stars 4 forks source link

How to add new protocol #1

Closed buxtonpaul closed 2 years ago

buxtonpaul commented 2 years ago

Hi,

I have some RF433 MHz Temperature probe that I am trying to capture the data from. Using a hacked up version of RC-Switch, and later verifying with your RFSnif library, I have been able to determine that the data looks to consist of an 8000us start pulse and the pulses of lenght either 2000us or 4000us seperated by a low signal for 500us.

When running with RF433any these signal characteristics are detected correctly, but because the signal is neither Manchester encoded or Tri-bit the library can do nothing more with them. I see what looks like a state machine for each of these protocols, is there any guidance/documentation on how I would construct a new statemachine and integrate it for for the protocol I am seeing from my thermometers.

Thanks Paul

sebmillet commented 2 years ago

Hello

the first version of my response was completely out of tracks (I thought it was in RF433any).

will re-write a correct response.

Reg, Seb

sebmillet commented 2 years ago

Hello

Actually RF433recv does allow to decode a signal where only one band has variable length. You can see it in 04_rcswitch_recv.ino (https://github.com/sebmillet/RF433recv/blob/main/examples/04_rcswitch_recv/04_rcswitch_recv.ino), for protocols 8 and 9.

You don't need a decoder different from tribit/tribit_inverted. Given what you say, it looks like you need either:

The library https://github.com/sebmillet/rf433snif may help in this matter. There's other similar libraries around. It is fairly straightforward: the code simply listens for initial pulse duration, then record signal timings and finally prints it out...

I hope this time, my response will help ;-)

Reg, Seb

buxtonpaul commented 2 years ago

Hi, Yes I used rf433snif which produced the timing data I am using. I had managed to get rc_switch to see the signal but fail to decode it. After a bit of digging I realised that RCSwitch only handled 32 bit codes, whilst mine was 42 bits. My changes in RCSwitch aren't very clean or well integrated so I might come back and see if I can do a cleaner job with RD433Recv.

sebmillet commented 2 years ago

Hello

If you post rcswitch code timings that you use i can show you what rf433recv it corresponds to.

Reg, Seb

buxtonpaul commented 2 years ago

Hi The RC Switch entry looks like { 500, { 16, 1 }, { 4, 1 }, { 8, 1 }, true }

Although RCSwitch doesn't always work, as it depends on consecutive transmissions with a certain duration between them and no noise.

Example sniffed transmission. drv:0x00,wp_Waiting for signal... Signal duration: 826212 us N LOW, HIGH -----BEGIN RF433 LOW HIGH SEQUENCE----- , 7991 000 536, 1956 001 524, 1976 002 512, 1988 003 492, 2012 004 488, 3964 005 496, 2060 006 496, 3948 007 504, 1996 008 504, 1992 009 508, 4004 010 512, 1988 011 512, 1988 012 512, 1984 013 512, 3996 014 516, 3932 015 520, 1972 016 520, 3928 017 524, 2036 018 524, 3924 019 516, 1972 020 524, 3924 021 528, 2028 022 520, 1972 023 524, 3924 024 528, 1968 025 528, 3984 026 528, 1968 027 528, 1968 028 528, 1972 029 528, 2032 030 524, 1972 031 524, 1972 032 524, 1976 033 524, 2036 034 524, 1976 035 524, 1976 036 520, 1976 037 520, 3992 038 524, 1976 039 524, 3928 040 524, 1972 041 524, 2036 042 520, 8016 043 528, 8012 044 528, 1968 045 528, 1972 046 524, 1972 047 528, 1972 048 524, 3928 049 524, 2032 050 524, 3924 051 528, 1972 052 528, 1972 053 524, 3984 054 528, 1972 055 524, 1972 056 524, 1972 057 524, 3984 058 524, 3924 059 528, 1972 060 524, 3924 061 528, 2032 062 528, 3924 063 528, 1968 064 528, 3924 065 528, 2032 066 524, 1972 067 524, 3924 068 528, 1968 069 528, 3984 070 528, 1972 071 524, 1972 072 524, 1972 073 524, 2036 074 524, 1976 075 520, 1976 076 520, 1976 077 520, 2040 078 520, 1976 079 520, 1980 080 516, 1980 081 516, 3992 082 520, 1976 083 520, 3932 084 520, 1976 085 520, 2040 086 520, 8020 087 520, 8016 088 524, 1972 089 524, 1976 090 524, 1976 091 520, 1976 092 520, 3928 093 524, 2036 094 524, 3928 095 524, 1976 096 520, 1976 097 520, 3992 098 524, 1976 099 520, 1976 100 520, 1976 101 512, 3992 102 524, 3928 103 524, 1972 104 524, 3928 105 524, 2032 106 524, 3928 107 524, 1972 108 524, 3928 109 524, 2032 110 524, 1976 111 524, 3928 112 524, 1972 113 524, 3988 114 524, 1972 115 520, 1976 116 524, 1976 117 520, 2040 118 520, 1976 119 520, 1980 120 516, 1980 121 516, 2040 122 516, 1984 123 516, 1984 124 516, 1980 125 516, 3996 126 516, 1980 127 516, 3932 128 520, 1980 129 520, 2040 130 516, 8020 131 520, 8016 132 524, 1972 133 524, 1976 134 520, 1976 135 520, 1976 136 520, 3932 137 520, 2040 138 520, 3928 139 524, 1976 140 520, 1976 141 520, 3992 142 524, 1976 143 520, 1976 144 516, 1980 145 516, 3992 146 520, 3928 147 524, 1976 148 520, 3928 149 524, 2036 150 520, 3928 151 524, 1972 152 524, 3928 153 524, 2036 154 524, 1976 155 524, 3928 156 524, 1972 157 520, 3992 158 524, 1976 159 520, 1976 160 520, 1976 161 520, 2040 162 520, 1980 163 520, 1980 164 516, 1980 165 516, 2040 166 516, 1980 167 516, 1980 168 516, 1984 169 512, 3996 170 516, 1980 171 516, 3932 172 520, 1980 173 516, 2040 174 516, 8020 175 520, 8020 176 524, 1972 177 524, 1972 178 524, 1976 179 520, 1976 180 516, 3932 181 524, 2036 182 520, 3928 183 524, 1976 184 520, 1976 185 520, 3988 186 524, 1976 187 520, 1976 188 520, 1976 189 520, 3992 190 520, 3928 191 524, 1976 192 520, 3928 193 524, 2036 194 524, 3928 195 524, 1976 196 520, 3928 197 524, 2036 198 520, 1976 199 520, 3928 200 524, 1976 201 524, 3988 202 524, 1972 203 524, 1976 204 520, 1980 205 520, 2036 206 520, 1980 207 512, 1980 208 516, 1980 209 516, 2040 210 516, 1980 211 512, 1984 212 516, 1980 213 516, 3996 214 520, 1980 215 516, 3932 216 520, 1980 217 520, 2040 218 516, 8020 219 520, 8016 220 524, 1972 221 524, 1976 222 524, 1976 223 520, 1976 224 520, 3932 225 520, 2036 226 520, 3928 227 524, 1976 228 520, 1976 229 520, 3992 230 524, 1976 231 520, 1976 232 520, 1980 233 520, 3992 234 520, 3928 235 524, 1972 236 520, 3928 237 524, 2036 238 520, 3928 239 524, 1972 240 524, 3928 241 524, 2036 242 524, 1976 243 520, 3928 244 524, 1972 245 520, 3988 246 524, 1972 247 520, 1976 248 524, 1976 249 516, 2040 -----END RF433 LOW HIGH SEQUENCE----- Waiting for signal...

--- exit ---

I did try a couple of combinations with rf433recv but they didn't seem to work.

Paul

sebmillet commented 2 years ago

Hello.

A priori, looks like receiver is to be called this way: rf.register_Receiver(RFMOD_TRIBIT_INVERTED, 8000, 0, 0, 500, 500, 500, 2000, 4000, 0, 8000, 42, callback, 0);

I don't remember if equality of short and long duration on the low band is possible (I tested it for such an equality on the high band for sure, to decode RCSwitch' protocol 9).

If it doesn't work I'll have to implement emission and corresponding reception to test it live... will do it this week-end if need be.

Reg, Seb

buxtonpaul commented 2 years ago

So that appears to be working. Although I beleive I have seen cases where there is no end pulse and it just drops to what I think is noise. But at the moment I seem to be receiving codes :-)

A couple of other things worth mentioning. The sample for RF433recv seems to have different values for PIN_RFINPUT and INT_RFINPUT. At least for me running on an ESP32 these need to be the same. Might also be worth mentioning that the ESP isn't as limited on which pins can generate interrupts.

Thanks for the help! Paul

sebmillet commented 2 years ago

Hello

Thanks for feedback - I'll have to add these mentions about ESP then.

By the way I think replacing 'INT_RFINPUT' with 'digitalPinToInterrupt(PIN_RFINPUT)' would be cleaner. Would this approach work on ESP32 too?

This could then be an update of the lib, where the secondary parameter would be optional, the interrupt number being most often simply derived from the pin number.

Reg, Seb

buxtonpaul commented 2 years ago

I can confirm using RF_manager rf(PIN_RFINPUT, digitalPinToInterrupt(PIN_RFINPUT)); works.

sebmillet commented 2 years ago

Hello

just published v0.3.0 of the lib, that updates some comments about interrupts and makes the interrupt number optional when creating the decoder object.

Reg, Seb

buxtonpaul commented 2 years ago

Cool!

It might also be worth modifying the library.properties file, the Arduino IDE (which I have had to use as it looks like the MagTag board I am using isn't supported in PlatformIO yet), warns that the library only supports the avr architecture.

Thanks for the assistance. I now have my little E-ink display showing the temperature in my fridge and freezer, next step to send them to Home Assistance :-)

On Sun, Apr 10, 2022 at 10:48 AM sebmillet @.***> wrote:

Hello

just published v0.3.0 of the lib, that updates some comments about interrupts and makes the interrupt number optional when creating the decoder object.

Reg, Seb

— Reply to this email directly, view it on GitHub https://github.com/sebmillet/RF433recv/issues/1#issuecomment-1094233149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVOI3BO7VXFVRIH3JDAU6DVEKPYPANCNFSM5SFAIR3A . You are receiving this because you authored the thread.Message ID: @.***>

sebmillet commented 2 years ago

Hello

I'm glad I could help. About library.properties file, what is the name of the board to add to library.properties?

Reg, Seb

sebmillet commented 2 years ago

I finally added esp32 to library.properties, separated from avr with a comma and space character.