Go Down

Topic: Communicating with an Arduino that is relatively far away (Read 4700 times) previous topic - next topic

dc42

Here are a couple of other ideas:

1. Emulate the old current loop serial interface using opto isolators connected to the serial port. It wouldn't work at 115200 baud, but should be OK at 9600.

2. Between 2 Arduinos, you could use SPI at a slow clock rate, again with opto isolators.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

retrolefty


Thanks for the quick reply :)
Full duplex it is then, I guess! The price is about the same but my favorite shop only has the half-duplex version. But I can get the full-duplex ones elsewhere.

If you are talking about the RS-485 chips you can use a pair of half duplex chips and just 'hardwire' the enable signal(s) one transceiver chip to receive mode for one cable pair and the other chip to transmit mode cable pair. So maybe four chips to support both ends? I haven't really checked out the chips you are considering but most operate the same.

The amount of data being sent back and forth is not a whole lot. The PC sends a request which is at most 20 bytes and the Arduino replies to that, the replies' lengths depend on what kind of request was made and will be anywhere from 1 to maybe around 30 bytes.
To eliminate the need for high-speed communication the Arduino does most of the processing. Basically the Arduino does most of the hard work and just sends an event log to the PC so it know's whats going on. A high estimate would be 100 bytes/sec from Arduino->PC and 200 bytes/sec from PC->Arduino (and much less if I move all the scoreboard code to the Arduino).
So even 115kbps is way more than I need.

Good, so if you do find you have any intermittent garbled data due to noise you could always try and reduce the speed to see if that eliminates the problem. At the refinery I worked at we used many many RS-485 links, many running over a thousand feet at 9600 baud mostly. However we run the twisted pair through hard electrical conduit and used high quality low capacitance cable with overall shielding. Anyway RS-485 is a very reliable method to route serial data over distances, that's what it was designed for.
Lefty


Nico V

Using 4 would work I guess :)
I'm having a bit of trouble finding a local source for the low speed full duplex versions but the MAX3082E seems to do what I want so I just need 4 of them then.

So if I'm getting this straight this is how I would hook this up:
For the local TX to remote RX:
Local side: DE to Vcc/+5V, DI to TX.
Remote side: RE to Vcc/+5V, RO to RX.
Local A to remote B, local B to remote A. And a resistor between A and B on both sides.
A 0.1 uF condensor between Vcc and +5V, and GND to ground obviously.


retrolefty

#18
Nov 13, 2012, 06:10 pm Last Edit: Nov 13, 2012, 06:14 pm by retrolefty Reason: 1

Using 4 would work I guess :)
I'm having a bit of trouble finding a local source for the low speed full duplex versions but the MAX3082E seems to do what I want so I just need 4 of them then.

So if I'm getting this straight this is how I would hook this up:
For the local TX to remote RX:
Local side: DE to Vcc/+5V, DI to TX.
Remote side: RE to Vcc/+5V, RO to RX.
Local A to remote B, local B to remote A. And a resistor between A and B on both sides.
A 0.1 uF condensor between Vcc and +5V, and GND to ground obviously.




Well you really need to show four chips wired to two separate cable pairs. One the local side one chip (for the local's transmit signal) has DE wired to Vcc and RE wired to Vcc, and DI wired to serial tx pin. The other local chip (for the receive signal) has it's DE wired to ground and RE wired to ground and it's RO pin wired to arduino rec pin. The remote has a similar setup as long as you keep in mind the direction of data flow through each seperate cable pair. And yes, four 150 ohm resistors wired from A to B on all four chips. And good on remembering about the benefits of bypass caps at the Vcc pins to ground for all four chips. Does that help? English is a poor method to talk electronics as a schematic drawing is the true language of electronics.  ;)
Lefty

Graynomad

Quote
Local A to remote B, local B to remote A

All As together and all Bs together. Have a look in the data sheets, they always have examples.

Quote
And a resistor between A and B on both sides.

Correct.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Nico V

I will try and draw a schematic, but knowing my drawing skills I'm afraid it might not make things a whole lot clearer ;)

So A goes to A and B goes to B. The datasheet did have an example but it was a bit unclear to me how they were supposed to be connected because the schematic showed the wires as being twisted and I couldn't figure out what went to what.

Nico V

#21
Nov 13, 2012, 10:31 pm Last Edit: Nov 13, 2012, 10:33 pm by nicov Reason: 1
Here we go... This is the first time I've ever used Eagle or drawn a schematic and I can't say that I really know what I'm doing ;) So I'm guessing it's not going to be all that great. I found the drawing process a bit frustrating so I only did one side for now.


Does that look like it would work? Or do I need to connect the unconnected pins to something too?

Coding Badly


Nico V



C1 and C2 look suspicious.

I thought so too.. But the example schematic was a bit unclear again to a schematic noob like myself.

This is what's in the datasheet:


If they didn't mean what I had in the previous schematic, how is this one?

Coding Badly

#24
Nov 14, 2012, 12:53 am Last Edit: Nov 14, 2012, 12:55 am by Coding Badly Reason: 1

That looks better (the capacitors; someone else will have to comment on the rest).

Graynomad

RE is active low, on the right-hand chip it's pulled high.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Nico V


RE is active low, on the right-hand chip it's pulled high.

______
Rob

Aha, thanks for that hint! I thought something might be up with it, with the slash after the name or the "overscore". Learning by doing, I guess ;)
So I need to connect it to ground on the right side one then.

I found this table in the datasheet:


So on the left side, RE can be disconnected, DE to VCC.
On the right side, RE to GND, DE can be disconnected.

Like this?

retrolefty

On the remote end you really should ground pin 3, DE, to make sure it's transmit driver is forced off into tri-state mode.

Lefty

Nico V


On the remote end you really should ground pin 3, DE, to make sure it's transmit driver is forced off into tri-state mode.

Lefty

According to the table it shouldn't care but I guess better safe than sorry ;)

Version 4 then:

Graynomad

Quote
the slash after the name or the "overscore"

Also the small circle on the graphic, on chips that means an active low or inverted signal.

Just some notes about schematic layout.

If you mirror image the remote chip the drawing will be a lot clearer.

When things are tied to power rails it's almost always better (clearer) to have VCC going up and GND going down. Your caps go up.

Most beginners make a real dog's breakfast by running the GND wire to every possible place. You haven't done that which is good, in this case however I would argue that because these chips are physically remote from each other you should draw the GND line between the two to reinforce that they have to have a common GND and that that is formed by a GND wire in the cable.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up