Arduino: RS485 full-duplex using MAX488

Control Boards, Controllers, Tethers, Ect.
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Arduino: RS485 full-duplex using MAX488

Post 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"
Last edited by KR2_Diving on Apr 10th, 2013, 7:00 pm, edited 1 time in total.
odics
Posts: 8
Joined: Mar 2nd, 2013, 11:00 am

Re: Arduino: RS485 full-duplex using MAX488

Post 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!
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Arduino: RS485 full-duplex using MAX488

Post 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!
Kjetil
Posts: 65
Joined: Dec 11th, 2010, 4:18 pm
Location: Norway

Re: Arduino: RS485 full-duplex using MAX488

Post 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.
fluxno
Posts: 83
Joined: Nov 24th, 2012, 9:52 am
Location: Norway

Re: Arduino: RS485 full-duplex using MAX488

Post 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
User avatar
KR2_Diving
Posts: 391
Joined: Aug 30th, 2012, 11:43 am
Location: Currently: NW Suburbs of Chicago. Originally: NE Wisconsin

Re: Arduino: RS485 full-duplex using MAX488

Post 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!
odics
Posts: 8
Joined: Mar 2nd, 2013, 11:00 am

Re: Arduino: RS485 full-duplex using MAX488

Post 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!
fluxno
Posts: 83
Joined: Nov 24th, 2012, 9:52 am
Location: Norway

Re: Arduino: RS485 full-duplex using MAX488

Post 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
odics
Posts: 8
Joined: Mar 2nd, 2013, 11:00 am

Re: Arduino: RS485 full-duplex using MAX488

Post by odics »

Perfect! Thanks a lot.
hbecem
Posts: 4
Joined: Apr 14th, 2013, 11:05 am

Re: Arduino: RS485 full-duplex using MAX488

Post 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
Post Reply