RS-485 versus CAN

Go To Last Post
33 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working on an update to my weather station and need to decide how to bring the data into the house from the station itself.

My existing station is mounted to the outside wall of my garage and interfaces to the netbook that collects the data over a short (1 meter) RS-232 cable. The new station is going to be 40 meters from the house and mounted at the top of a 3 meter tower. I'd like to use something more robust than RS-232 here.

The two options I've considered are RS-485 and CAN. I have no experience with either, so that's not a criteria. The MCU I'm using has serial ports (for RS-485) and CAN ports, so that's covered.

Any recommendations?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd use RS485 only because I have no idea about CAN. :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

+1

CAN can be a pain in the CAN ;)

RS-485 is a physical layer. You can get rid of your 232 drivers. and substitute rs485 in their place and your done if all the 232 is doing is tx/rx

The only hang up is if the station is doing simultaneous tx and rx, then use two sets of '485 driver/receivers and two pairs of wires.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RS485 is an electrical standard. CAN is both the electrical standard and the protocol.
If you reduce the question to "This 8 pin transceiver vs. this other 8 pin transceiver", the difference becomes pretty simple:

An RS485 transceiver has a threshold close to 0V differential, and drives +3V/-3V or so into the cable. The noise margin is roughly 3V.

The CAN transceiver is half an RS485 transceiver with receiver offset. It drives +3V/HiZ, and depends on the termination resistors to bring it back to 0. In order to make signalling work, the receiver differential threshold is around 1V, and thus the noise margin is around 1V.

My suggestion is to go with RS485. CAN transceivers are the way they are because they need to perform wired-AND on the bus, which is required for CAN arbitration to work.

I've done RS485 over 1500m at 230kbps. And it looked pretty on the far end. So 40m is nothing.

/Kasper

Last Edited: Fri. Apr 27, 2012 - 11:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SodAnt:

Turn this thread into a Poll. Could be interesting to see the results

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
, and drives +3V/-3V or so into the cable
hmm the ones I have used drive about 200mV into the load (60 ohms).

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js: You need to remember to connect VCC :-).

An old but reliable one, such as MAX487, will drive 2V(min) into 50 ohm, and have a receiver offset error less than 200mV.

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your witness JS

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP is correct :oops: sorry, that's what happens when one types before coffee is used in the morning.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If RS232 is chugging along .. why bother.

It was originally designed for longer length than 40 metre.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ignoramus wrote:
If RS232 is chugging along .. why bother.

Primarily because I've never done either, and I like working with something new.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With 485 you will need somethjing to control data flow as it works half duplex. If your 232 link is full duplex, look at RS422. it is point to point low impedance communications via two twisted pairs ove long distance.

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd use RS422/485. CAN is too complex for just two nodes; but it would easily allow for more nodes in the future, without any major changes to the protocol. Also most of the ack/retransmission/fault detection stuff and things has already been thought out and implemented.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd also consider skipping the wires and go wireless. Canned modules are readily available and not too expensive. The distance should be fine, especially if real antennas are used.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
My existing station (..) interfaces to the netbook(..)The new station is going to be 40 meters from the house and mounted at the top of a 3 meter tower.

I would not use a wired communication. Not when you want to hold one end of the wire in your hand with the other end attached on a 3m tower.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brutte wrote:
Quote:
My existing station (..) interfaces to the netbook(..)The new station is going to be 40 meters from the house and mounted at the top of a 3 meter tower.

I would not use a wired communication. Not when you want to hold one end of the wire in your hand with the other end attached on a 3m tower.

I still need to get power to the station, so I will need a cable to the tower irregardless of how I get data out of the station and into the house.

I live in an area where lightning storms are very rare, so that's not a big concern. The tower is properly grounded, and sits right next to my 30 meter tower, so even if it's hit by lightning, which is unlikely (it's in the "shadow" of the taller tower), I've taken proper precautions to keep the surge out of the house.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can is good for a dozen nodes at 1 megabit all talking at the same time. I'd just run a 3 wire cable, put juice on one wire, put rs232 back from the outside on the other wire. Put a cap and a MOV out on the pole, done.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RS-422 if you need noise protection, RS-232 otherwise. RS-485 and CAN are both unnecessarily complicated for this application. Between those two - I'd probably go with RS-485 as you should be able to get up and running faster (CAN takes a little while to understand). You will have to design your own protocol for RS-485 though, which could be a pain.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But RS485 and juice takes 4 wires. One way RS232 and juice takes 3 wires. That's cheaper.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

CAT5 cable vs WHAT? :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK John. Now we need to know the amps needed by the weather station so we can calc the volt drop in the cat5 cable. Might need to ship 8 or 9 volts down the wire to wind up with enough to keep the regulator working.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using cat 5 cable to the station. It has 24 AWG wire, so assuming 50 meters total length, the resistance of the cable will be 4.2 ohms. My power supply is 150 mA at 12v, so the voltage drop over 50 M of cable is ~0.6v. The first regulator is an LM7805, so no problem with 11.4v at its input. I can easily drop the supply voltage down to 9 volts and still not have any problems with the regulator.

In case it wasn't clear from my original post, this is a hobby project and I don't need to save pennies by keeping the number of wires down to three, or anything like that. It's also a learning experience, which is why I'm considering RS-485 and CAN, even though they're probably much more complicated than a simple RS-232 link.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
they're probably much more complicated than a simple RS-232 link.
If you use RS422 (bidirectional 4 wires) it is just the same as RS232 software wise.

It can however go up to 4000ft as you are still using RS485 driver chips and the lines are balanced.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd use RS484. It's simpler to change RS232.

As for the wires. Don't you scare the lightnings? If it strikes your cable you'll have ashes instead of your notebook)))

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, I'm not scared of lightning. See one of my posts earlier in this thread for my comments on why I'm not worried about lightning.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

KKP wrote:
The CAN transceiver is half an RS485 transceiver with receiver offset. It drives +3V/HiZ, and depends on the termination resistors to bring it back to 0. In order to make signalling work, the receiver differential threshold is around 1V, and thus the noise margin is around 1V.
This noise margin only applies to differential signal levels in the CAN recessive signal state. The common mode noise rejection is obviously far higher. Each CAN node has its own passive bus- pull down, so the primary job of a simple termination design is to terminate reflected signal energy at the bus ends, although it does also provide a DC/AC load for the CAN bus. There are also designs with weak termination on each stub node. Actual real world CAN bus performance is impressive since it provides reliable up to 1 mbps communication in environments like an automobile electrical system.
SodaAnt wrote:
No, I'm not scared of lightning. See one of my posts earlier in this thread for my comments on why I'm not worried about lightning.
If you get a direct hit, no protection of any kind will work or make any difference. The wires will turn into metallic vapor. Lightening problems are usually not so much from direct hits, but from near misses. The huge ground currents and induced energy from a near miss will still turn solid metals into charred debris, let all the smoke out of your components or do something as delicate as unsoldering connections :wink:. The not too near lightning strike miss is where circuit/wiring lightning protection comes in handy. Your 30 meter tower is an invitation for a near miss on your 3 meter tower.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mike B wrote:
If you get a direct hit, no protection of any kind will work or make any difference. The wires will turn into metallic vapor. Lightening problems are usually not so much from direct hits, but from near misses. The huge ground currents and induced energy from a near miss will still turn solid metals into charred debris, let all the smoke out of your components or do something as delicate as unsoldering connections :wink:. The not too near lightning strike miss is where circuit/wiring lightning protection comes in handy. Your 30 meter tower is an invitation for a near miss on your 3 meter tower.

Both towers were installed by a professional tower installer and have extensive bonded grounding systems. In fact, the 30M tower took a direct hit a few months back during a rare (for our area) lightning storm with no damage to the antennas on the tower, the feed lines, or any of the equipment in my shack.

So, yes, it is possible to deal with lightning. If this weren't the case, then all of the television and radio stations in Florida would have gone bankrupt by now replacing equipment destroyed by the frequent electrical storms common to the area.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where was your area once again?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

S.F. Bay Area.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I question if you really had a direct hit on your tower. One of our local guys dealt with a properly grounded metal container building converted into a radio vault that took a direct strong hit. There were several holes in the roof that you could put your fist through and radio racks were blown all the way across the vault, then a fire inside the building burned the equipment. Also keep in mind ground rods grounding quality often deteriorates over time, depending on the soil type. We recently dealt with a communications antenna that took a near miss. It still worked, except the wind induced Rx noise in the antenna, but the hard line survived. The repair guy found what "looked like" carbon granules in the base of the antenna. This antenna is designed to absorb as much damage as possible in its base to help save other equipment, if possible.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've decided to maximize complexity here and go with the CAN option.

This is straightforward on the MCU side as the MCU I'm using has a built-in CAN port and PHY, but what to do on the PC side? The indoors part of the weather station is a netbook running Windows 7. In its current incarnation, I use a simple RS-232 -> USB adapter to get the serial data from the outdoor part of the station into the PC.

I assume I can do something similar with a CAN <-> USB adapter like this one: http://zanthic.com/can4usbfx.htm.

The code running on the netbook is written in C# .NET, and I use the standard serial components. Do CAN <-> USB adapters typically come with a driver or .DLL that's compatible with C#?

And regarding the tower, yes it was a direct hit -- I have the video to prove it. Very dramatic and scary at the same time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you mention if its 2 way or 1 way comms? Did you mention the data rate and amt of data? Lets say its one way and you continually send temoerature, humidity, wind dir and speed in some binary packet, maybe a dozen or so bytes. I can't imagine it has to update faster than a couple times a sec, so some old slow transformer coupled current loop at 2400 bps would work great, and have complete isolation.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Build two nodes with your mpu. One can be your rs232-CAN converter. What is your mpu?

Dr. David Harris OpenLCB Development Team openlcb.org