Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:43 01 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CAN or RS485?

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9585
Posted: 02:45am 07 Apr 2016
Copy link to clipboard 
Print this post

Hi folks.

I am looking at both these bus protocols, and can't decide which one is best.

Can those who have used either or both, please enlighten me some more?

I have been able to gather that both 485 and CAN are differential-bus type arrangements with a D+ and D- line to minimize any interference, but other then that, I can't decide which is better to use.

I need to have the bus on a simple 4 or 6 wire security cable, with up to 26 nodes.
Total length of cable run start to finish would be in the area of 200-250 meters, and space between nodes on the bus is anywhere from five meters to ten or more meters.

Looking at 485, I was going to use that with a couple of flow-control lines(RTS/CTS kind of thing) to prevent collisions.

CAN may well take care of that for me.........(hope, hope!)

If anyone has any insights to either bus, I would love you to post here.

Thanks.

EDIT: I am looking at something like this CAN module which has a 2515 CAN controller IC paired with an actual CAN transceiver to make one simple solution kind of thing - that's what I am looking at now, anyway....

EDIT: Forgot to mention that all the nodes are transmit, with one central receive point. All the nodes are attempting to contact the central controller when tripped, in other words. I don't need them to talk to each other if you see what I mean. Data payload is less then ten bytes.Edited by Grogster 2016-04-08
Smoke makes things work. When the smoke gets out, it stops!
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2428
Posted: 03:46am 07 Apr 2016
Copy link to clipboard 
Print this post

CANbus specifies both the physical layer as well as a communications protocol. as such there will be interoperability between equipment from different manufacturers, but the protocol is complex so you'll likely be stuck using modules to do translation.

RS485 only specifies the physical layer, how you handle communications is entirely up to you. so you'll be able to hook up the serial ports of a micromite to a transciever and 'roll your own' method of communication - for instance, polling all 26 nodes one after the other, or using some sort of collision detection through CRC on packets.

i've used CANbus on earthmoving machinery, it was relatively robust though i'm not sure of the maximum cable length RS485 i've only read up on.

you'd likely want to be polling your nodes continuously, to ensure no one has cut the bus wires to defeat the sensors communicating a trip condition. in this case it would seem on the face of it that RS485 may be best suited to this application.


cheers,
rob :-)



 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 03:47am 07 Apr 2016
Copy link to clipboard 
Print this post

Would that not also depend on which controller you are using.
If it is a uMite then the best choice is RS485 as only a differential bus driver chip is needed.



Microblocks. Build with logic.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9585
Posted: 03:50am 07 Apr 2016
Copy link to clipboard 
Print this post

Cool bananas, thanks for that info - very useful.

I've spent the last hour or so reading through the MCP2515 CAN controller chip, but as you say - it's pretty complicated!

Time to rest my brain for tonight, but I like the polling idea, as that would be quite quick, and give each and every node a spot in the queue. Around-and-around we go, and where it stops...AHHH NODE 17 HAS DATA FOR ME!

Yes, I must be getting tired - making up stupid jokes.....

Night, night all.

EDIT:

@ MicroBlocks - yeah, looks like 485 is the way to go - that's two members in favour of that, so I am looking down that elevator shaft now....Edited by Grogster 2016-04-08
Smoke makes things work. When the smoke gets out, it stops!
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 03:59am 07 Apr 2016
Copy link to clipboard 
Print this post

  Grogster said  
looks like 485 is the way to go


Having done both, I strongly suggest RS485.

You can make your own protocol and do round-robin polling.


Micromites and Maximites! - Beginning Maximite
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2947
Posted: 06:47pm 07 Apr 2016
Copy link to clipboard 
Print this post

GDay Grogster,

I use RS485 (4 wire) at work and we have runs between 1km and 1500m long.. In our case we have up to a maximum of 16 slaves (drops) on each line but that is mostly because we are using 9600Bd and there is heaps of communication each way..

Now the hardware we use is a 4 wire RS485 2 are for Tx(+ -) and 2 are for Rx (+ -)..

The master initiates ALL communication and is the only device talking down the Tx pair (all drops are listening to the Tx --- their Rx -- line for their turn to talk)

The Master then goes to each drop in turn (polls) and asks if the drop has anything to report. The drop will acknowledge the poll with an ACK even if nothing to report.. I am not sure of the exact protocol but you can make up your own.. At least by the drop acknowledging each time the Master can check on it being alive..

All of the slaves share the same Rx (from the Master's perspective .... their TX) pair and when a slave wishes to Respond to the master's request it will enable their Tx Driver (hence the Com1 Enable line on the uMite) and transmit. Then disable the transmit driver...

The cable is daisy chained from one to the other... Cat5e cable is perfect for this.

The 4 wire chips we use are 75174 and 75175 I have some boards that plug into a MuP I can give you if you like.. I am happy to share the Gerbers if you want to get a million made up.. This was used for a job I designed to emulate a remote terminal with the assistance of Peter Carnegie who wrote some very good and stable code for me.. But all that was for my work application and may be of limitted use to you but you are welcome to that as well..

You will not need the handshaking lines if using a Polled environment as the handshake is done with software.

The 2 wire RS485 I have not personally played around with but these share the same pair for Tx and Rx and the Master must also toggle the direction/enable on the transceiver.

Regards,

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9585
Posted: 10:17pm 07 Apr 2016
Copy link to clipboard 
Print this post

Thanks for the very insightful description of how you did things, Mick.
Thanks also to CG for his comment above yours.

This has told me that 485 is really the way to do it, so this is how I will proceed at this point.
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10180
Posted: 12:51am 08 Apr 2016
Copy link to clipboard 
Print this post

Why not use UDP multidrop over wifi? Now available on ESP8266Basic
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9585
Posted: 12:55am 08 Apr 2016
Copy link to clipboard 
Print this post

No WiFi coverage. The complex has no WiFi setup, so that would be extra infrastructure - unless I am misunderstanding what you mean....
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10180
Posted: 01:12am 08 Apr 2016
Copy link to clipboard 
Print this post

  Quote  No WiFi coverage. The complex has no WiFi setup, so that would be extra infrastructure


The ESP8266 modules can create their own wifi no need for any existing infrastructure
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 01:16am 08 Apr 2016
Copy link to clipboard 
Print this post

  Grogster said   No WiFi coverage. The complex has no WiFi setup, so that would be extra infrastructure - unless I am misunderstanding what you mean....


I wonder whether Pmather is thinking Ad-hoc networks as opposed to infrastructure networking.

Just a Newbie thought.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:11am 08 Apr 2016
Copy link to clipboard 
Print this post

I not really like the modules to be a AP. Connecting to it means loosing your other main WiFi connection.
Better to have them connect to a router.

Microblocks. Build with logic.
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 274
Posted: 02:38am 08 Apr 2016
Copy link to clipboard 
Print this post

If you are going for long runs then you may find this information helpful;
http://docs-europe.electrocomponents.com/webdocs/1010/0900766b810107c8.pdf
"Handling Transient Threats in RS-485 Systems"
This may avoid issues arising that need to be addressed by the forum later on.
 
akashh
Senior Member

Joined: 19/01/2014
Location: India
Posts: 115
Posted: 01:27am 09 Apr 2016
Copy link to clipboard 
Print this post

I use RS485 on all my modules with a max3485 or equivalent chip. I haves a modbus stack but it is written in C. I would recommend using an industry standard protocol since it makes it easier to interface with other modules in future, and you could even use Windows software with an rs485 USB converter to test everything out.
I have never used CAN but isn't there a limitation of 8 bytes per packet?
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025