RF Links - Looking for TIPS and HINTS from the forum Guru's.

mortifyu

New Member
Hi All,

Unusually today I am not posting CODE that I am trying to work out what I have or have not done correctly.

Instead I am hopeful of getting some suggested hints and tips regarding PICAXE RF linking from The Guru's I know are here :)

I have used these transceivers with PICAXE in the past with great results, however I now need to do a pretty important task that requires bulletproof reliable confirmations.
PDF: http://www.ebyte.com/en/downpdf.aspx?id=164
These really are awesome little units that are very easy to use with PICAXE and offer exceptional range.


What I'd like to achieve:

An 'ABSOLUTE' way of indicating there is an active and reliable RF link between the two transceivers.

One side to be a 'Master' control panel, the other side to be a 'Slave' output device.

The actual application is far too complex to go into detail here, however as an example that would answer my questions:

The 'Master' panel to have 5 buttons and 5 LED's that indicate the state of 5 outputs on the 'Slave'.


DESIRED PROCESS:

An active and reliable link MUST be confirmed available before any output altering commands are transmitted.

'Master' sends a command telling the 'Slave to turn on a particular output.
'Slave' replies with confirmation that the requested output has been activated.
'Master' uses the received confirmation data to be the basis of turning on the appropriate master panel LED.


My coding thoughts:

In my mind I am thinking if I transmit b0 as a randomly generated value (0 to 254) from the 'master', so long as the same value is received back from the 'slave', that will confirm a reliable RF link.

Now transmit b1,b2,b3,b4, b5 (being the requested slave output state's (a simple 1 or 0 for each b#)). When the correct/same values are received back from the 'slave', turn on the appropriate LED's on the master panel displaying which outputs are on or off. If the values received were different or incomplete, resend a new link confirmation value (b0) and if successful, resend the requested output states (b1, b2, b3, b4, b5).

Keep repeating this at a relatively fast rate.



Perhaps the Ultra Experts here can tell me if this is or isn't a reasonable way to go, or is there a "Betterer" way to go about this?



Thanks in advance Guys/Gals. Your expert knowledge is as always greatly appreciated.



Regards,
Mort.
 

inglewoodpete

Senior Member
My coding thoughts:

In my mind I am thinking if I transmit b0 as a randomly generated value (0 to 254) from the 'master', so long as the same value is received back from the 'slave', that will confirm a reliable RF link.

Now transmit b1,b2,b3,b4, b5 (being the requested slave output state's (a simple 1 or 0 for each b#)). When the correct/same values are received back from the 'slave', turn on the appropriate LED's on the master panel displaying which outputs are on or off. If the values received were different or incomplete, resend a new link confirmation value (b0) and if successful, resend the requested output states (b1, b2, b3, b4, b5).

Keep repeating this at a relatively fast rate.
There are regulations in Australia (and probably most countries) that limit the amount of time you can transmit at these frequencies every hour. This is because they are shared frequencies and your neighbours may not be able to lock or unlock their car or garage while you hog the airwaves!

If you need a secure and reliable wireless link, I suggest you use transceivers (or two pairs of transmitters and receivers) so that you can echo confirmation packets back, so that the originator know that its message has been received. You could also use checksums to confirm the validity of the data packets. I have done something like this using a 20X2 PICAXE.
 

Pongo

Senior Member
Do you have the 2.4 GHz ISM band in Australia? I've recently been using similar 2.4 GHz units from ebyte and found the connection to be very reliable.
 

lbenson

Senior Member
transmit b1,b2,b3,b4, b5 (being the requested slave output state's (a simple 1 or 0 for each b#))
Of course, you don't need 5 bytes to transmit 5 bits worth of data. A single byte received into b0 would give you access to bit0, bit1, bit2, bit3, and bit4.

If you send a second byte with the bits inverted from the first, you can do a simple validity check which will catch single-bit errors and many multiple-bit errors. The following code illustrates (INV command only available on X2s):
Code:
#picaxe 20x2
b0=%00010110
b1=inv b0
b2=b0|b1
if b2 <> %11111111 then
  sertxd("transmission invalid",cr,lf)
else
  sertxd("transmission byte inversion check ok",cr,lf)
endif
I'm sure others could recommend more robust error checking techniques.
 

mortifyu

New Member
There are regulations in Australia (and probably most countries) that limit the amount of time you can transmit at these frequencies every hour. This is because they are shared frequencies and your neighbours may not be able to lock or unlock their car or garage while you hog the airwaves!

If you need a secure and reliable wireless link, I suggest you use transceivers (or two pairs of transmitters and receivers) so that you can echo confirmation packets back, so that the originator know that its message has been received. You could also use checksums to confirm the validity of the data packets. I have done something like this using a 20X2 PICAXE.

Hi Pete, thanks for your response.

E62-TTL-100 is actually a transceiver module. Indeed, hogging airwaves would/could pose issues for others in close proximity, however this application will be operating at only 25mW many kilometers from any other potential transmissions. Link checking may be set to every 2 seconds to avoid almost continuous transmissions. Without repetitiously echoing data, I don't see any definite way of confirming the link.
 

mortifyu

New Member
Do you have the 2.4 GHz ISM band in Australia? I've recently been using similar 2.4 GHz units from ebyte and found the connection to be very reliable.

Hi Pongo, thanks for your response.

Yes, 2.4GHz ISM is an option in Australia, however a much lower frequency has greatly improved range with less transmission power required.
 

mortifyu

New Member
Of course, you don't need 5 bytes to transmit 5 bits worth of data. A single byte received into b0 would give you access to bit0, bit1, bit2, bit3, and bit4.

If you send a second byte with the bits inverted from the first, you can do a simple validity check which will catch single-bit errors and many multiple-bit errors. The following code illustrates (INV command only available on X2s):
Code:
#picaxe 20x2
b0=%00010110
b1=inv b0
b2=b0|b1
if b2 <> %11111111 then
  sertxd("transmission invalid",cr,lf)
else
  sertxd("transmission byte inversion check ok",cr,lf)
endif
I'm sure others could recommend more robust error checking techniques.

Hi Ibenson, thanks for your response.

I am quite well versed in electronics hardware and PCB design. But doing my best when it comes to coding. I am looking into your coding suggestion as it's a bit puzzling for me atm.

Perhaps you could offer a long winded, layman terms version of the code you have suggested.

Not sure what this means:

Code:
b2=b0|b1
Thanks in advance.
 

lbenson

Senior Member
Sorry, I should have added comments. b0|b1 means perform a bitwise OR of b0 and b1. That is, if a bit position has a value of 0 in both b0 and b1, the corresponding bit position in the result will be 0, otherwise it will be 1. Since b1 is an inversion of b0 (all bits which are 1 in the first are 0 in the second, and vice versa), the result of the OR should have all bits on, so should be equal to $FF (%11111111).

Therefor, if the result was not $ff, the transmission of the target byte and its inversion (b0 and b1) had at least one error. All one-bit transmission errors will be caught with this test (in fact, every transmission with an odd number of bit errors). Transmissions with an even number of errors will be caught if the same bits in both bytes are not flipped. So the only errors not caught are those in which a bit position with a value of 1 in one byte is flipped to 0, and the corresponding bit in the other byte is flipped to 1. Your transmission of the bytes back to the sender would catch that unless the bits were miraculously flipped back upon return.

In the sample code, after b1=inv b0 you would transmit b0 and b1; on the other end, after you received b0 and b1, you would perform the OR and test the result.
 

inglewoodpete

Senior Member
@lbenson, Wouldn't b0 OR b1 just "gather the ones zeroes"? Eg. If you received 11110000 and 11001111 and ORed them, you would end up with 11111111. While this would be seen as error-free, the received values would not actually be the complement of each other. I'm thinking you should use b0 XOR b1.

Edit: ~sigh~ Changed to "gather the ones"
 
Last edited:

Pongo

Senior Member
Hi Pongo, thanks for your response.

Yes, 2.4GHz ISM is an option in Australia, however a much lower frequency has greatly improved range with less transmission power required.
But you're looking for reliability and everybody and his brother has stuff transmitting on 433, at least they do where I live.
 

hippy

Technical Support
Staff member
An active and reliable link MUST be confirmed available before any output altering commands are transmitted.
For reliability; data should be packetised and sent with start and end markers, include the data, its length, ideally some sequence number, possibly some error correcting code, and have a robust checksum.

A dummy 'how are things?' packet can be sent before data which alters anything to check the link, and acknowledgement can be returned when instructed to do anything. A multi-step process may be suitable -

How are things? - Things here are fine and dandy
Please do this - You want me to do this ?
Yes, do this - Okay, I did this

If that sequence doesn't complete and pass all error checks then start again from the beginning.
 
Top