No Timeout When Using Serin With Qualifier

rossko57

Senior Member
Is your question really more like "how to receive serial data from a 'dumb' radio link i.e. with background noise" ?
 

Maco33

New Member
The question is the same as the title to create Timeout When Using Serin With Qualifier for RF reception. In link that dealt noelnelson:
Code:
I had the same problem with the timeout and qualifier, and found the answers offered in this thread to explain what I couldnt figure out. Thanks to all who contributed.
What I then did to get around the problem, is to use the timeout, and to include a dummy byte as the first byte sent in the serial data. On the receive side, the next line after the serin line, I simply do a 'if byte = dummy then goto...' line. If the byte does not equal the dummy then make another decision where to go. If it equals the dummy, ignore it as data, and continue with the next received data.

For more data security, this method could be expanded by multiplying all the sent data, (ignoring overflow) and sending the resulting byte (or Word) as a checksum. Then, receive all the data and the checksum, multiply all the data again and compare to the received checksum.
 

Jeremy Harris

Senior Member
I tried several methods to get a qualifier to work with the cheap ASK RF modules, including the suggestions in that old thread, but none were reliable. In the end I just swapped the ASK modules for HC-12's, which are very reliable when a qualifier is used.
 

hippy

Technical Support
Staff member
The question is the same as the title to create Timeout When Using Serin With Qualifier for RF reception.
The answer to that is that it is not possible to do that with any reliability when using dumb RF modules. Any noise present on the RF module output which passes to the serial input will cause the timeout counter to reset and the timeout not to occur.
 

techElder

Well-known member
Yeah, I know this is not a recent thread, but a question occurred to me while working on another end of my current project.

I'm going to end up with an HC-12 RF link, but I'm not quite ready to try anything hardware on this project.

Code:
#picaxe 20X2
serin [timeout,toexit],S_out,baud,("A","B","C"),data1,data2,data3,data4
So, I understand the problem with timeout and RF noise presented by the cheap modules, but imagine this is a wired link.

What happens when the qualifier ("A","B","C") is not found? Perhaps there's another module that is sending a qualifier "D", "E", "F" on an RS485 type connection.

Will the serin command just keep looking for a qualifier in the bytes following "D", "E", "F"? Or will it time out because it didn't find it at the beginning?

I've never tried this particular combination.
 

techElder

Well-known member
Now I have done this, so perhaps I have answered my own question?

Code:
' From Hippy
Do
  SerIn C.0, N1200, ($AA,$A5), b1,b2,b3
  SerTxd( "b1=",#b1, TAB, "b2=",#b2, TAB, "b3=",#b3 ,CR,LF )
Loop
If I enter a string of characters with two different qualifiers, and the last set passing through with the correct qualifier.

"$AA,$A4,1,2,3 $AA,$A5,4,5,6"

I just don't know what happened to the first set! :D
 

techElder

Well-known member
I can't find any way to add the timeout option to the simulator. Apparently it ignores that option.

No one ever says what happens to the bytes in the stream/buffer when timeout occurs on not receiving a valid qualifier.
 

pxgator

Senior Member
Hi All,

I'm not sure if this will be useful for this thread but I'll try to describe a setup that has been 100% reliable so far with
a cheap 315mhz transmitter/receiver pair with a couple of PICAXE chips.

Link for the RF: https://www.ebay.com/itm/315MHZ-Transmitter-Receiver-SYN115-SYN480R-ASK-Wireless-Module/311579185444?ssPageName=STRK:MEBIDX:IT&_trksid=p2055119.m1438.l2649

Receiver Code:
Rich (BB code):
#Terminal 4800
#picaxe 14m2
#no_data


symbol RED = B.4
symbol GREEN = B.5
symbol rfsig = C.3
symbol beep = C.4

disabletime

low RED
high GREEN
b0 = 0
b1 = 0

main:
DO
  b0 = 0:b1 = 0
  serin [75,main],rfsig,N1200,("a9"),b0,b1    ;wait 75 milliseconds for start of a valid code
                                              ;if not received in time goto main
  if b0 = 139 AND b1 = 213 then
    toggle RED:toggle GREEN                   ;toggle bi-color LED

    sertxd ("Codes Received -- ",#b0," and ",#b1,cr,lf)

    high beep:pause 100:low beep              ;energize beeper for 100 milliseconds
    pause 1000                                ;pause for one second
    b0 = 0:b1 = 0
  endif
LOOP
Transmitter Code:
Rich (BB code):
#picaxe 08M2
#no_data


symbol leg5 = C.2
low leg5


DO
  serout leg5,N1200_4,("a9",139,213)      ;send the code
  pause 50                                ;pause 50 milliseconds
LOOP
Cheers To All

P.S. I've tested this setup to 100 meters (open space) with 100% reliability
 
Last edited by a moderator:

inglewoodpete

Senior Member
Transmitter Code:
Rich (BB code):
#picaxe 08M2
#no_data


symbol leg5 = C.2
low leg5


DO
  serout leg5,N1200_4,("a9",139,213)      ;send the code
  pause 50                                ;pause 50 milliseconds
LOOP
Cheers To All

P.S. I've tested this setup to 100 meters (open space) with 100% reliability
Hi pxgator, I don't know what the RF regulations for 315MHz transmissions are in your country but this sort of RF flooding would be illegal in Australia. I understand that 315MHz is used for car remotes and garage door openers and has many other uses in the USA.

A transmitter that can reach 100m in open space and transmitting every 50mS will tend to swamp out use of anything else trying to use this shared band.
 

pxgator

Senior Member
Hi pxgator, I don't know what the RF regulations for 315MHz transmissions are in your country but this sort of RF flooding would be illegal in Australia. I understand that 315MHz is used for car remotes and garage door openers and has many other uses in the USA.

A transmitter that can reach 100m in open space and transmitting every 50mS will tend to swamp out use of anything else trying to use this shared band.
Good point Sir.

This test was done with a 1/4 wavelength antenna ( 8.9" ) on the transmitter. With a PCB trace antenna
I don't think it would cause any interference.

Cheers to All
 

darb1972

Senior Member
Good point Sir.

This test was done with a 1/4 wavelength antenna ( 8.9" ) on the transmitter. With a PCB trace antenna
I don't think it would cause any interference.

Cheers to All
Sorry pxgator, but Pete is correct. I'm an RF specialist and I can assure you that if your range is around 100m in a fairly typical omni directional pattern, you will swamp EVERYTHING on that same band in that same range. It will cause interference. We have really strict regulations here. I'm not sure if you have a communication authority like we do in Australia, but if so, be really careful. If I was to do that, they would track me down, lock me up (in a cell with a huge guy called "Bubba") and never release me!!!

Anyway, good luck with it.
 

techElder

Well-known member
Transmitter's are not the problem in this thread. They don't use SERIN with qualifier with timeout.

The interesting topically related part of pxgator's code is:

Code:
serin [75,main],rfsig,N1200,("a9"),b0,b1    ;wait 75 milliseconds for start of a valid code
pxgator, you have an ASK module with over 100 dbm sensitivity. Everyone on two threads relates to there being enough rf noise to keep the timeout timer resetting without receiving the qualifier.

You're somewhat relating that you don't have that problem even at 100M (300FT).

Do you get locked up in the serin command line?
 

techElder

Well-known member
I'm thinking that in my serial link (HC-12), I'm going to forget the qualifier and just use the timeout serin option.

There still will be a handshake protocol to wake everything up and coded location data sent that will isolate individual transmitters.

In reality (and the HC-12 signal reliability) all I want to do is keep the receivers from hanging up in the serin command waiting for something to get transmitted.
 

pxgator

Senior Member
Do you get locked up in the serin command line?[/QUOTE said:
No Sir, no lock ups yet. So far I'm very pleased with the receiver's performance.

Cheers to All

P.S. With these cheap 315/433mhz receivers a superhetrodyne architecture
is a must for reasonable reliability. The superregen ones are way too noisy.
 
Last edited:

inglewoodpete

Senior Member
P.S. With these cheap 315/433mhz receivers a superhetrodyne architecture
is a must for reasonable reliability. The superregen ones are way too noisy.
I found that the only reliable ASK receivers were the ones with an on-board crystal. Most ASK transmitters have a crystal anyway.
 
Top