Hi,
I want to try and control a remote 433MHz RF plug with a PIC and cheap transmitter.
I’ve searched the forum but couldn’t find anything specific on this question although there is a lot on RF transmission and reception.
I have been able to sniff the codes using an Arduino and a library called RCSwitch.h. See the attached file and the raw code here:
Decimal: 6725231 (24Bit) Binary: 011001101001111001101111 Tri-State: not applicable PulseLength: 315 microseconds Protocol: 1
Raw data: 9788,204,116,348,468,136,104,80,96,272,364,248,828,332,832,1004,256,960,224,316,888,920,264,244,412,68,408,48,92,236,168,304,240,100,616,108,212,276,84,372,256,72,88,268,76,164,120,224,308,
Would a PIC be capable of sending this data at these speeds using GCB?
What type of PIC would be recommended? I have a few 16F684.
To replicate the above would it just be as simple as using pulseout and wait commands?
If anybody could point me in the direction of some code snippets I’d appreciate it.
Would a PIC be capable of sending this data at these speeds using GCB?
Yes. Great Cow BASIC is true ASM. So, it is fast.
What type of PIC would be recommended? I have a few 16F684.
Go and buy some new PICs. Like 16F18313, an Xpress board?, or an 18FnnK42 (64 MHz internal clock!)
To replicate the above would it just be as simple as using pulseout and wait commands?
Someone else can advise. But, you can create customised protocols with ease.
If anybody could point me in the direction of some code snippets I’d appreciate it. @williamroth may be good bet for this.
:-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
xDermot:
The code in your example is the HS1527 encoding.
This corresponds in a sequence of 24 bits composed only of the values 0 and 1.
Unlike the PT2262-2272 coding which instead also includes the value "F", ie floating.
The composition of the sequences to distinguish the levels L, H and F is similar for both codes and differs slightly.
Some time ago I wrote a code in another Basic language to be able to transmit with both encodings and with a few modifications you can convert it to GCBasic.
The PT2262 encoding requires the sending of the 12 byte phrase in an example string format: "FF10F11F0001".
The first 8 bytes are the address, the last 4 bytes are the number of the corresponding key.
The HS1527 encoding instead, that of your example, I managed it using 4 variable bytes.
The first two correspond to the 16 bytes high, then a third variable follows which correspond to the remaining 4 bytes to reach 20 and thus form the address.
The last byte variable indicates the data, that is the key pressed.
In the attached file there are two routines to use, the others are service routines to allow their operation.
The first is the
"Sub SendHS (Dim Ind0, Ind1, Ind2, Value As Byte)".
The second is the "Sub SendPt" where the 12 character string is to be passed.
The duration of the delays for the formation of the codes has been calculated and is the optimal one.
Thank you very much for the info and code. It is more than generous. I'll study what you've given me carefully and I'll also try simply using the pulsout and wait commands as I already have the codes and just want to turn one socket on and off.
Thanks again for your help and code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I have used those cheap 433Mhz pairs and I have some small working code. I found out that you have to limit your Baud Rate 2400. Also what I found is that you need two Byte of random data to get the thing up and running, hence why the FF and AA code before it sends everything.
This was just a test and may not be a final working program (but it does work last tested). Range was about 30 ft or roughly about 9.14 meters.
Transmitter:
#chip18F25K20, 8
#config'[todo]' #include '[todo]
#defineUSART_BAUD_RATE2400
#defineUSART_BLOCKING; ----- Constants; ----- VariablesDimCounterVarasByteDimChecksumasByte; ----- Quick Command Reference:'[todo]; ----- Main body of program commences here.DoChecksum="H"xor"2"HSerPrint0xFFHSerPrint0xAA'For CounterVar = 0 to 2'HSerPrint 0xAA'NextHSerPrint"H"HSerPrint"2"HSerPrintChecksum'should be 122HSerSend13HSerSend10' For CounterVar = 0 to 255' HSerPrint CounterVar' wait 100 ms' Nextwait1000msLoopend
Receiver code
'''A demonstration program for GCGB and GCB.'''--------------------------------------------------------------------------------------------------------------------------------'''This program'''RF modules seem to need up to 10 bytes to send correctly. Otherwise''' they work fine. Range is about 30ft.2400 max bps'''@author'''@licence GPL'''@version'''@date 01.11.2015'''********************************************************************************; ----- Configuration
#chip18F13K22, 8
#config'[todo]' #include '[todo]
#defineUSART_BAUD_RATE2400
#defineUSART_BLOCKING; ----- Constants
#defineDataByte1DataBytes(1)
#defineDataByte2DataBytes(2); ----- VariablesDimCounterVarasByteDimRecasByteDimDataBytes(2); ----- Quick Command Reference:'[todo]; ----- Main body of program commences here.DoHSerReceive(Rec)'Check to see if we have a datapacket and then receive the data.' Shove it into an array.IfRec="H"thenForCounterVar=1to2HSerReceive(DataBytes(CounterVar))nextHSerPrintDataBytes(1)HSerSend13HSerSend10HSerPrintDataBytes(2)HSerSend13HSerSend10EndIfLoopend; ----- Support methods. Subroutines and Functions
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I want to try and control a remote 433MHz RF plug with a PIC and cheap transmitter.
I’ve searched the forum but couldn’t find anything specific on this question although there is a lot on RF transmission and reception.
I have been able to sniff the codes using an Arduino and a library called RCSwitch.h. See the attached file and the raw code here:
Decimal: 6725231 (24Bit) Binary: 011001101001111001101111 Tri-State: not applicable PulseLength: 315 microseconds Protocol: 1
Raw data: 9788,204,116,348,468,136,104,80,96,272,364,248,828,332,832,1004,256,960,224,316,888,920,264,244,412,68,408,48,92,236,168,304,240,100,616,108,212,276,84,372,256,72,88,268,76,164,120,224,308,
Would a PIC be capable of sending this data at these speeds using GCB?
What type of PIC would be recommended? I have a few 16F684.
To replicate the above would it just be as simple as using pulseout and wait commands?
If anybody could point me in the direction of some code snippets I’d appreciate it.
Thank you
Regards
Dermot
:-)
Thanks for that info.
xDermot:
The code in your example is the HS1527 encoding.
This corresponds in a sequence of 24 bits composed only of the values 0 and 1.
Unlike the PT2262-2272 coding which instead also includes the value "F", ie floating.
The composition of the sequences to distinguish the levels L, H and F is similar for both codes and differs slightly.
Some time ago I wrote a code in another Basic language to be able to transmit with both encodings and with a few modifications you can convert it to GCBasic.
The PT2262 encoding requires the sending of the 12 byte phrase in an example string format: "FF10F11F0001".
The first 8 bytes are the address, the last 4 bytes are the number of the corresponding key.
The HS1527 encoding instead, that of your example, I managed it using 4 variable bytes.
The first two correspond to the 16 bytes high, then a third variable follows which correspond to the remaining 4 bytes to reach 20 and thus form the address.
The last byte variable indicates the data, that is the key pressed.
In the attached file there are two routines to use, the others are service routines to allow their operation.
The first is the
"Sub SendHS (Dim Ind0, Ind1, Ind2, Value As Byte)".
The second is the "Sub SendPt" where the 12 character string is to be passed.
The duration of the delays for the formation of the codes has been calculated and is the optimal one.
I forgot ...
I used a 12F683 without problems ...
Thank you very much for the info and code. It is more than generous. I'll study what you've given me carefully and I'll also try simply using the pulsout and wait commands as I already have the codes and just want to turn one socket on and off.
Thanks again for your help and code.
So I have used those cheap 433Mhz pairs and I have some small working code. I found out that you have to limit your Baud Rate 2400. Also what I found is that you need two Byte of random data to get the thing up and running, hence why the FF and AA code before it sends everything.
This was just a test and may not be a final working program (but it does work last tested). Range was about 30 ft or roughly about 9.14 meters.
Transmitter:
Receiver code
Thanks for that Chris. I'll study your code and see can I make it work.
Regards
Dermot