Buzby
Senior Member
Hi All,
I have built two handheld battery operated transmitter units, each with a PICaxe 20M, a 433MHz Tx module, and four switches. I have also built a receiver, again with PICaxe 20M, and eight relay outputs driven by a 2803. The purpose of the system is to operate each relay from a specific switch, i.e. the 4 switches on one Tx operate 4 relays, and the other Tx operates the other 4 relays. The required operating range of the system is less than 20 metres.
My code, ( which I can't post here yet, because I left my pendrive at home ! ), does something like this:
Each Tx runs a loop, checking the switch states and building a nibble from them. Each time round the loop if the nibble value is different that last time then a switch must have changed, so a serout is triggered. The serout looks something like this :
serout 1,T1200,(“xxxxxxxxABC”),nibble,"A"
The "xxxxxxxx" is to give the Rx something to sync on. ( I don't know if this is essential. )
The "ABC" is the qualifier that the Rx serin will react to.
The nibble is the switch states. ( Actually its a byte, but only four bits are used.)
The "A" character is to identify which Tx the is, "A" in one Tx and "B" in the other.
The receiver is just a serin like this :
serin 1,T1200,(“ABC”),b1,b2
The code sits waiting on the serin for the "ABC" qualifier, then gets the nibble into b1 and the Tx ident into b2. A bit of decoding then operates the relays.
It all seems to work fine, but I want to iron out a glitch that I can't fully envisage how to solve. If a switch on each Tx changes state within a small time window, both Tx's send at the same time, and the receiver gets a mishmash of both radio signals. The serin doesn't trigger, and no relays change state.
My obvious first task is to reduce the critical time window to its shortest possible value. ( I'm thinking of pushing the baudrate up to reduce the time the radio is busy. Whats likely to be the reliable baud limit ?. Does anyone have any other ideas ?. )
This will not solve the problem totally, but will reduce the occurence.
My next idea is to transmit each message more than once, but I think that this might just shift the time frame, so that two switches at the same time will work, but will not work if they are at slight different times.
I'm sure there must be some algorithm for solving this type of issue, but I don't know where to start looking, so I've asked the Fount Of All Knowledge !.
Cheers,
Buzby
I have built two handheld battery operated transmitter units, each with a PICaxe 20M, a 433MHz Tx module, and four switches. I have also built a receiver, again with PICaxe 20M, and eight relay outputs driven by a 2803. The purpose of the system is to operate each relay from a specific switch, i.e. the 4 switches on one Tx operate 4 relays, and the other Tx operates the other 4 relays. The required operating range of the system is less than 20 metres.
My code, ( which I can't post here yet, because I left my pendrive at home ! ), does something like this:
Each Tx runs a loop, checking the switch states and building a nibble from them. Each time round the loop if the nibble value is different that last time then a switch must have changed, so a serout is triggered. The serout looks something like this :
serout 1,T1200,(“xxxxxxxxABC”),nibble,"A"
The "xxxxxxxx" is to give the Rx something to sync on. ( I don't know if this is essential. )
The "ABC" is the qualifier that the Rx serin will react to.
The nibble is the switch states. ( Actually its a byte, but only four bits are used.)
The "A" character is to identify which Tx the is, "A" in one Tx and "B" in the other.
The receiver is just a serin like this :
serin 1,T1200,(“ABC”),b1,b2
The code sits waiting on the serin for the "ABC" qualifier, then gets the nibble into b1 and the Tx ident into b2. A bit of decoding then operates the relays.
It all seems to work fine, but I want to iron out a glitch that I can't fully envisage how to solve. If a switch on each Tx changes state within a small time window, both Tx's send at the same time, and the receiver gets a mishmash of both radio signals. The serin doesn't trigger, and no relays change state.
My obvious first task is to reduce the critical time window to its shortest possible value. ( I'm thinking of pushing the baudrate up to reduce the time the radio is busy. Whats likely to be the reliable baud limit ?. Does anyone have any other ideas ?. )
This will not solve the problem totally, but will reduce the occurence.
My next idea is to transmit each message more than once, but I think that this might just shift the time frame, so that two switches at the same time will work, but will not work if they are at slight different times.
I'm sure there must be some algorithm for solving this type of issue, but I don't know where to start looking, so I've asked the Fount Of All Knowledge !.
Cheers,
Buzby