Stamp to stamp serial data susceptible to interference/static
Stuarttttt
Posts: 45
My latest project uses two BS2's and involves them sending data back and forth. I used the diagram in the BS2 serial help file and using the prog below the two stamps appeared to be communicating properly. The two BOE were only 6" apart. However when I installed them amongst the other project wiring (jpeg below) the data became corrupted. I found that even touching the data wire insulation would cause problems.
I have since used a screened and earthed cable for the data line and the data appears to be fine at the moment.
If the BS2 help information gets updated, would it be worth mentioning that the data line needs to be screened?
Stuart
'Stamp master
Value VAR Byte
Number VAR Byte
Main:
SEROUT 0\1, 16468, [Value]
Value = Value + 1
SERIN 0\1, 16468, 2000, No_Data, [Number]
DEBUG "Master ", DEC Number,CR
GOTO Main
No_Data:
DEBUG BELL
DEBUG " No data from Slave",CR
PAUSE 2000
GOTO Main
'Stamp slave ( 2nd BS2 code)
Value VAR Byte
Number VAR Byte
Main2:
SERIN 0\1, 16468, 2000, No_Data, [Value]
DEBUG "Slave ", DEC Value," ",CR
IF Number > 249 THEN Number = 0
SEROUT 0\1, 16468, [Number]
Number = Number + 50
DEBUG HOME
GOTO Main2
No_Data:
DEBUG BELL
DEBUG " No data from Master",CR
PAUSE 2000
DEBUG CLS
GOTO Main2
I have since used a screened and earthed cable for the data line and the data appears to be fine at the moment.
If the BS2 help information gets updated, would it be worth mentioning that the data line needs to be screened?
Stuart
'Stamp master
Value VAR Byte
Number VAR Byte
Main:
SEROUT 0\1, 16468, [Value]
Value = Value + 1
SERIN 0\1, 16468, 2000, No_Data, [Number]
DEBUG "Master ", DEC Number,CR
GOTO Main
No_Data:
DEBUG BELL
DEBUG " No data from Slave",CR
PAUSE 2000
GOTO Main
'Stamp slave ( 2nd BS2 code)
Value VAR Byte
Number VAR Byte
Main2:
SERIN 0\1, 16468, 2000, No_Data, [Value]
DEBUG "Slave ", DEC Value," ",CR
IF Number > 249 THEN Number = 0
SEROUT 0\1, 16468, [Number]
Number = Number + 50
DEBUG HOME
GOTO Main2
No_Data:
DEBUG BELL
DEBUG " No data from Master",CR
PAUSE 2000
DEBUG CLS
GOTO Main2
Comments
Do all of the relays have coil suppressors installed? ( probably a diode on the boards).
Also, did the serial lines run physically in parallel with the leads driving the relay coils?.
The shielded/earthed cable could mask any of the original issues.
Cheers,
Place 100k resistors from both receiving ports to Vss and repeat your observations...
Long time ago I tried the same in noisy environment and it helped.
Just load down the serial lines a bit. The stamp has a beefy driver. I'd try a 2K or so termination resistor on your serial lines. It can't hurt.
Greg
The relays coils do have suppression diodes although I did have the serial data line between the two stamps in parallel with all the stamp output signals. I have since re-routed the (thick grey) serial line on its own. (also left it screened) Photo attached.
Also I have screened off the relay boards from the stamp BOE's.
The main problem I believe (after prompting, ie "Its quite unusual to see an interference problem at such short distance" and "This is not typical at that distance unless there are significant EMI/RFI considerations" ) is that
I was sitting on a chair on top of a 1 m2 plastic carpet protection mat. I was probably charged up with static. If I earthed myself before touching the serial line there was no problem.
I have been testing stamp breadboard/ BOE circuits for several years and never had any problems before.
I'm wiser now, thanks.
Stuart