Long distance Communicating between PICs


Closed Thread
Results 1 to 12 of 12
  1. #1

    Default Long distance Communicating between PICs

    Good day Picers

    Does anyone know what is the maximum cable length that 2 PICs can communicate over, or is there another way to do for instance 30 meter communication.
    Is it also possible to share one power source over the long distance cable?

    I want to have 1 base station that communicates with a couple of client stations with between 5 meters and 30 meter distance between the stations?

    Thank you very much
    koossa

  2. #2


    Did you find this post helpful? Yes | No

    Default RS422/485 or transformer isolation needed

    RS 422 and RS 485 are well established hardware approaches for medium distance data communications up to a few hundred kbps. They were designed for factory systems, essentially under one roof and powered by one substation. They are both tolerant of ground potential differences of about 15 volts. For more reliable longer distance communications nothing beats transformer isolation which can tolerate ground differences to thousands of volts. With both the above you will probably need to use Bi-Phase modulation or possibly Manchester coding.

    Radio is not as simple as may first appear but might also be a good alternative up to a few hundred metres. Bi-Phase modulation is best IMHO and Manchester a good second place for radio.

    Within one laboratory where all devices are powered off one phase of the mains, you can get away with one power source for the entire system and sending ground, power and data to/from remote devices up to about 50 metres at 50 kbps over ribbon cable. Double up the power and ground wires and make sure you terminate the data (and any clock) lines with a 120 Ohms, 100 nF network to suppress ringing. I use this routinely with a five wire interface. One pin is ground, another power. A third is the ATTention line, another the ACKnowledge line. The fifth wire is the DATa line. Lines 3, 4 and 5 are bidirectional and use weak pullups or 1 k for longer distances. This lets me set up a peer to peer network with 16 or more devices over about 50 metres at 57600 bps.

    To send, a station looks at the ATTention line and if it is high (the idle state), it pulls it down and starts broadcasting the destination address on the DATa line. When the destination gets around to checking the communications interface it seen the ATTention line low and its own address on the DATa line. It then responds by pulling the ACKnowledge line low . The calling party now sees the ACK line go low so it starts broadcasting the checksummed data packet to the desired destination. The sender keeps repeating the packet until the ACK line is released by the destination. That signals the message has got through error free.

    Any station can call any other station and devices that are very busy do not have to spend much time looking for the ATT line low and their address on the DATa line.

    HTH
    Brian

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,806


    Did you find this post helpful? Yes | No

    Default

    1. Communication

    As I can understand it, you need the system to work on a bus and send and receive from nodes. I would suggest to use RS-485 with seperate pair for Tx and Rx. I mean one driver for Tx and one more for Rx on every node.

    Max distance 1200 meters.

    2. Power supply

    If you use UTP cable then 2 pairs are reserved for the data connection and the rest 2 pairs can be used to distribute power to the nodes. I would suggest here to use high voltage on the power supply and use a SMPS regulator on the nodes. A cheap one like LM2576 3A (http://www.national.com/mpf/LM/LM2576.html) is more than OK.

    Hope it helps.

    Ioannis

    P.S. Brian got me on the corner!

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thank you both for your feedback, I will do some studying on these options, because I don't know much about it.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    - What is the maximum distance that I would get with RS232?

    - Will it be possible to connect a 12V transformer on 2 of the wires and at every station have a 7805 chip to take it down to 5v?


    Regards
    Koossa

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    The best I been able to do with any reliability is about 85 feet using RS232 and one of the MAX inverter chips. The extra chip is to generate true RS232 voltages in this case.

    The standard for RS232 will swing from -12volt to +12 volt. The PICs running on 5 volts work fine as do most of the computers that have a serial port with a +/-5 volt swing(have not seem a true voltage level for some time) for maybe 50 feet with good cable.

    The 7805 would also work to power the nodes.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,806


    Did you find this post helpful? Yes | No

    Default

    On what cabling to connect the transformer? On RS-232 standard cabling there are signals on every one of the 9 cables. So this is a little risky.

    A 12V could do OK I supppose on short length. But on the 7805 a heat sink should also be used, and depending on the load, maybe a large one. That's why I suggest a cheap and easy switch mode regulator.

    Ioannis

  8. #8


    Did you find this post helpful? Yes | No

    Default

    I will be using the RS485 Interface and just want to make sure that I'm on the right track (See Attachment)?

    I want to make use of 4 twisted pair cables, 2 for the Serial comms between the stations and 2 for the power (don't know if 12volts is too much?)

    The Base station (Top) will continually ask each station it's status. When it receives a reply or reach a timeout it will move on to the next one.

    The cable length between the stations will be about 20 meter (65ft) and I rather want a reliable connection than a fast one.


    Thank you
    Koossa
    Attached Images Attached Images  

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,806


    Did you find this post helpful? Yes | No

    Default

    That exactly was the idea that had implemented long ago using standard UTP cable and distributing power through the free pairs to the slave devices. My setup had 1 master and up to 4 slaves at very slow speeds. But when all 4 slaves were connected, one was loosing communication from time to time. I have not found why up to this moment.

    I am suspecting that the bus is at 3-state when no device is active and this is producing an error.

    I used the ADM483EAR chip instead of SN75176 because of the fail safe protection. On a recent system I returned to the good old 176 and everything is cool. I added external resistor for the fail safe protection though.

    Ioannis

  10. #10


    Did you find this post helpful? Yes | No

    Default

    Thank you very much Ioannis!

  11. #11
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    We did something similar a few years ago, except that instead of running two twisted pairs we used 18 gauge thermostat wire for the power, and ran 24 volts alternating current, supplied by a standard HVAC transformer. Each node then had it's own 7805. The SN75176 requires about 30 milliamperes for itself, plus the PIC and any additional circuitry. We kept the power wire separated from the data wire as much as possible. Some of our runs exceeded thirty meters between nodes, and voltage drop was noticible when using a smaller gauge wire.

    Parallax has a nice little application note available at;
    http://www.parallax.com/dl/docs/prod...munication.pdf
    They also have an example program written for the Basic Stamp that should get you started. If you keep your data rate low you may get away without terminating resistors, but anything above around 9600 baud and you will likely need them.

    Jerry.
    If your oscilloscope costs more than your car...

  12. #12


    Did you find this post helpful? Yes | No

    Default

    Thank you very much Jerry!!

Similar Threads

  1. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  2. Communicating between two PICs over DC bus
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2009, 12:57
  3. How long distance for RS232 ?
    By iugmoh in forum General
    Replies: 7
    Last Post: - 25th February 2008, 13:06
  4. Retrieving infos from multiple PICs on a bus/chain
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th October 2007, 04:42
  5. Long Distance Input's to Pic
    By GregK in forum General
    Replies: 3
    Last Post: - 21st April 2005, 09:37

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts