Hi all,
just wanted to share my recent discovery:
I'm sure many people know those cheap, simple 433 MHz transmitter/receiver pairs which are supposed to be a drop-in into a serial data line (receiver will simply mimic the level on the transmitter, so you connect the transmitted to the Picaxe which does serout, and the receiver to the Picaxe that does serin).
Again, anybody who worked with those devices knows about the necessity of a preamble (several 0x55's = 0b01010101 or 0xaa's = 0b10101010) to pre-condition the receiver, and a qualifier (like "data") preceding the actual data so the receiving Picaxe avoids reading in bogus data.
Now ... I did all that and my link still lost about one data packet out of four. My suspicion was that before any data comes, the Picaxe receives a random data stream from the receiver (because the gain control is wide open and any random radio noise shows up as data). Now if the Picaxe happens to be just in the middle of reading a bogus data byte when the true preamble starts, there is a chance it will never correctly synchronize to the start of the true bytes, and thus mis-read the qualifier --> data packet lost. Indeed that seems to be what is going on.
Now the simple solution (simple after I stumbled across while daydreaming and sweating for an hour on the treadmill :
- do the preamble as usual, which gets the receiver conditioned
- then, SEND NOTHING for a little more than one data byte (1 start bit, 8 data bits, 1 stop bit, i.e. 10 bits in total or e.g. 4.2ms at 2400 baud). This will make sure that wherever the receiver was at the end of the preamble, it is now idle and eagerly waiting for the next start bit. Just don't wait much longer than one byte, otherwise the receiver will lose lock again.
- now send qualifier and data
End result: just sent over 10000 data packets across the room without losing a single one.
In Picaxe language, sender side:
serout 0, T2400_4, (0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,)
pause 5
serout 0, T2400_4, ("data", b0)
In Picaxe language, receiver side:
serin 0, T2400_4, ("data"), b0
Wolfgang
just wanted to share my recent discovery:
I'm sure many people know those cheap, simple 433 MHz transmitter/receiver pairs which are supposed to be a drop-in into a serial data line (receiver will simply mimic the level on the transmitter, so you connect the transmitted to the Picaxe which does serout, and the receiver to the Picaxe that does serin).
Again, anybody who worked with those devices knows about the necessity of a preamble (several 0x55's = 0b01010101 or 0xaa's = 0b10101010) to pre-condition the receiver, and a qualifier (like "data") preceding the actual data so the receiving Picaxe avoids reading in bogus data.
Now ... I did all that and my link still lost about one data packet out of four. My suspicion was that before any data comes, the Picaxe receives a random data stream from the receiver (because the gain control is wide open and any random radio noise shows up as data). Now if the Picaxe happens to be just in the middle of reading a bogus data byte when the true preamble starts, there is a chance it will never correctly synchronize to the start of the true bytes, and thus mis-read the qualifier --> data packet lost. Indeed that seems to be what is going on.
Now the simple solution (simple after I stumbled across while daydreaming and sweating for an hour on the treadmill :
- do the preamble as usual, which gets the receiver conditioned
- then, SEND NOTHING for a little more than one data byte (1 start bit, 8 data bits, 1 stop bit, i.e. 10 bits in total or e.g. 4.2ms at 2400 baud). This will make sure that wherever the receiver was at the end of the preamble, it is now idle and eagerly waiting for the next start bit. Just don't wait much longer than one byte, otherwise the receiver will lose lock again.
- now send qualifier and data
End result: just sent over 10000 data packets across the room without losing a single one.
In Picaxe language, sender side:
serout 0, T2400_4, (0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,)
pause 5
serout 0, T2400_4, ("data", b0)
In Picaxe language, receiver side:
serin 0, T2400_4, ("data"), b0
Wolfgang
Last edited: