Symbol Old = serout,b.7,n2400,("UUUUUUUU")
Symbol New = RFin of RFout
I have been using the Old system for some time with no apparent problem to transmit temperature and humidity from a mast unit to a base unit.
Problems arose when I modified the program to record maximum and minimum values, realising that a value of 236 deg C and a Relative Humidity of 128%
were a bit unlikely.
Further investigation was prompted by this thread.
http://www.picaxeforum.co.uk/showthread.php?22213-Has-anyone-here-used-the-Sparkfun-434MHz-RF-modules-with-any-M2-PicAxe
I considered that the reasons could be
1. Corrupt transmit data
This was rejected bacause sertxd showed correct values, and changing the Tx module had no effect on the results
2.Corrupt received data
This was thought more likely and was supported by the sporadic results obtained.
A number of factors seemed to influence the results.
a) Location of the Tx and Rx units. Within the same room, minimal failures were recorded if BOTH the antennas
were removed. Up to 7 metre separation, Tx antenna removed - decrease in failures. 20 metre separation, both antennas required.
b) Old method. The preamble seems to be important. Best results were obtained with at least 12 "U"s and a "pause 10" after cleaned things up a lot.
c) TX power. I have always left the Tx powered up between transmissions. Using a Picaxe pin to apply power just before sending,
and turning the Tx off after, reduced failure further. Eclectic put me on to that in the above link.
d) Error checking. I hadn't seen this mentioned before. I believe it is inherent in Manchester Coding, and by implication is applied to the New method,
but thats assumption. Prompted by a comment from Hippy in the above linked thread I tried XORing the data before sending.
Again not really knowing the nuts and bolts of the process.Doing so enabled me to identify corrupt packets and so ignore them.
Conclusions
These are the codes and result extract for the New method
Transmit
Receive
and the sertxd extract
Transmit
Receive
And result
Clearly not a lot between them.
I shall continue with the old method, primarily because there is no need to pad out each packet to 8 bytes
I think the significant improvements are
1. Control the Tx power from the Picaxe
2. Give a decent string of "U"s for the preamble
3. Ensure a pause after the preamble
4. Introduce simple error checking.
Not bad for a pretty dumb simplex link
E&OE
Symbol New = RFin of RFout
I have been using the Old system for some time with no apparent problem to transmit temperature and humidity from a mast unit to a base unit.
Problems arose when I modified the program to record maximum and minimum values, realising that a value of 236 deg C and a Relative Humidity of 128%
were a bit unlikely.
Further investigation was prompted by this thread.
http://www.picaxeforum.co.uk/showthread.php?22213-Has-anyone-here-used-the-Sparkfun-434MHz-RF-modules-with-any-M2-PicAxe
I considered that the reasons could be
1. Corrupt transmit data
This was rejected bacause sertxd showed correct values, and changing the Tx module had no effect on the results
2.Corrupt received data
This was thought more likely and was supported by the sporadic results obtained.
A number of factors seemed to influence the results.
a) Location of the Tx and Rx units. Within the same room, minimal failures were recorded if BOTH the antennas
were removed. Up to 7 metre separation, Tx antenna removed - decrease in failures. 20 metre separation, both antennas required.
b) Old method. The preamble seems to be important. Best results were obtained with at least 12 "U"s and a "pause 10" after cleaned things up a lot.
c) TX power. I have always left the Tx powered up between transmissions. Using a Picaxe pin to apply power just before sending,
and turning the Tx off after, reduced failure further. Eclectic put me on to that in the above link.
d) Error checking. I hadn't seen this mentioned before. I believe it is inherent in Manchester Coding, and by implication is applied to the New method,
but thats assumption. Prompted by a comment from Hippy in the above linked thread I tried XORing the data before sending.
Again not really knowing the nuts and bolts of the process.Doing so enabled me to identify corrupt packets and so ignore them.
Conclusions
These are the codes and result extract for the New method
Transmit
Code:
'RFout
#picaxe 20m2
b0=0
'b1=1:b2=2:b3=3:b4=4:b5=5:b6=6
Main:
b7=$60 xor b0 xor b0 xor b0 xor b0 xor b0 xor b0 xor b0
High B.6; Power transmitter
pause 1000
RFout B.7, (b0,b0,b0,b0,b0,b0,b0,b7)
pause 50
Low B.6 ; turn off power
sertxd ("Sent ",#b0,cr,lf)
Pause 2000
b0=b0+1
GoTo Main
Code:
' RFin
#picaxe 20M2
b20=0 'Counter
b21=1 'Loop counter
Main:
RFin B.7, b1, b2, b3, b4, b5, b6, b7, b8 'Get packet. Wanted data is b1
b10=b1 xor b2 xor b3 xor b4 xor b5 xor b6 xor b7 xor b8 'Extract checksum into b10
if b10 <> $60 then sertxd ("BAD DATA",cr,lf) 'Is checksum valid?
goto main 'Failed. get next packet
endif
sertxd (#b1," ",#b2," ",#b3," ",#b4," ",#b5," ",#b6," ",#b7," ",#b8,cr,lf)
sertxd ("Count ",#b20," Loop ",#b21,cr,lf) 'Checksum OK
sertxd ("Recd ",#b1," ",cr,lf)
sertxd (cr,lf)
b20=b20+1
if b20=255 then let b21=b21+1
endif
GoTo Main
And for the Old method253 253 253 253 253 253 253 157
Count 253 Loop 2
Recd 253
254 254 254 254 254 254 254 158
Count 254 Loop 2
Recd 254
BAD DATA
0 0 0 0 0 0 0 96
Count 255 Loop 3
Recd 0
1 1 1 1 1 1 1 97
Count 0 Loop 3
Recd 1
2 2 2 2 2 2 2 98
Count 1 Loop 3
Recd 2
Transmit
Code:
#picaxe 20m2
b0=0
'b1=1:b2=2:b3=3:b4=4:b5=5:b6=6
Main:
b7=$60 xor b0 xor b0 xor b0 xor b0 xor b0 xor b0 xor b0
High B.6; Power transmitter
pause 1000
serout B.7,n600, ("UUUUUUUUUUUU")
pause 10
serout B.7,n600, ($aa,$bb,$cc,b0,b0,b0,b0,b0,b0,b0,b7)
pause 50
Low B.6 ; turn off power
sertxd ("Sent ",#b0,cr,lf)
Pause 2000
b0=b0+1
GoTo Main
Code:
#picaxe 20M2
serout b.4,n2400,(254,1)
pause 100
b20=0 'Counter
b21=1 'Loop counter
Main:
serin B.7,n600, ($aa,$bb,$cc),b1, b2, b3, b4, b5, b6, b7, b8 'Get packet. Wanted data is b1
b10=b1 xor b2 xor b3 xor b4 xor b5 xor b6 xor b7 xor b8 'Extract checksum into b10
if b10 <> $60 then sertxd ("BAD DATA",cr,lf) 'Is checksum valid?
pause 100
goto main 'Failed. get next packet
endif
sertxd (#b1," ",#b2," ",#b3," ",#b4," ",#b5," ",#b6," ",#b7," ",#b8,cr,lf)
sertxd ("Count ",#b20," Loop ",#b21,cr,lf) 'Checksum OK
sertxd ("Recd ",#b1," ",cr,lf)
sertxd (cr,lf)
'serout b.4,n2400,(254,128,"Sount ",#b20," Loop ",#b21)
'serout b.4,n2400,(254,192,"Recd ",#b1," ")
b20=b20+1
if b20=255 then let b21=b21+1
endif
GoTo Main
Count 253 Loop 1
Recd 253
Count 254 Loop 1
Recd 254
Count 255 Loop 2
Recd 255
Count 0 Loop 2
Recd 0
Count 1 Loop 2
Recd 1
Count 2 Loop 2
Recd 2
Count 3 Loop 2
Recd 3
Count 4 Loop 2
Recd 4
Clearly not a lot between them.
I shall continue with the old method, primarily because there is no need to pad out each packet to 8 bytes
I think the significant improvements are
1. Control the Tx power from the Picaxe
2. Give a decent string of "U"s for the preamble
3. Ensure a pause after the preamble
4. Introduce simple error checking.
Not bad for a pretty dumb simplex link
E&OE
Last edited: