Most reliable communication method

PiX

New Member
Hi Forum,
I have a commercial project which will use two Picaxe's, one in the control module and the other in a handset 5 metres away.

For reliability which communication protocol would be best, serial TTL, I2C or SPI ?

The interconnection cable is not yet specified so it could be shielded and even have twisted pairs or shielded pairs, your advice onthis would also be appreciated.

Thanks in advance.
 

MFB

Senior Member
Over 5 metres RS-485 would be the most reliable, assuming the use of screened four-core twisted pair cable. You would of course need RS-485 buffers for each PICAXE.
 

PiX

New Member
Thanks, that make sense.

I'll use MAX485 buffers and, to keep it cheap and the connector size small (it has to be routed through some bulkheads), I'll use Ethernet patch cords, the FTP type.

This raises the question of running power and ground for the remote Picaxe down the same cable?
 

oracacle

Senior Member
look into power over Ethernet
I would use a twisted pair for each direction of coms, and a single wire for power. leaving 2 spare wires.
ideally keep the tx and rx to same standard as Ethernet base 100t. make sure you mark it as POE so no mistakes are make with other hardware.

also nearly forgot, although it should not be an issue, CAT5 does have which iirc is something like 0.1 ohm per meter. I doubt impedance will be too much of an issue either.
 
Last edited:

hippy

Technical Support
Staff member
It should be possible to use ethernet cabling. It is sensible to put balanced serial down a twisted pair ( two pairs if separate TX and RX ), then double-up a spare pair for 0V and another pair for +V.

Get some test software working with a simpler direct connection over a short distance before adding RS485 drivers ( or whatever ) and longer cables. That way you will know it is not a software issue if there are problems.
 

grim_reaper

Senior Member
I agree with all of the above comments, and would definitely recommend what hippy suggests about doubling your cores for power and ground. The connections on ethernet patch cables are designed to handle frequencies, not current!

I would be extremely surprised if you have any problems over 5m. I've got data cables at home between 8 and 15 metres, with 5v, ground and serial signals (direct between 'axes) with no problems at all (although they're routed well away from the mains and use low (9600) baud rates). We used to have issues with ethernet comms 10-15 years ago over 1000m of cable, before CAT6 and fibre took over (at work, not home).

Good luck, and do let us know how it goes - I might be needing 485 for some 30-40 metre runs in the future.
 

inglewoodpete

Senior Member
While RS485 would be the most reliable medium to communicate over 5 metres, no method can come close to being 100% reliable without some form of error checking of the received data packet.
 

PiX

New Member
An update on my RS485 comms and another thread I posted on using interrupts to prompt a serout or serin command:

Hardware
Master panel using a 20X2 plus a MAX485 for comms and 3x shift registers+3x 7seg displays
5m foil screened ethernet cable, 4 twisted pairs, 5V GND Rx Tx
Remote panel using an 18M plus a MAX485 for comms and a pushbutton

Aim
Pressing pushbutton on remote panel forces 18M2 interrupt
Upon interrupt a variable is incremented then it is transmitted serially to the master panel
Master panel is waiting for an interrupt on the SERIN pin
Upon interrupt the variable received is sent to the 3-digit display
(note, this is a description of the test software I've written so that the checked code can be incorporated in a bigger system)

What works
The interrupt on the remote panel is activated when the pushbutton is pressed
Prior to sending the variable the 18M2 Tx pin is 'blipped' first to force the interrupt on the master panel (based on forum advice - works a treat!)
The interrupt on the master panel is activated when its 20X2 Rx goes high (the blip), then receives the variable (based on forum advice have tried with and without a qualifier - doesn't seem to make any difference, again works perfectly)
The variable is sent to the display (based on forum advice again although the 74HC595 thread could do with a reference to the SHIFTOUT command which simplifies matters)

What doesn't work
Each time the pushbutton is pressed the number on the display increments, but by 2 each time, reliably.

What could be happening?
Here's where I need some advice please....
1) switch bounce - tried both software and hardware debounce
2) using twisted pairs in the Ethernet cable - surely connecting two wires for each of Rx and Tx wouldn't mean the variable is received twice and somehow added?
 

eggdweather

Senior Member
Have you tried adding a simple delay in your interrupt routine to help de-bounce the switch say 50mS, also you are clearing the interrupts at the end of the interrupt routine not at the start? Otherwise it will interrupt again...
 
Top