Page 1 of 2

Arduino: RS485 full-duplex using MAX488

Posted: Apr 10th, 2013, 12:28 pm
by KR2_Diving
Hello All,
Good news! I have tested and can confirm that I have achieved full duplex communication between two Arduinos via RS485 using the MAX488 chip. Even better, if you can get the standard TTL coms to work (Rx-Tx) then this solution is as easy as dropping two MAX488 chips inline!

I will post a more specific post (with drawings) soon, but in the mean time, here is what I have discovered.

TEST SET UP
-Requires two Arduino units. (in my case, one Uno (rev3) and one Mega.)
-EasyTransfer Library. (Download Here)
(The EasyTransfer Library is perfect for beginners or users that don't want to (or know how-to) write their own protocol for data exchange.)

Wiring:
Uno < -- > MEGA
GND-------GND
Tx---------Rx
Rx---------Tx

Using the EasyTransfer Library, you should be able to transfer data.
NOTE: This set up is limited in length. Some people have achieved more then 100 feet (30m) with this. But frankly, that requires extraordinary circumstances.

NEXT STEP
-Requires two Arduino units.
-EasyTransfer Library
-Two MAX488 chips

Wiring:

UNO < -- > MAX488(A) < -- > MAX488(B) < -- > MEGA

UNO < -- > MAX488(A)
GND---------Pin 4
5VDC---------Pin 1
Rx-----------Pin 2
Tx-----------Pin 3

MEGA < -- > MAX488(B)
GND---------Pin 4
5VDC---------Pin 1
Rx-----------Pin 2
Tx-----------Pin 3

MAX488(A) < -- > MAX488(B)
Pin 8-------------Pin 5
Pin 7-------------Pin 6
Pin 6-------------Pin 7
Pin 5-------------Pin 8
GND-------------GND

EDIT: There should be a 120ohm resistor between pins 7 and 8 on both MAX488 chips.

Using the same code as the test program, you should get the same results except now your tether can be as long 4,000 feet (1,200 m), and it is way more protected against noise and other outside interference. You sacrifice some bandwidth with this (approximately 250kb/sec), but if you are only exchanging headings, temps, and control inputs, this should be more then sufficient!

Hope this helps someone out there!
More details to follow soon! (Including Code samples!)

Ryan
"KR2_Diving"

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 10th, 2013, 1:33 pm
by odics
Ryan, this is awesome. Thanks for putting in the legwork and turning it into an easy to follow process, I really appreciate it. Where did you get your MAX488?

Also, right now (if I understand this correctly), you have 5 wires going between your ROV and your control box, correct? If I wanted to forego the full-duplex capabilities and only do half, can I slim this down to fewer wires? I'm trying to keep my tether as small as possible.

I'm sorry if these questions seem silly, but I have zero electronics experience and have just recently managed to get my Arduino to control my brushless motors, so I'm learning as I go along.

Thanks for your help!

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 10th, 2013, 3:26 pm
by KR2_Diving
You got it! If you went with half duplex, you would have to use the MAX485 chip. With this set up, (and I'm shooting from the hip on this) you would only save one wire. You would still have a Tx and Rx wire and GND you would still either need a 4th wire or some fancy (or not so fancy) coding to trigger the enable bit on the chips, which determine the direction of transfer. I will be playing with that myself as I would like to reduce the number of wires in my tether... But that is for another day.

Perhaps someone else can comment on this?

I am in the UK, and was able to get my chips fromFarnell.

MAX488 and MAX485 are actual product names, so a search on any electrical suppliers site should give you something!

Hope this points you in the right direction!

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 10th, 2013, 5:04 pm
by Kjetil
I'm using half duplex between two Mega and max485 chip.

Have three wires between them
Gnd
A
B

Wire that is switching the communication is going from each mega bord to their seperate max485 chip. So you will save two wires if you choose half duplex compared to full duplex.

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 10th, 2013, 5:46 pm
by fluxno
First regarding the max488 setup:

1. there should be a 120ohm resistor between Pin 7 & 8 on both chips to make sure the communication is stable over great lengths.
2. you do not need the ground wire, its nice to have it, but you frankly dont need it.
The thing is each pair of wires has a negative wire. they are balanced in themself

regarding Max485, you only need 2 wires inbetween this chips, but you need 5 wires to the arduino. because the communication is half duplex, you need the function that flips the communication direction.
this is a signal on RS232 comports that are called RTS(ready to send) this function need to be connected to the DE and RE pin of the max485 chip.

Image from this thread: http://arduino.cc/forum/index.php/topic,17118.0.html

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 10th, 2013, 6:57 pm
by KR2_Diving
fluxno wrote:First regarding the max488 setup:

1. there should be a 120ohm resistor between Pin 7 & 8 on both chips to make sure the communication is stable over great lengths.
Ah yes! Thanks fluxno! Forgot to include that! I will edit that in!
Thanks for the comments about the ground and the MAX485!

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 11th, 2013, 1:10 pm
by odics
Thanks, that was really helpful.

In terms of the MAX488 IC itself, can I put that on a breadboard/prototyping PCB with the aforementioned 120 ohm resistors, or would I have to do something else with it?

Thanks again!

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 11th, 2013, 1:45 pm
by fluxno
odics wrote:Thanks, that was really helpful.

In terms of the MAX488 IC itself, can I put that on a breadboard/prototyping PCB with the aforementioned 120 ohm resistors, or would I have to do something else with it?

Thanks again!
you can get the MAX488 in a DIP8 package that fit nicely on a breadboard.
http://www.futurlec.com/Maxim/MAX488CPApr.shtml

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 11th, 2013, 1:54 pm
by odics
Perfect! Thanks a lot.

Re: Arduino: RS485 full-duplex using MAX488

Posted: Apr 15th, 2013, 8:39 am
by hbecem
Hello KR2_Diving,
Hello everybody,

I am trying to built and ROV and I am using two arduinos card mega 2560. I tried the same idea you did and I used a max485 driver with easy transfer library using serial N°1. but no synchronisation entre surface arduino card and subsea arduino card.

So, please if your program work correctly, can you please send me back yours. thanks in advance