Basic Outline, Arduino tcp/ip & cat5

Anything to do with programing the Arduino Platform.
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

New poster, just want to say thanks for all the posts on here, certainly helpful for getting my mind around all the different options

Right now I want to have 5 thrusters and do all the control with a laptop.

To do this I'm planning on using an Arduino with ethernet bridge on board and connect to it from a vb.net application on the shore side (I have one written to take inputs from an xbox 360 controller if anyone would be interested in the code).

I'm hoping to use shore-side power (one or two 12v batteries for testing and ultimately a generator probably) and I'm not worried about the type of camera used (originally I wanted an IP camera though I see some posts mention lag from these so not set on this. The plan would have been to have a small ethernet hub on board the ROV).

I want to send all thruster controls over TCP/IP packets on a cat5/6 cable and I am aware of the problems involved with the cable.

Firstly I will design a very small ROV with a short tether just to make sure I've got the basics down before moving onto longer tethers and the accompanying problems.

A few questions...

1. When using cable other than cat5 how do you send tcp/ip packets over it? I'm assuming that twisted pair is necessary, is there some sort of converter needed at both ends to ensure proper data travel?

2. While testing would one or two 12v car batteries likely be able to power 5 thrusters, an arduino and a camera over a tether of maybe 10-15 meters? Apologies for the simple question, I can do all the computer side easily but basic electricity handling is fairly difficult for me

3. Is there any major mistake I'm making in my theoretical design? Maybe the arduino uno can't handle too many thrusters or IP packets or something?

Thanks in advance
fryslan76
Posts: 290
Joined: Dec 18th, 2012, 4:52 pm
Location: Netherlands

Re: Basic Outline, Arduino tcp/ip & cat5

Post by fryslan76 »

Hi Duncan,

There is some maths involved to see if your setup recieves enough power at the bottom. Could you not fit the two batteries in the ROV? The math can be found here on the forum I think.
Also be aware that starting the motors can screw your camera image if they use the same battery.

Regards
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

That makes sense actually. I might look into having onboard batteries though it was something I'd hoped to avoid (so as to not have to open up the waterproof housing and to have longer dive times)

I'll do some more research on onshore power/electrical current for dummies at some point thanks. I was more wondering if a couple car batteries was something people generally do. I'll be able to test it out once I'm home (actually on a deep salvage ship now doing ROV support!)

Thanks for your response
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Basic Outline, Arduino tcp/ip & cat5

Post by rossrov »

Hi Duncan. Sounds good. The Ethernet approach is quite similar to what I am playing with at present, but I want to use my IP camera. Recently purchased an EtherTen (like a Uno but with built-in Ethernet), and a network switch arrived a couple of days ago. I haven't tried the switch yet and am expecting the IP video to be slow in frame rate, if not laggy, until I figure out how to get the EtherTen to steam. Just using requests for now, which is very inefficient.

Twisted-pair needs to have what is called a "Characteristic Impedance" * of about 100 Ohms or so to get any distance with Ethernet. The same applies when using twisted-pair and baluns for composite video. Can't say whether 10 to 15 metres is too great a distance to use just any old cable - possibly could work OK.

* not to be confused with resistance - completely different.

Some other communications options are:
WiFi over coaxial cable
Ethernet over coaxial cable, as was common in early Ethernet days
Ethernet data superimposed on extra-low-voltage power supply pair.
Fibre-Optic

Some form of "Media Converter" is required for all but the WiFi

Because you desire topside batteries, and hence a power supply pair in your tether, sounds to me like plain Cat5 strapped alongside your power pair (usually speaker or automotive-type cable) is the logical choice

Depending on how many thrusters are working, and how hard, the tether voltage at the ROV will be going up and down, causing problems. Would be wise to try an automotive voltage reducer in the ROV, for the motors. This in theory will give you a constant supply voltage. Tether power is always complicated, that's why nearly all but the simplest hobby and some small commercial ROV's have batteries on board

Voltage reducer - note current rating. What are your thrusters drawing? http://www.ebay.com/itm/24V-36V-48V-60V ... 1266518572

Below is an example of how to work out how much voltage you will have at the end of a cable. In this case 12 volts at the surface, 16AWG wire, 50 metres long, and a current draw of 3 amps

16 AWG has a resistance of approximately 0.013 ohms per meter (from a table off the internet)
50 metres of two-conductor cable has a total circuit length of 100 metres
Total resistance = 0.013 ohms X 100 =1.3 ohms
Voltage drop = current X resistance, or V=IR
=3 amps X 1.3 ohms
=3.9 volts
So if running off 12 volt battery on the boat, the motor will get 8.1 volts.

I can't say how many thrusters the Arduino will run on its own. Depends on what else your Arduino is doing. Add an I2C or similar servo driver board to free up the processor to do less trivial tasks

Cheers,

Ross
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

Hi Ross,

Thanks for your reply, that helps a lot.

Being completely new means I can read lots and lots of material that I later find out will be irrelevant to what I'm planning so getting a broad overview on the options/tools available really clears things up

When I'm home I think I'll get a small battery, a thruster and an ESC to do some testing before properly designing my ROV.

If using batteries on board as well I will try and look at some sort of hot swapping ability (maybe having the waterproof battery housing separate to the main control boards) as in the future I plan to be on a small boat quite far from shore so a generator or a stack of batteries is the only option for long dives

Also running two cables alongside each other I considered but wasn't sure if it was a technique people actually used so again thanks for the reply/confirmation (experience really does rule all)
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Basic Outline, Arduino tcp/ip & cat5

Post by a_shorething »

Duncan,

I'm still working on version 1.0 of my first ROV, so take this from where it comes...

In my early research and programming I have found that rather than TCP/IP you might want to go with UDP/IP. The difference being that you aren't getting a 'confirmation' message after each one and the packets may arrive and be used out of order. For something like this I think the trade-off is worth it and probably the best way to optimize the architecture you're planning to use.

I second the idea of having onboard batteries 'run' everything. Maybe go with a trickle charger option where you send some voltage down from the surface to 'top off' the onboard batteries, but the idea of powering it entirely from the surface just seems like it would be tremendously inefficient, at least to me.
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

Hi a_shorething (.. I just got it)

Thanks for the reply. The powering from shore/vessel was so I could have long dives but it is beginning to seem less likely for the scale I want to work at (I've been spoiled working with commercial work class ROVs lately)

I have been considering UDP as it would make the programming easier and some of the bigger advantages of TCP don't apply here (such as knowing the order packets were sent in, this wouldn't be an issue on such a simple 'network', i.e two devices connected straight together).

That said I would prefer to have some knowledge of when the connection is active rather than just broadcasting the packets and no knowledge of whether they are received. I realise this makes the programming slightly more complex but it shouldn't be too difficult and I think it's worth it.

What other advantages would UDP have in this situation? Smaller packets maybe? Faster response? I suspect it would be a small difference, assuming there is no limitations on the bandwidth, which I doubt there would be?
rossrov
Posts: 383
Joined: Feb 28th, 2013, 5:01 pm
Location: Australia

Re: Basic Outline, Arduino tcp/ip & cat5

Post by rossrov »

Duncan and a_shorething: Hot-swap is the go IMO provided you don't mind surfacing then getting back to the same spot below. I'd be pretty annoyed with not having a fully charged other battery for the cordless drill when partway through a job the other other goes flat...

By the time you've decided on the tether connection and other hull penetrations integrating a separate battery pack will be easier than it seems at present. (thanks for compliment BTW)

Trickle charge I too have wondered about and would be particularly interesting if say my ROV was for example ballasted and sitting still for long periods. Some extra electronics and/or programming would be needed to optimise this.

Whether ELV (extra-low-voltage) power down the tether is inefficient or not is really a "how long is a piece of string" :lol: :lol: :lol: issue:
How long a tether?
How much drag and mass can the situation tolerate?
How great or small is the average (if using an intermediate battery) current draw
How great or small is the peak (if not using an intermediate battery) current draw

There is a UDP example in the Arduino IDE application. I tried this when I first got the Etherten, and had it talking to a monitor application I downloaded (SocketTest?). Great!! Couldn't figure out how to get it talking to the browser though. Will revisit. You guys have any UDP/Browser (not IE) tips/pointers here? Not asking anyone to write code, just some clues ;) Thanks
a_shorething
Posts: 289
Joined: Sep 10th, 2013, 5:26 pm
Location: New Jersey Shore

Re: Basic Outline, Arduino tcp/ip & cat5

Post by a_shorething »

Ah, the browser part.

My setup is a two-parter: The browser will be for the camera and the C#interface is for communicating control signals to the Arduino (or as I'm learning more, possibly a Raspberry Pi or NetDuino Plus 2).

I don't know if UDP is possible with html, I was only thinking about Ethernet communication for the purpose of sending commands.

Duncan,
For the feedback you could set something up that just sends an 'OK' message or something else actively sent every once in a while that wouldn't require a round trip (send-ack) for every single message. If you're sending throttle inputs, one missed message or one out of order won't make much difference and I think it's worth it to cut your com traffic in half, especially if you're using the same wires for video.
duncan
Posts: 22
Joined: Nov 6th, 2013, 5:43 am

Re: Basic Outline, Arduino tcp/ip & cat5

Post by duncan »

When you guys say browser what are you talking about?

Do you have a html type window (or javascript or whatever) that sends controls/receives video/receives battery status etc?

I never really considered that. I've set up a vb.net app to send the controls via tcp and I'm hoping the Arduino can send TCP strings back that has all status information also (will probably use different strings, similar to the NMEA protocol, and parse them on the shore end). It really depends on the video system implemented whether it can be hooked up into the vb.net app or a seperate window may be needed as I think a_shorething is describing

Just now I'm thinking to send a single packet with all data in one, such as:

#ROVSTRING, THRUST1, THRUST2, THRUST3, THRUST4, THRUST5, LIGHT1, LIGHT2, VIDEOSWITCH
so something like the following that can be parsed
#DROV, 90, -90, 90, -90, 0, 1, 1, 1

This isn't a huge amount of bandwidth and even with the TCP overhead it should be fine, even if video shares the line. There might be a way of prioritizing the info string over the video (particularly if an onboard switch is smart enough) though I doubt it will be much of an issue for smaller projects

I think UDP is definitely possible if not easier, but once you implement additional functions, such as sending packets for the connection status/ACK packets, it might be worth the initial outlay of implementing TCP. I'm currently working on getting my application to establish a connection (have written an "arduino simulator" app that just accepts the connection on 127.0.0.1:randomport and prints any data received, so it's currently one way) and it's pretty new to me (I did java at uni 5 years ago but a lot of it travels over). The plan is that once I've got my arduino programmed I can just switch it straight in and have communications.



This is currently what my program looks like and I've attached a link to all the the code (visual studio project too) if anyone wants to take a look/mess around with it (I'm happy to answer any programming questions I can too, need to try and contribute somehow!)

Image

https://www.dropbox.com/s/1qlrdfoxc526i ... vSuite.zip

p.s the code isn't cleaned but if anything is too confusing just ask
Post Reply