Pages: 1 [2]   Go Down
Author Topic: Ship model controlled using Arduino  (Read 2367 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26934
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, you're not talking critical high speed communications here, so running pairs of CAT5 type wire from the control board to each component might be all you need.
You do have a lot of things to control; how many things are actually happening at once, and how many happen as you push buttons on your wireless controller to make something happen in display mode?

Yes, you could have a couple of the boards, 1 fore & 1 aft, maybe 3, so you'd have lots of current/voltage control options.


* 12_digit_driver_board.jpg (673 KB, 1250x1237 - viewed 21 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Crossroads,

Does that mean that board can be placed anywhere in the boat, no matter where the Adruino is placed?
In that case it indeed could be a good option.
The CAT 5 wire is what I had in mind to connect the Arduino to other Arduino's or boards.
From the Arduino/ board to the engines, LED's and servos that actually power the functions does take up a little more wires then there are functions.

Greetings Josse
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26934
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The board as designed is like an Arduino with all the shift registers on the same card, you can see where the power comes in the bottom left, also along the bottom are the '328 and its capacitors, crystal, LED  & stuff. I'll get one built up with a few parts to make it more clear.
Then yes, you could mount it where ever you'd like, with the RF connected to the FTDI connector to make the connections to the serial port.

You could have a main card receive serial commands, and pass those along to the second card, and on to a 3rd card if needed.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 647
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd guess a lot of the functions of the mother-ship could be done with one large arduino + extra port-expanders/shift-registers. Instead of having 96 long wires in the boat, should you go for a single board with 12 shift-registers, 12 separate smaller boards with single shift-registers is also a possibility. That way you would need 1 long cable to control all the registers and could place each board as close as possible to the function(s) they're designed to handle.

You still may need a lot of micro controllers though, 4 lifeboats, 1 RHIB and 1 hyperbaric lifeboat, If you want to have full control to sail those as well, they each may need a controller + wireless solution.
The ROVs may... also be controllable by wire, as in real life. I wonder whether you'll be able to find ~1:75 scale cable that reels in and out easily and also has a lot of individual wires though. That's what you'll need in case you should not use a separate micro controller inside the ROVs. Should you use a single cable instead of a towing cable plus slightly longer control-cable, it will need to be quite strong to survive a few voyages as well.

In terms of speed and computing power needed an arduino is more then capable to handle 99 out of 100 functions you want. Don't expect one to take care of camera-signals though. Although not completely correct, computing power of an arduino is comparable to 20-25 year old PCs and video is beyond its grasp. You may there for want to send video signals to shore wireless and record/show 'm there. Although it won't give you real-time pictures while standing ashore, pan & tilt will also be quite difficult, having an arduino control start/stop-recording-"buttons" on a camera with sd-card is also a possibility.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Simpson,

Thanks for the advice.

I indeed want to have some sort cable connected to the ROV's.
I think the ROV's are too small for a micro controller.
I even don't yet know if it will be possible to make the grip arm working, it does require some very tiny motors or servos.

I do want live video footage, but if Arduino isn't going to bring me there I'll find a different way.
I only need 1 stream of video footage, and it doesn't have to be HD ready or even full HD, VGA will do the job too.

What would be the advantage of using only 1 Arduino and a few port expanders and shift registers?
Is that easier to set up and control?
If not I'd rather save on wiring length, even if that would still be more expensive.
Besides, having several Arduino's makes it easier to build the system up part by part rather then needing to get everything (or nearly everything) working at once.

Greetings Josse
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26934
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I could see where it'd be advantageous to have numerous ATmega/driver boards.

You have one master that receives the RF command and acknowledges back to shore.
It then relays the 1 of 128 commands out to each board. Wiring from master to slaves then just consists of power, ground, and Tx (and Rx if you want an ack message back).

Each board could then be programmed to run a function continously (lights for instance, run this flashing sequence until another is commanded)
or to run a set of short term functions, then wait for another (raise the anchor, lower the anchor, turn left for a second or until a heading is reached, etc).

if (Serial.available()>0{  // is a message in?
commandCode = Serial.read;
}
switch (commandCode){
case 0:
// code for do nothing
break;
case 1:
// code for first command
// if command is for run once & then wait, add this:
commandCode = 0;
// if command is to repeat until next message, then leave commandCode at same value
// if another action is to occur after this one, can set commandCode to a new value to run
commandCode = 127;  // for example
break;
:
:
case 127:
// code
break;
} // end switch
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the advice.

I copied the code to the Arduino software for later use.
At this point I think I'll need to learn to program Arduino a little more, as I like to be able to work the codes out myself too.
This is partially because I like working with electronics, and partially because I would like to be able to program the next model (which is to have even more functions) pretty much all by myself.

Greetings Josse
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26934
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds good. Get a feature or two coded up, let us know how it goes.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Josse,
Remember my little Kormoran boat and the little code for the random leds? It came from this piece of code we wrote. It combines a letter and a number code (0-255) for the different function groups. I included the Led/test versioncode. One can modify it easily for more groups and different functions. Just type L (or l) and a number for different led/function combinations. I (or i) for reset to default values. I used pin 2-9 since I like to keep the 0 and 1 pin for communication. I replaced the original Dutch comments and replaced them for this international forum.

grtz.

Danny

Code:
// Use this code, make it better and share it.
// C.M. Bianchi (rip) and D.D. van Dijk

int pinNumber; int pinValue;
int ledPin1 = 2; int ledPin2 = 3; int ledPin3 = 4; int ledPin4 = 5;
int ledPin5 = 6; int ledPin6 = 7; int ledPin7 = 8; int ledPin8 = 9;
char buffer[64]; char msg[140] = "";

void defaultvalues(){
 digitalWrite(ledPin1, LOW); digitalWrite(ledPin2, LOW);
 digitalWrite(ledPin3, LOW); digitalWrite(ledPin4, LOW);
 digitalWrite(ledPin5, LOW); digitalWrite(ledPin6, LOW);
 digitalWrite(ledPin7, LOW); digitalWrite(ledPin8, LOW);
 }

void setup() {
  Serial.begin(9600); Serial.flush();
  pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT);
  pinMode(ledPin5, OUTPUT); pinMode(ledPin6, OUTPUT);
  pinMode(ledPin7, OUTPUT); pinMode(ledPin8, OUTPUT);
}

void loop() {


  if (Serial.available() > 0) {
    int index=0;
    delay(10); // let the buffer fill up
    int numChar = Serial.available();
    if (numChar>64) {
      numChar=64;
    }
    while (numChar--) {
      buffer[index++] = Serial.read();
    }
    splitString(buffer);
  }
}
void splitString(char* data) {
  Serial.print("Data entered: ");
  Serial.println(data);
  char* parameter;
  parameter = strtok (data, " ,");
  while (parameter != NULL) {
    setLED(parameter);
    parameter = strtok (NULL, " ,");
  }
  // Clear the text and serial buffers
  for (int x=0; x<64; x++) {
    buffer[x]='\0';
  }
  Serial.flush();
}

// initialize to default settings with typing I or i
void setLED(char* data) {
if ((data[0] == 'i') || (data[0] == 'I')) {
  defaultvalues();
}
 
if ((data[0] == 'l') || (data[0] == 'L')) {
  int ledcode = strtol(data+1, NULL, 10);
////////////////////////////////// PIN 8 ///////////////////////////////
   if (ledcode >= 128) {
    digitalWrite(ledPin8, HIGH);
    Serial.println("Pin8 = on");
    ledcode = (ledcode - 128);
    }
   else {digitalWrite(ledPin8, LOW);}
////////////////////////////////// PIN 7 ///////////////////////////////
   if (ledcode >= 64) {
    digitalWrite(ledPin7, HIGH);
    Serial.println("Pin7 = on");
    ledcode = (ledcode - 64);
    } 
   else {digitalWrite(ledPin7, LOW);}
////////////////////////////////// PIN 6 ///////////////////////////////
   if (ledcode >= 32) {
    digitalWrite(ledPin6, HIGH);
    Serial.println("Pin6 = on");
    ledcode = (ledcode - 32);
    }   
   else {digitalWrite(ledPin6, LOW);}   
////////////////////////////////// PIN 5 ///////////////////////////////
   if (ledcode >= 16) {
    digitalWrite(ledPin5, HIGH);
    Serial.println("Pin5 = on");
    ledcode = (ledcode - 16);
    }   
   else {digitalWrite(ledPin5, LOW);}   
////////////////////////////////// PIN 4 ///////////////////////////////
   if (ledcode >= 8) {
    digitalWrite(ledPin4, HIGH);
    Serial.println("Pin4 = on");
    ledcode = (ledcode - 8);
    }   
   else {digitalWrite(ledPin4, LOW);}   
////////////////////////////////// PIN 3 ///////////////////////////////
   if (ledcode >= 4) {
    digitalWrite(ledPin3, HIGH);
    Serial.println("Pin3 = on");
    ledcode = (ledcode - 4);
    }
   else {digitalWrite(ledPin3, LOW);} 
////////////////////////////////// PIN 2 ///////////////////////////////
   if (ledcode >= 2) {
    digitalWrite(ledPin2, HIGH);
    Serial.println("Pin2 = on");
    ledcode = (ledcode - 2);
    }
   else {digitalWrite(ledPin2, LOW);}   
////////////////////////////////// PIN 1 ///////////////////////////////
   if (ledcode >= 1) {
    digitalWrite(ledPin1, HIGH);
    Serial.println("Pin1 = on");
    ledcode = (ledcode - 1);
    }   
   else {digitalWrite(ledPin1, LOW);}   
}
}
Logged

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 647
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's a lot to be said for using several arduinos as slaves. Being able to operate cranes with one and not having to worry about light-settings since other ones take care of that certainly has its advantages.
Using 1 arduino every 18 lights does seem serious overkill to me though, one 32KB arduino probably could control all light related functions and more.

You do have a lot of different peripherals on your boat, several won't need very much processing power or programming space. Personally I would look at costs. If I was going to use several arduinos as slaves,  I'd probably build them and use the cheaper 8KB atmega8-controllers where possible instead of using standard  32KB unos, nanos,  minis or larger megas.

Having enough processing speed and programming-space available on 32-256 KB arduinos to support a number of different functions,  I'd try to use those as efficient as possible.  Controlling a small number of pins while being a sleep most of the time and running a small program, would not be ideal IMO. Advantage of Shift-registers in that respect is that they hardly cost anything and give you close to as much IO-pins as you need. Disadvantage, having to run several routines at the same time on the same controller and making sure one routine doesn't get in the way of the other.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just my thoughts. I used 1 Arduino Nano (6 pins for PWM and 2 for i2C) and a bunch of portexpanders for my boat. Just send an adress and number by the i2c line and let the expanders worry about the functions.

Danny
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Simpson,

Thanks for the advice.
Although I'm not quite rich, I'd prefer to do things as good as possible.
When taking into account that the other option would be a transmitter costing as much as I calculated to be paying for the Arduino's, and then I'd need about 8 16-channel decoders, each costing as much as 2 Arduino Mega's, so I already do save quite some money.
On the other hand, more processing power then needed is useless.
I apparently haven't been checking the available Arduino's out properly.

There is 1 thing I need to know, but which I haven't been able to find on the internet: what are the dimensions of the different Arduino's?
I already own a UNO, of which I off course can measure the dimensions myself.
The reason I want to know this is that I want to prepare some space for them, but even though this boat isn't really small at 1,76m length, every bit of interior space should be used efficiently, even if it would only be to make sure I can get to parts that got damaged or broken.
There also is the need to be able to place ballast in the hull, spread out over the full length of the vessel, otherwise she'll hardly get to her waterline.

If I read the posts I start to get a feeling that it might be useful to make a detailed list of which functions will be placed where.
I get the feeling that there might be some misunderstanding about the position of various functions.
Here is the list:

Superstructure:
Lights in the main mast   20
Anchorrlight   1
Prepare to sail   1
Searchlights    6
Flood lights   2
Panama-steering lights   3
Interior lights   1
Lights helideck   2
Firemonitors   6

Bow:   
Bow thruster   1
Davits   13
Lifeboats   12
A-frames   4
ROV's   20
Anchors   6
Fire fighting equipment helideck   1
Searchlight bow   3
Crane on dive-area   5
Fog horn   1
General alarm   1

Midships:   
Communication with transmitter   
Spreading the command's   
Determining position for DP   
Transmitting video footage (possibly using other means then Arduino)   

Stern:   
Throttle main engines   1
Rudder   1
Main crane   5
Secondary crane   4
Tautwire   2
Mooring   1

I hope this will make clear how the functions could best be divided.
Controlling the crane on the dive-area and the davits for the RHIB and the hyperbaric lifeboat could be moved to the midship computer, as that computer is much closer then the bow computer.
The reason it hasn't been set-up this way is that I wanted to have the midship computer focus on communications.

Greetings Josse
Logged

Pages: 1 [2]   Go Up
Jump to: