Go Down

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

Nico V

Nov 12, 2012, 08:00 pm Last Edit: Nov 12, 2012, 08:08 pm by nicov Reason: 1
For my latest project, I need to have a PC communicate with an Arduino that is going to be relatively far away, up to about 150 feet cable length or a 75 feet straight line if I were to communicate wireless.
We won't be able to boost the signal anywhere in between, if it needs to be done we'll have to do it either at the PCs end or the Arduinos end, or both ends. To make matters worse we're going to be in a noisy environment too..

Communication needs to go both ways and must obviously be reliable. Speed is less important, even 2400 baud would be okay, altho 9600 would be nice for fast response times. But data integrity is the most important thing here.

As far as I understand, communicating anywhere over 16 ft using a plain USB cable is not going to work so I guess we can scrap that right away.
USB over CAT5/6 looks pretty interesting and from the sound of it it would handle distance too. But I have no experience whatsoever with it, it definitely sounds like the easiest solution.

RS232 would work probably work fine too if we could get a real RS232 connection over a CAT6 cable, I'm not so sure about TTL and its low voltages, but again no experience. The PC doesn't have a real RS232 port so we're stuck with either having another Arduino there or a USB-serial adapter, and neither of those give a real 12V serial signal. That can be solved with some circuitry but I would ideally want to use as little parts as possible to keep the clutter down.
Wireless might be a problem because we're in noisy environment, and there will be lots of cellphones and what not around too. On top of that it'd probably be the most expensive solution.

What do you suggest would be the best way to do this?
Thanks in advance :)


Edit: I should add that the Arduino will have its own power supply and does not need to be powered by USB.

Coding Badly


RS-485
CANBUS
Ethernet

Quote
To make matters worse we're going to be in a noisy environment too


As in...
• People shouting at each other?
• 16,500 volt motors going on and off?
• Run-of-the-mill 110 volt lines?

Nico V

#2
Nov 12, 2012, 08:27 pm Last Edit: Nov 12, 2012, 08:30 pm by nicov Reason: 1
Quote
To make matters worse we're going to be in a noisy environment too

As in...
• People shouting at each other?
• 16,500 volt motors going on and off?
• Run-of-the-mill 110 volt lines?

Thanks for the suggestions, gives me something more to read up about!

Noisy both sound wise (racing engines with undampened exhausts, anything from 50cc mopeds to huge V8s) and probably worse than that: electromagnetic interference from the ignition systems on those engines.

Coding Badly


You are welcome.

electromagnetic interference from the ignition systems on those engines


Distance from the ignition wires to the communications wires?

Nico V

Distance from the ignition wires to the communications wires?

The distance will vary but will in some cases be as little as a couple of feet if we need to have the wire go over one of the lanes or dig it into the ground if for some reason we can't hang it. That'd just be a spot though, most of the cable will be at least 10 feet away from any ignition wires.

Nico V

Right now we're using a Labjack at the PC end, and parallel communication so basically one wire+ground to every sensor and output. This solution has been working trouble-free but the wiring is a complete mess.
We're using 3 CAT6 cables at the moment which is bad enough, we're adding more sensors now and would need a 4th one to have enough leads.

We figured it'd be much nicer to have all communication from and to the PC go through a single cable. We need the Arduino anyway to control the 16 7-segment displays we're adding as well, so I figured we might as well switch to some form of serial communication while we're at it.

PeterH

There are lots of options, and I think the main choice comes down to what sort of technology you're most comfortable using.

If you put a remote PC at the Arduino site, you can use various mechanisms to access the remote USB locally at your main PC, or you could leave the USB remote and tunnel the serial port over the network, or do everything you want at the remote PC and access whatever application you want to access remotely using whatever remote session technology you prefer. Or you can use a serial link and a USB-to-serial adapter to bring the serial link in to a virtual serial port.

I would have thought your best chance of getting reliable comms over that distance starting from a noisy environment would be to use the remote PC and a LAN connection.
I only provide help via the forum - please do not contact me for private consultancy.

Graynomad

RS-232 is not a good option here. My personal choice would be RS-485, it's designed for industrial environment and simple to use as to the software it's just a serial connection.

Ethernet is probably OK as well (there is an industrial Enet spec isn't their?). I think it would be more complex to get working, but that's probably just my lack of knowledge on it showing through.

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

zoomkat

Quote
We're using 3 CAT6 cables at the moment which is bad enough, we're adding more sensors now and would need a 4th one to have enough leads.


So have you disconnected a couple of the existing wires and tried TTL/rs232 communication over them? Instead of speculating do some testing.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Runaway Pancake

What's your budget?  Fibre-optic is immune to noise.

MAX232 and MAX233 have nominal ±10V outputs.

.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Nico V

Using a 2nd PC would definitely make things easier for communication but wouldn't be very practical for us otherwise, and it's probably way more than we need.
This stuff is always outdoors when used (except for the control PC) and needs to be weather proof.

All this is for a portable drag racing timing system that I built together with a couple of friends. Like I said we're using parallel communication at the moment. We have 6 inputs (reaction time, trap speed and elapsed time optical sensors, times 2) and 14 outputs (the lights on the tree). Communication to the outside goes through 3 CAT6 cables which go to our "hub" which is built in in the tree itself. In there the cables are split up and go to whatever destination they're supposed to go to: one of the relay boards for the lights or the connector for the sensors.
We're expanding a bit now and are going to add a time display which would needs another 4 wires that need to go outside, and we also want to add more sensors. In the end we'd probably end up having 5 cables and connectors at the PC end..

These cables are the main problem, they're a pain in the *ss to install every time we go to a different event, especially if the organizer does not have the control room/hut in the middle between the lanes because that means our 3 cables have to cross one of the lanes.
Having a single cable here would make life a whole lot easier on those early saturday mornings when we have to install the stuff :)

We've looked at cables with more leads because just having a single cable instead of 3 seperate ones would help a lot, but they are pricey too. If we had to we could afford it but we get CAT6 for free and now we'd rather have a non-parallel solution so it's future proof.
I guess my budget is around $100, don't want to spend too much money on something that's not essential. The current stuff works and adding more cables for the new stuff would work too, but it would be a lot nicer to have it all go to the tree over one cable.

Graynomad

You can get USB to RS-485 dongles for the PC that just look like a serial port.

https://www.sparkfun.com/products/9822

This is half-duplex but you could make your own full-duplex version easily. The FTDI data sheets have examples but it's pretty simple.

And at the Arduino end you can get an RS-485 shield, once again I think half-duplex but that doesn't really matter and you could make your own full-duplex version for maybe $20.

Full- or half-duplex doesn't matter much, it just determines how you write your code.

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

Nico V

I've been trying to get my USB-serial cable (PL2303) to work with a Uno but so far no luck with that. Seems like I tried every possible port setting but I always end up getting loads of errors. And this is with about 4 ft of cable.. I'm pretty sure I must be doing something wrong or maybe the cable is just rubbish.
So the next approach was to try and use a Leonardo as a proxy. It forwards whatever it gets on Serial (USB) to Serial1 (RX1/TX1 pins) and vice verca. That actually seems to work so now I got my PC talking to my Uno through the Leo. And more importantly, using a signal that I can do something with.

RS485 sounds like it'll do the job.
I'm looking at half duplex MAX3082 transceivers or maybe full duplex MAX3081. Would that work?
I'm pretty sure I'm not going to need full duplex though. These do 115kbps which is already more than I need. But there's faster versions too, would there be any use in getting a faster one

retrolefty

#13
Nov 13, 2012, 03:40 pm Last Edit: Nov 13, 2012, 03:44 pm by retrolefty Reason: 1
RS485 sounds like it'll do the job.

That would be my choice also. Be sure to read up on proper wiring methods for RS-485 links. This usually involves wiring 150 ohm termination resistor across the data+ and data- terminals at the both the local and remote receivers inputs terminals. Also using shield cable is helpful, grounding the overall shield at only one end of the cable run.

I'm looking at half duplex MAX3082 transceivers or maybe full duplex MAX3081. Would that work?
If you go with the two pair full duplex option you won't have to modify the arduino serial library code to properly generate the transmit enable/rec enable signal required to 'turn around' the voltage translator chips. This required serial code modification is now even more tricky sense the arduino serial library has gone to interrupt based transmit buffering. Using two pair full duplex makes the whole link more transparent to the standard arduino software, at the extra expense of a second wire pair of course, a better tradeoff in my opinion as your cable run is not all that long or expensive.
I'm pretty sure I'm not going to need full duplex though. These do 115kbps which is already more than I need. But there's faster versions too, would there be any use in getting a faster one

Probably not, but that really depends on the amount of data you have to move and what you are doing with the data at each end. General advice is to run only as fast as you require and no faster.
Lefty

Nico V

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.

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.

Go Up