# PC-controlled underwater robot

Status
Not open for further replies.

#### vopap

##### New Member
I am trying to make a PC controlled underwater robot. The design is very similar to a submarine, however, I want it to be tethered to a PC. The parallel port looks OK, but it only has 8 bits of data (about 11 really with the printer control lines). This is only enough to control the motors (the shaft -speed and direction, the two pumps one bit each and a servo for steering). I want to have many sensors, since most likely I wont be able to see the robot under the water. My idea is to use an infrared emitter-detector group (do they work through water?), but I will have about twenty of them. A usb interface would be really nice, but a serial would just be as well. (Can I expand from regular eight bits word to lets say 32? How?)
I could not use another parallel port because I only have one and in use for the control of the motors. A demultiplexer could be an option for the sensors but not for teh motors. Could someone tell be how to wire up a serial or a usb interface? (A nice big diagram on some website would be very helpful)

#### kinjalgp

##### Active Member
It would be good idea to use microcontroller in your robot and use serial port to communicate with it. Doing this will have many advantages, like
1) It will reduce the weight of cable (only 3 core cable required) on robot which it has to pull
2) You'll have much better flexibility to hook-on as many sensors as desired.

#### vopap

##### New Member
The reason I want to use a PC is because the robot is going to take underwater pictures. Since I am cheap I decided, I have to control everything with it. (A microcontroler under water is risky and I also will control most of it movements from outside: ie almost no automated desicions).
I would probably prefer a chip that goes from parallel data to serial (USB even better since they are faster and present in most computers). However I have little idea how to wire the thing or what is the IC I need. Do you know of any wesites that tell you what goes on in each line of a serial port or USB (USB sounds very new to me. I know how serial and parallel work but not USB, so I would not mind any reference on that)

I hope I am not taxing your time!!

#### pebe

##### Member
I agree with kinjalgp.

The serial port and microcontroller is by far the best way to go. By using a two-byte sequence, the commands it can give you can be increased.

Why not let us know exactly what you want to accomplish?

#### vopap

##### New Member
I am trying to make a robot that will take pictures of the river bed. Microcontoller probably would be easier (I only looked into OOPic, and from what I have seen whatever I take from wiring complexity, I will have to program more). This robot will have a something like a webcam attached to it (I still have no idea how to meke it waterproof, however a bit of glass inside the PVC tubing frame looks like a solution. That is why I am 'reluctant' to use a microcontroller (OOPic is $50 but there are cheaper but harder to interface from what I have seen on the internet). Should I screw up in making the PVC frame water proof, and I just threw away$50. I also will have to do double programming (Microcontroller and the PC) (Talking about programming, do you know where I could find info how to interact with the port using visual basic? my computer science corse was a bit superficial)

Since I am hoping to use many sensors that must be real-time, that makes about 32-bit words and I was hoping to avoid the standard 8 bits by using the electronics. I dont think that might be possible but research has never hurt. If that is not possible, I will have to set some bits apart to code which data I am using (Microcontroller does make it easier, but I do not like that secret black box that does all the work for you and does not allow customization).

Can you tell me of any ICs for the job (lets say parallel to serial is one I would need, also something like an IC that I input 0 it sends data lines 1-8, I input 1 it sends 9-16, 10: 17-24 and so on, is there such miraculous black box? Also what would be a good choice for the H-bridge)

Thanks for the help kinjalgp, those sites are really good (I thought USB was another nondescript component, but USB.org seem to be making billions)

:idea: Hey I thought that I will have to do the robot all by myself

#### vopap

##### New Member
Oh oh, this USB looks too complicated for the first project, I guess serial is easier, but one never knows, USB they tell me is faster and present on all laptops (that what I probably will have to use outside when the bot is done, I it should still have a serial and a parallel port, else I am in big trouble)

#### Scubasteve

##### New Member
vopap,

Ypu sure have your work cut out for you, but it is possible to get this done. It is ultimately the best to use USB since it requires only 4 wires and can transmit data many hundreds times faster then the serial or parallel port. The protocol is actually quite complex, but it would be useful in the end for a nice flexible interface.

You need to use a microcontroller for the data packet handling and etc., it would be the best choice. It is best to make this sort of thing easily expandable so you can get fancy in the future with it. This could include more processing power, power supply capable of supplying more current with extra connectors, high bitrate capability, space, etc.

The design is actually very simple. The great thing about working with subs is that you can add all the weight you want at virtually no expense. I would use lead acid batteries, which offers a cheap reliable source of power. You need to get a water pump that can generate a fairly high static pressure which the limit is determined by the maximum depth you wish to take it. The simplest design would be to use a rubber blatter and fill it initially with a fixed amount of air. Then you would pump in water to cause the sub to weigh more. If the balance is good, you should need to pump very little in for it to descend.

A depth sensor is easily made with some mineral oil in a flexible tube with a pressure sensor. This will give you a linear voltage to depth ratio which you will have to interpret to real units by means of a microcontroller.

If you were ever thinking of radio to control this, you will need to remember the rules of radio and how it works. In any medium, the higher the frequency the more the attentuation. In water, the attentuation per metre is extremely high. The lower the better, but this limits your bitrate severely though.

I have been babbling on for a while,.. if you have any questions, I will be glad to help!

Steve

#### kinjalgp

##### Active Member
Instead of OOPIC you can use either 8051 family of microcontrollers or PIC family. 8051 controllers are very cheap as they are in the market since last 15-20 years.

#### vopap

##### New Member
Now, who is the stupid?? I AM :roll: I should have thought of PIC before, instead of thinking to buy 20 ICs to to the job, its all right there with just a bit of programming. ok, so now I got it straight, I will use a microcontroller. Right now I am looking at the PIC website, there seems to be hundreds of microcontrollers, does anybody have a sugestion?

I still think I will control all the pumps, motor and the servo through the parallel port and then I am looking into how to do the USB interface trough the microcontroller to get the data from the sensors (I did not know I could make a depth sensor, thanks for the point Scubasteve. I also heard something about gravity sensors, to know if the bot is tilted or not, how does that work?). So the thing is how am I to fit the data that require at least 32 bits in realtime onto the 8 bit words (thats what USB uses right?). What I was thinking of was to send the first say five bits of data and save 000 in the other three bits, then send the next 5 and put 001 into the coding and so on. At the PC I would be able to decodify this with some programming. Does anybody know of any IC for that? (Theoretically it could be done using a transistor for every line and switch them on/off using the microprosessor. Then I would need a parallel to serial IC I guess. Meaning I will spend a week wiring up this and then not being sure if it works)

#### pebe

##### Member
Are you saying that some of the sensors require 32bits? That's an awful lot of sensitivity. If they can be broken down into bytes, then you can get the controller to poll them in sequence and send them serially to your PC. At the PC you can have a program that reassembles the bytes back to the original data. That is quite normal practice.

Going from PC to controller, you can do the same if the data you are sending requires more than one byte. You can send a byte which is the address for the instruction coming in the next byte.

I don't see a problem using the serial port instead of the parallel port.

#### vopap

##### New Member
Thats exactly what I am trying to do, to split up the data. What wiring I need besides the microcontroller (The PIC controller wont have 30 inputs lines and more outputs to the computer unless I wire up 4 of them together, then OOPic is better)?

#### vopap

##### New Member
Ok, I definitelly need to do more reading, some of the stuff I say makes me cringe now, only I am only partly :cry: inclined to read 600 pages of usb specifics and 300 pages for the PIC microcontroller. :cry: hmm. USB is such a trouble, I guess I will just use the serial port for sensors and parallel for motors (I hope the parallel is fast enough for the servo though). Though, I just looked at a serial port and it has like nine lines, dont i just need 2 (data and clock) and mayby two more for power.

#### vopap

##### New Member
You need to get a water pump that can generate a fairly high static pressure which the limit is determined by the maximum depth you wish to take it. The simplest design would be to use a rubber blatter and fill it initially with a fixed amount of air. Then you would pump in water to cause the sub to weigh more.
What kind of thing this is? I was tinking of some archaic designs with baloons and dc motors, but this idea seems nice. Correct me if I am wrong: I put a baloon inside the air chamber that will partially fill it. Now, for the pump I will need a two way pump to pump the water in and out (is there such thing that is small? I guess I am facing another big problem: WHERE DO I BUY EVERYTHING? I have only 2 month to finish the entire thing). Another way to aproach it which seems nicer to me is to pump the air into the baloon, but I still need a two way pump :?

#### pebe

##### Member
vopap,
8bits will give a resolution of better than 0.5%. 10bits will give better than 0.1%. That is usually adequate for most measurements and in most cases will probably equate to the accuracy of the best available sensor.

So, this sensor that needs 32bits. Do you *need* that sort of resolution for what you want it to do? What is it? What does it sense? Does its output come out on parallel 32pins? Are they all for variable (quantative) data, or are some bits used to identify the sensor?

This needs to be known to best advise you.

#### vopap

##### New Member
:? my mistake, resolution is too advanced for me. All I am using is about 32 phototransistors and did not want to use demultiplexer to get one switch at a time. I think I have almost a solution. I am not gonna use a microcontroller, but 4 parallel to serial shift registers. The MSCOMM control in vb allows me to specify the lenght of the word so I should be fine. The only thing now is how to wire all of them together. As I said research always helps only here I have been reading the computer nonstop for the past 10 hours. Will see what I can do about it. I hope I wont burn any chips. One more question though. How long can the serial cables be without amplifying and can I make my own serial cable lets say from the regular hookup wire?

#### pebe

##### Member
Vopap,
If you are going to use serial data to communicate with your PC, then you will need start and stop bits added to each byte of data. So it's best to let the controller handle that. Ideally, the uC should read out data one bit at a time from a register. In that case, it means less programming if the uC took in sensor data a byte wide instead of serially.

Just a thought. If your sensors are phototransistors (I assume just C and E connections) then presumably they are either on of off. You could do an 8 x 4 matrix like you would for a keypad entry, with 8 input lines and 4 output lines. Put a diode in series with each PT for isolation and put each of them across one of the 32 intersections of the matrix. Then lifting each output line in turn and checking the status of the 8 input lines will check all 32 sensors and give the results in 4 bytes. So no extra chips would be needed. Magic!

RE: your last line asking whether you should do electronics, or programming or modelling first. I think you should plan first, and decide just what you want to achieve and the various ways of doing it, before you go into detail about what chips you will use. You have mentioned the sensors. How about these:

1. How about data/insructions coming from the PC?
2. Are any sensor inputs to be actioned automatically by your robot -
like maintaining depth and speed?
3. Are PC instructions to have priority?
4. What other activities does the uC do?

Regarding the type of cable. I think 3core 2A mains flex would do. The thick protective outer sheath would keep the water some distance from the conductors and that will reduce capacity. As for how long can the cable be, it will depend on the data rate you use because the capacity of the cable will increase with length and that is what determines rise time, and that, in turn, determines maximum data rate. I've used 60ft of 3core at 1200bps, but that is certainly not its limit.

#### vopap

##### New Member
the universe collapsed, all my research has done nothing: I cannot use infrared detectors under water. Do you know how to interface sonar or ultrasonar transducers to the oopic?
I know I have too amny questions :cry:

#### pebe

##### Member
I would have thought you need to send a short, sharp pulse to the tx transducer and then time how long it takes to receive the echo from wherever.

You know, you would get far more help, more quickly, if you set out clearly what you are trying to do, instead of just asking questions, piecemeal.

What are you trying to measure?

#### vopap

##### New Member
sorry, I thought my questions had only one side to them. OK, what I am trying to do is find out the distance to the bottom of the river ( I thought the that is the only use of sonars beside comunication, obviously I was wrong).
So do you have any sugestions. Oh if I missed any other info, ITS A TETHERED SUBMRINE, controlled by the submarine by a serial port from the pc with a USB camera. I hope that fills in all the holes in the question

Status
Not open for further replies.

Replies
3
Views
6K
Replies
1
Views
2K
Replies
0
Views
2K
Replies
7
Views
3K
Replies
2
Views
3K