Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RS485 assistance please

Status
Not open for further replies.

mr Clauds

New Member
Hey guys...

After learning so much from Nigel and this site a few months ago, i've made huge leaps and bounds and have made a few circuits that i'm quite proud of, so firstly thank you :)

I've now completed the project I primarily started out to do with some major upgrades along the way...

Basically i have a terminal with RFID that is able to distinguish user cards from job sheets and a keypad with LCD acting as terminals for a PC. This is all working great interfacing with a PC via RS232... here is where I need help please...

Im looking at moving to rs485 instead for long distance, but have read so much conflicting info that I'm worse off now than when I started researching it...

1. If I power all terminals from a single power source, I should not need to worry about ground loops and potential difference correct?
2. Can I run the power lines inside the same shielded twisted cable without causing problems? (I figure it shouldn't be a problem since rs485 signals are opposing eachother and will therefore cancel noise)
3. Im confused with the rs485 trancievers... Could some one explain the RE and DE on the chips? How come on most schematics they are connected to one uController pin?
4. I was unable to get the PIC16F877A to work with a 20MHz crystal, I thought 20Mhz was the limit? Must I go down to 19Mhz? It is working on 4Mhz but that limits my bit banging to 4800 over 232 which is very slow...

Thanks
Claudio
 
1. If I power all terminals from a single power source, I should not need to worry about ground loops and potential difference correct?
May be, depends on how far apart and what electromagnetic environment.

2. Can I run the power lines inside the same shielded twisted cable without causing problems? (I figure it shouldn't be a problem since rs485 signals are opposing each other and will therefore cancel noise)
Yes I think so. Assuming we are just talking about low voltage low current DC power.

3. Im confused with the rs485 trancievers... Could some one explain the RE and DE on the chips? How come on most schematics they are connected to one uController pin?
Look at the data sheet.
Using the MAX485 as an example, RE is Receiver Output Enable, and DE is Driver Output Enable.
Note however that RE has a negation bar above it, it is an active low signal, whereas DE is active high.
So, connect the two together and when they are at 0v the receiver is active, and when they are at 5v the transmitter is active.

4. I was unable to get the PIC16F877A to work with a 20MHz crystal, I thought 20Mhz was the limit? Must I go down to 19Mhz? It is working on 4Mhz but that limits my bit banging to 4800 over 232 which is very slow...
Are you sure that the configuration bits are set correctly for a 20Mhz crystal?

JimB
 
Hi Jim

Thanks for the answers...
The distance will be maximum 500m, I was thinking of putting around 20v on the line with each terminal having a voltage regulator to bring it down to 5v, I was hoping that that would be high enough to still be over 5v by the time it gets to the last terminal...

My goal is to be able to have 256 terminals when the entire project is completed...
1. Would it perhaps be better to make the power ac and also have bridge rectifiers at each terminal?
2. With regards to DE and RE and 1 master and multiple slaves, does it matter what state the chip is in while the line is idle, or will it affect the impedance?
3.is cat5e cable sufficient to cope with this design or would I need to go a larger guage wire?

I just realised I hadn't setup the chip for the 20mhz... I had it on XT when it should be on HS... thanks for jogging my mind :)

Thanks
Clauds
 
Last edited:
Hi mr Clauds. A Pic16f877A at 20Mhz alone uses 7mA tipycal , the current required by a RFID terminal might go up to 100mA or more. You have to take into account that a cat5e wire has about 0.16 ohm/ meter, on both power and ground lines 0.32 ohm/meter and a total voltage drop of 0.032V/meter*terminal.
For example , one 100mA terminal , 500m cable results in a voltage drop on the power line of 16V! Worse , half of the voltage drop will go thru GND line and the common mode maximum voltage on the inputs might be exceeded. For two terminals at the end of a 500m cable the voltage drop should be 32V.
What to do ?
1) Use two cables, power line and signal
2) Use the same cable cat5e but whit distinct power and signal ground by using an isolated dc-dc converter like ASA01A18-L from EMERSON NETWORK POWER or similar, this will also improve the power efficiency , a high voltage with low current over the network will be converted in each terminal to low voltage and high current.
3) Use only low power terminals , you might switch to a low power microcontroller like PIC24F witch have the same price consumes less and is more powerful.
4) Mixed , use same cable for low power terminals and an additional power cable for the others.
 
Thanks mdorian...
How will the voltage drop differ if I run it as AC power? Or will it not make a difference?
What if I use 3 cores for power and 3 cores for ground?
Will cat5e cable be able to handle the distance for the rs485 signal?

Okay, basically here is the data i've collected... If someone could guide me on which cable to go...

Ive checked my system, it is currently drawing 43.5mA at it's highest draw with 4mhz crystal... I will be dropping the 10mA rs232 chip though and moving to RS485 which is 1mA and moving to 20Mhz crystal which is a 11mA difference (15mA max draw on data sheet).

That makes it 45.5mA draw with all max values accounted for...
Distance maximum is 500m
Terminals for now = 15 terminals

Since I want upgradability to 256 Terminals, I headed mdorians advice and have split the data cables from the power cables.
That way from the current calculations, 256 terminals should require 12.8 amps and I can adjust the power supply accordingly...

If any one has suggestions or better ways of doing this other than making each terminal have it's own power supply, I would be very grateful...

Thanks
Clauds
 
Last edited:
The distance will be maximum 500m, I was thinking of putting around 20v on the line with each terminal having a voltage regulator to bring it down to 5v, I was hoping that that would be high enough to still be over 5v by the time it gets to the last terminal...

My goal is to be able to have 256 terminals when the entire project is completed...
1. Would it perhaps be better to make the power ac and also have bridge rectifiers at each terminal?
If you were just running one or two terminals then running low voltage DC on the data cable would be OK.
But 256 terminals?!!! I think you need a separate power supply cable.
Then you say AC, do you mean 120/240v?
If so you have to offset the cost and bulk of a transformer at each terminal against distribution efficiency of a high voltage system.

2. With regards to DE and RE and 1 master and multiple slaves, does it matter what state the chip is in while the line is idle, or will it affect the impedance?
Yes, the transmitters must be turned off during idle.
Two active transmitters on one line is a recipe for frustration until you realise the mistake!

3.is cat5e cable sufficient to cope with this design or would I need to go a larger guage wire?
Should be fine for the data, but not the power given your plans for expansion.

JimB
 
The standard for Category 5 cable specifies a maximum length of 100m I don't know the reason but you can find cables better suited for RS485 network , search your local distributors for RS485 cable.
For 12amps you need at least a 3 square mm section cable and allot of trouble with high current connectors and the ground loops. Why don't you use a 120/220 power line , that way the current over the power line can be reduced to 300mA at 220V ? At least use a higher voltage and switched dc-dc converters which can make also the 5v stabilized for the terminal. For a 50V DC power line you will need only 1.2 A to supply 5V at 12A. Using isolated dc-dc converters you can avoid also the ground loops.
 
Last edited:
Thank you all for the guidance...

I will look into rs485 cable rather...
I am unfamiliar with dc-dc convertors and 102/220 power lines...
Is there any good resource to learn about it? I've tried googling it but it comes up with non beginner pages and I need to start pretty much at the beginning :)

Thanks
Clauds
 
Hey guys...

Sorry to be a pain but I've been researching and learning so much and am starting to understand things, however still need some minor guidance...

I've managed to reduce my distance to max 300m
I am using rs485 cable at 120ohm/km

Each terminal is pulling 50mA at peak (with a little extra safety margin)
Power cable will be 280v/13A power cable

What im thinking of doing is having small power supplies from the ac 220v supply.
Each power supply will have a tranformer and circuitry bringing the ac 220 down to DC50v.
I will then have 6 terminals per power supply, then simply add up power supplies as needed when the project requires more terminals...

Questions:
1. Will simply connecting each power supplies ground to one another eliminate the ground loop problems?
2. Im unsure on isolated power supplies and can't find good tutorials, if someone could share some links with me please...
3. "...that way the current over the power line can be reduced to 300mA at 220V ? At least use a higher voltage and switched dc-dc converters which can make also the 5v stabilized for the terminal. For a 50V DC power line you will need only 1.2 A to supply 5V at 12A. Using isolated dc-dc converters you can avoid also the ground loops."
Could Mdorain or someone explain the above to me in a little more detail please?

Thanks
Clauds
 
In both cases you don't need a 13Amps power line ,think in power units , how much power needs a terminal for example a 5V / 100mA terminal uses 5V*0,1A = 500mW , for a combined module terminal+ AC230V to 5VDC power supply the power required is 500mV + losses which are about 20% , total 600mW. On 230v 600mW means using 2,5mA (230V*0.0025~= 0.6W ) . For a 230V power line you will use 2,5mA for each terminal with its own power supply. You can use small power supplies like the ones used for charging mobile phones by miniusb connector they deliver 5V/500mA and they are cheap and isolated to. Almost any home wall adapter or any ac-dc adapter is isolated for safety reasons.
You can have problems with ground loops only if you use common ground line for signal and power which is not the case if you use an isolated power supply near the terminal . Of course they have a common point but not through the long data line.
 
Thanks mdorian

Would I be correct in saying that if I use optocouplers for the signal communication on rs485, then I dont need to worry where or how I source my power as long as it falls within the regulators max values and also not worry about ground potential difference?

Thanks
Clauds
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top