Working with RS485


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default Working with RS485

    Hi, im back to my disco lights again now i have a little money. Im going to use RS485 now as recommended by people on here. Ive had a look on google and it appears there is a MAX485 chip.

    Ive read on the net that there is a need for a 3rd wire to link the grounds together and a shielded wire. The wires im using are XLR Mic/DMX wires. The longest is 20 meters and works fine for DMX. Im not sure if these wires are shielded or even twisted pair though. I would have thought not since there are 3 wires inside. Ive never noticed any interference while using them with DMX lights so will they work with RS485?

    Does 3 wires mean i can only have a 1 way signal? The diagram at the bottom of page 7 in that datasheet almost makes it look like i can have a 2 way signal but i cant see how that would work.

    How do i connect this chip to a PIC chip? Is it as simple as putting wires between the 2 or do i need resistors etc? Looking at that diagram it appears i dont need any external capacitors like i do with MAX232. Is that right?

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Here is a very thorough white-paper on RS485.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    That looks really interesting. Ive only read the first page so far but it seems to be making sense. From what i can see it looks like only 1 device can be sending at any one time but it can stop sending and allow another device to send instead. I think thats why there are 4 pins on the MAX485 chip for data. 2 of them look like they switch between sender and receiver. It sounds a bit like DMX and would explain why manuals for DMX lights say you can damage them by having 2 devices set to master at the same time.

    I dont *need* bi-directional communication but it would be nice. There will be a master box which takes an input from RS232 or USB and converts it to RS485. Everything else will simply listen but it would be nice to add functionality for each device to become a master if the main box fails or the PC crashes.

    I will continue reading about it tomorrow when i have more time.

    Thanx for that. Even just the first page is a huge help

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    If you also read the DMX512 specification you will see that it is essentially a variation on RS485, running at very high speed and with the master constantly repeating commands (or state table). Cables that work for DMX512 should also work for RS485 although perhaps not at the extremely long distances possible with RS485. Before interconnecting grounds you need to measure the difference in potential (i.e. voltage difference). If more than 7V, connect to local ground through a 100-ohm 1/4W resistor. This is detailed in the official RS485 specification. You might also do a web search using "Jan Axelson RS485". You should find a few magazine articles by her, including one which shows using a 555 timer chip to automatically reverse the line after a transmission. She writes very clearly.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Just a thought, All of these lights will almost certainly be run from the same AC socket. If not then definately in the same building. Each one will have its own transformer though. Is that what causes the ground difference?

    The total distance between the master and the final slave wont be more than 50 meters.

    Im not quite sure i understand ground difference properly. Each device has a transformer so its isolated from the mains. i cant see how i could get a reading accross 2 grounds unless im thinking of something different. Im sure this is explained in the rest of that document though

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive read all of those documents. I understand the one about DMX but the ones about ground loops are a bit confusing. From what i can see i shouldnt have a problem because all devices are isolated from the mains using a transformer for power and opto isolators for the triacs. There are earth wires going inside the lights but they dont connect to anything since the lights are made of wood. Each light has IEC in and out sockets so all of the lights could be run from a single socket. In practice i will probably have them in 2 groups (left and right) but no matter how many groups i have they will all plug into an extension so they will all run from just one wall socket.

    I wouldnt have thought i would have any problems because of all the low voltage stuff being completely isolated from the mains and the short cable distance but i have noticed problems with my speakers before. If i connect a laptop to my mixer at the same time as my speakers i get very loud buzzing until i press the ground lift button on both speakers. That happens with the laptop, mixer and speakers all plugged into the same extension

  8. #8
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Ive read on the net that there is a need for a 3rd wire to link the grounds together and a shielded wire.
    If you do that, then you have to be concerned about ground loops. Read the section on grounding in the B&B app note.

    Ground loops are very difficult for most people to understand. If there's any current flow between "ground" points, there can be problems. And, the fact that ground loops can act like a loop antenna with currents induced by electromagnetic fields complicates things even more.

  9. #9
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I think i kinda understand the problems you get with ground loops but i cant seem to relate that to an RS485 connection. As far as i know you get 2 wires (A and B) and the output to the PIC chip only changes if there is more than 200mv between A and B and it changes to 1 or 0 depending on which input has the highest voltage. Does that mean that you dont need a 3rd wire running between devices if its on a small scale?

    I re-read the app note about grounding and there are 2 drawings. I think i might need the one in Figure 4.4 Isolated RS-485 Device. The only thing im not sure about is that that drawing shows the ground isolated from the circuits ground. Is it not enough to have the circuit etc isolated from the mains ground?

  10. #10
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Does that mean that you dont need a 3rd wire running between devices if its on a small scale?
    A 3rd wire is going to defeat your isolation. In many networks, power is supplied over the cable from a single source. That leads to mixing grounds and requires attention.If you will power each node individually, you don't have that problem.

    I re-read the app note about grounding and there are 2 drawings. I think i might need the one in Figure 4.4 Isolated RS-485 Device. The only thing im not sure about is that that drawing shows the ground isolated from the circuits ground. Is it not enough to have the circuit etc isolated from the mains ground?
    You have to either isolate it completely or deal with the mixed grounds. A little mixing of grounds is akin to being a little bit pregnant.

    The simplest thing to do is run the ground wire between nodes but connect it to each local ground through 100-ohm current limiting resistors.

    I recomment Jan Axelson's Serial Port Complete which covers RS232 & RS485. The subject is complex and really cannot be covered here.
    Last edited by dhouston; - 8th July 2008 at 19:54.

  11. #11
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I will google "Jan Axelson's Serial Port Complete" tomorrow. Im off to bed now.

    What exactly do you mean by "isolate it completely" is that having each device isolated from the rest of them or having each device isolated from the mains using a transformer?

    You seem to be saying that i shouldnt have the 3rd wire in this case but then you say the easiest thing is to have one. I think i might have misunderstood on of those paragraphs.

    You really wernt joking when you said "Ground loops are very difficult for most people to understand". I definately fit in the "most people" category

Similar Threads

  1. Blink.Bas on 18f45k20 Newbie seeks working example.
    By DiscoEd in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th December 2009, 03:36
  2. RS485 splitter
    By The Master in forum Off Topic
    Replies: 0
    Last Post: - 30th August 2009, 06:04
  3. RS485 Vs Wireless (TWS-434A)
    By koossa in forum Off Topic
    Replies: 3
    Last Post: - 11th April 2009, 12:40
  4. Using 16f676 with comms
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2005, 20:01
  5. Hserin not working...
    By robert0 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd August 2005, 12:25

Members who have read this thread : 0

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