Open Source Boat Controller Project

Discussion in 'OnBoard Electronics & Controls' started by MurphyLaw, Aug 7, 2018.

  1. BMcF
    Joined: Mar 2007
    Posts: 1,173
    Likes: 182, Points: 63, Legacy Rep: 361
    Location: Maryland

    BMcF Senior Member

    Attached Files:

  2. MurphyLaw
    Joined: Aug 2012
    Posts: 123
    Likes: 5, Points: 18, Legacy Rep: 10
    Location: Mars

    MurphyLaw Senior Member

    It has a motor in it, that is cheating the whole scare yourself to death with tonnes of force flying inches above you head experience;) Cool, very futuristic, I imagined a navy ship functional thing, how fast and with how much horsepower does she go?
     
  3. BMcF
    Joined: Mar 2007
    Posts: 1,173
    Likes: 182, Points: 63, Legacy Rep: 361
    Location: Maryland

    BMcF Senior Member

    The craft in that picture was built as a 1/4-scale model of a 56-meter 50+ knot passenger and vehicle ferry. The test craft had a pair of 250HP Yamahas on the stern.

    We've done a number of craft for naval applications too but I cannot post any information on those. This one (pic attached) , however, is "open" and was intended for naval application and all controlled by our kit. Twin 1100 shp gas turbines for power.

    All of the foil-borne and foil-assisted craft we work with are powered and typically pretty fast. However, our top hydrodynamics guy is really keen about sailing foils..just a matter of time before he's built one. I'm sure he'll be very interested in what you are doing. ;-)
     

    Attached Files:

  4. Doug Lord
    Joined: May 2009
    Posts: 16,679
    Likes: 349, Points: 93, Legacy Rep: 1362
    Location: Cocoa, Florida

    Doug Lord Flight Ready

    I'm sure interested in finding a better solution for altitude control for t-foils-other than wands on sailing foilers. Very interesting thread!
     
  5. BMcF
    Joined: Mar 2007
    Posts: 1,173
    Likes: 182, Points: 63, Legacy Rep: 361
    Location: Maryland

    BMcF Senior Member

    Exactly why I'm interested in how well the ultrasonic sensor works at speed.. That is a sensing technology we have not revisited in many years but we're now working with some much smaller vessels that are flying a lot closer to the water....so close, in fact, that our radar sensors cannot cope well with the very short distances.
     
  6. Doug Lord
    Joined: May 2009
    Posts: 16,679
    Likes: 349, Points: 93, Legacy Rep: 1362
    Location: Cocoa, Florida

    Doug Lord Flight Ready

    The new stuff sounds promising. Dr. Sam Bradfield told me he had experimented with ultrasonic sensors for T-foil altitude control before 2000 and said that spray was a major problem then.
     
  7. BMcF
    Joined: Mar 2007
    Posts: 1,173
    Likes: 182, Points: 63, Legacy Rep: 361
    Location: Maryland

    BMcF Senior Member

    Dr. Bradfield and our head hydro guy have corresponded at some length over the years about various sailing hydrofoils...and one of our shipyard clients built some of Bradfield's foils some years ago. The sailing foils are not part of our business but certainly fascinating.
     
  8. Doug Lord
    Joined: May 2009
    Posts: 16,679
    Likes: 349, Points: 93, Legacy Rep: 1362
    Location: Cocoa, Florida

    Doug Lord Flight Ready

    Dr. Sam was my mentor in learning much of what I know about sailing foiler design. He was a spectacularly good teacher and was a big help to me. He used one of my RC trimaran platforms as a test model for the 40' SKAT foiling system.
    Two Flyers with Dr. Sam(upper left side-white hat/blue jacket) -Tip of mast was about 8' off the dock:
    flyer3sdock_small.jpg

    Flyer 3 RC tri platform I built. Dr. Sam and Tom added Test foils for SKAT:
    Hydrosail-flyer 3 test model.jpg

    SKAT flying:
    Skat bradfield 40 wand illustrated.jpg
     
    Last edited: Aug 15, 2018
  9. MurphyLaw
    Joined: Aug 2012
    Posts: 123
    Likes: 5, Points: 18, Legacy Rep: 10
    Location: Mars

    MurphyLaw Senior Member

    I have switched to using the Arduino because with the Arduino there is only your code and no other code runs, with the Raspberry there are hundreds of other programs running I spent 100 of hours debugging errors in the Raspberry code and it was going to slow the development of the this project down, it will be easier to get a working controller with the Arduino and then switch it over to the Raspberry when everything is working.

    OK I hooked the Arduino SBC up to the Motion sensor and a servo, anything with a coil in it such as a motor is like Satan around electronics, you best be doing your development stuff with a small motor and when your code is good to go, switch to the big stuff.

    YOU HAVE TO HAVE A SEPARATE POWER SUPPLY FOR YOUR SERVOS OR MOTORS OR IT WILL RESET THE COMPUTER WHEN THEY ARE USED.

    Here are links to the components I have used, I just grab the quickest link I can find, buy from whoever you think best.

    Arduino Small Board Computer Arduino Uno Rev3 https://store.arduino.cc/arduino-uno-rev3

    Arduino Motion Shield https://www.amazon.com/Arduino-Axes-Sensor-Shield-A000070/dp/B00UVWHLD6

    Servo https://www.amazon.com/SunFounder-D...&ie=UTF8&qid=1534434157&sr=1-3&keywords=servo

    Ultrasound sensor JSN-SR04T

    This is the Adruino hooked up to the Bosch sensor(AKA Arduino motion shield), I took the code for the Bosch sensor and modified it to control the servo.

    Here is the code, all the code I will publish here I test before posting, if you purchase any of the components and connect as I have shown and run my code then it will do as I have stated otherwise feel free to message me.

    Code:
    #include "NineAxesMotion.h"
    #include <Wire.h>
    #include <Servo.h>
    
    NineAxesMotion mySensor;
    unsigned long lastStreamTime = 0;
    const int streamPeriod = 20;          //To stream at 50Hz without using additional timers (time period(ms) =1000/frequency(Hz))
    bool updateSensorData = true;         //Flag to update the sensor data. Default is true to perform the first read before the first stream
    
    Servo myservo;  // create servo object to control a servo
    // twelve servo objects can be created on most boards
    
    int pos = 0;    // variable to store the servo position
    int myPitchAngle = 0;
    
    void setup() //This code is executed once
    {
      //Peripheral Initialization
      Serial.begin(115200);           //Initialize the Serial Port to view information on the Serial Monitor
      I2C.begin();                    //Initialize I2C communication to the let the library communicate with the sensor.
    
      myservo.attach(9);  // attaches the servo on pin 9 to the servo object
    
      //Sensor Initialization
      mySensor.initSensor();          //The I2C Address can be changed here inside this function in the library
      mySensor.setOperationMode(OPERATION_MODE_NDOF);   //Can be configured to other operation modes as desired
      mySensor.setUpdateMode(MANUAL);  //The default is AUTO. Changing to MANUAL requires calling the relevant update functions prior to calling the read functions
      //Setting to MANUAL requires fewer reads to the sensor
    }
    
    
    
    void loop()
    {
      if (updateSensorData)  //Keep the updating of data as a separate task
      {
        mySensor.updateEuler();
        mySensor.updateLinearAccel();
        mySensor.updateMag();
        mySensor.updateGyro();
        mySensor.updateCalibStatus();  //Update the Calibration Status
        updateSensorData = false;
      }
    
     
     
      if ((millis() - lastStreamTime) >= streamPeriod)
      {
        lastStreamTime = millis();
    
        //Euler
     
        //Serial.print(" H: ");
        Serial.print(mySensor.readEulerHeading());
        Serial.print(", ");
    
        //Serial.print(" R: ");
        Serial.print(mySensor.readEulerRoll());
        Serial.print(",");
    
        //Serial.print(" P: ");
        myPitchAngle=(mySensor.readEulerPitch());
        Serial.print(myPitchAngle);
        Serial.print(", ");
     
     
        //Acceleration
     
        //Serial.print(" AccelX: ");
        Serial.print(mySensor.readLinearAccelX());
        Serial.print(", ");
     
        //Serial.print(" AccelY: ");
        Serial.print(mySensor.readLinearAccelY());
        Serial.print(", ");
     
        //Serial.print(" AccelZ: ");
        Serial.print(mySensor.readLinearAccelZ());
        Serial.print(", ");
    
        //Magnetometer
     
        //Serial.print(" MagX: ");
        Serial.print(mySensor.readMagX());
        Serial.print(", ");
     
        //Serial.print(" MagY: ");
        Serial.print(mySensor.readMagY());
        Serial.print(", ");
     
        //Serial.print(" MagZ: ");
        Serial.print(mySensor.readMagZ());
        Serial.print(", ");
    
        //Gyroscope
     
        //Serial.print(" GyroX: ");
        Serial.print(mySensor.readGyroX());
        Serial.print(", ");
    
        //Serial.print(" GyroY: ");
        Serial.print(mySensor.readGyroY());
        Serial.print(", ");
     
        //Serial.print(" GyroZ: ");
        Serial.print(mySensor.readGyroZ());
        Serial.print(", ");
     
        Serial.println();
    
        updateSensorData = true;
    
    //Code added to standard motion sensor code
    
        if (myPitchAngle > 3.0){
          Serial.print("High");
          myservo.write(65);
          delay(100);
        }else if(myPitchAngle < -3.0){
          Serial.print("Low");
          myservo.write(115);
          delay(100);
        }else{
          Serial.print("Middle");
          myservo.write(90);
          delay(100);
        }
     
      }
    }

    The code at the bottom is what is controlling the servo

    Code:
    //Code added to standard motion sensor code
    
        if (myPitchAngle > 3.0){
          Serial.print("High");
          myservo.write(65);
          delay(100);
        }else if(myPitchAngle < -3.0){
          Serial.print("Low");
          myservo.write(115);
          delay(100);
        }else{
          Serial.print("Middle");
          myservo.write(90);
          delay(100);
        }

    What it is doing is looking to see if the pitch angle is greater than 3 degrees and if it is then it moves the servo 25 degrees down if the pitch angle is less than -3 degrees then it moves up 25 degrees, if it is in between then it keeps the servo in the midpoint. The servo command accepts values between 0 and 180 degrees so to get equal movements in either direction it is kept at the 90 degree mark and you subtract or add your degree adjustments. You need the "DEADZONE" in between -3 degrees > + 3 degrees when controlling motors or servos or they are forever moving on imperceivable movement.

    I received the lazer range finder and the faster TDK motion sensor today, the lazer range finder is tiny.
     

    Attached Files:

    Last edited: Aug 17, 2018
  10. MurphyLaw
    Joined: Aug 2012
    Posts: 123
    Likes: 5, Points: 18, Legacy Rep: 10
    Location: Mars

    MurphyLaw Senior Member

    Awesome stuff, you have lots of toys, I am jealous, haha check the bridge deck clearance, that's what you need out on the ocean. Yes get your guy making sailing foils, look at the possibilities that the Sail Rocket has shown....and they hinted that maybe up to 100kts could be achievable. When the speed record is 60kts and the round the world record is with an average speed of only 30kts, then that is a record up for grabs if you can design a foiling craft that can handle heavy seas.
    From my experience sailing fast in heavy seas the key is weaving a path through the wave pattern and not ploughing through, there are lots of tricks like when you launch off a wave crest you head up just before you leap because when you are in the air the wind pushes your bow down into the wind and when you land you will have an overpowered sail and it drives the hull deep into the water, if you land just a little bit too far into the wind, then you land light and skip off quickly.
     
  11. BMcF
    Joined: Mar 2007
    Posts: 1,173
    Likes: 182, Points: 63, Legacy Rep: 361
    Location: Maryland

    BMcF Senior Member

    You won't be surprised to learn, then, that the technique you described is not really that different to that used by skilled hydrofoil drivers that found themselves in sea conditions at or beyond the upper edge of their operating envelope. I've personally observed some remarkably skilled driving, much like you described, perhaps enhanced by a dash of desperation, when small passenger hydrofoils used to ply the English Channel between Weymouth and the Channel Islands, and also from mainland Korea to coastal islands like Cheju. The "desperation" aspect is because, if the vessel does/did eventually get "knocked off foil", the sea conditions were too rough to allow for another take-off....and it's then a long miserable slog to port (or at least to an area of calmer seas), arriving with a load of very sick passengers. ;-)
     
  12. MurphyLaw
    Joined: Aug 2012
    Posts: 123
    Likes: 5, Points: 18, Legacy Rep: 10
    Location: Mars

    MurphyLaw Senior Member

    Great stuff! So did you not try using a servo on one of the models to control the foil manually ?
    I have my doubts about ultrasonic, I wired up a DIY bat detector to work as a leak tester for doing infusion it lets you hear sound in the ultrasonic range and there was a lot of background noise which is why that new ultrasonic range finder is encoding the sound. I think that lazer range finder will work best especially as your disturbance is water which passes light while the disturbances for the ultrasound will be anything that produces sound. I am going to wire up both and see.

    But I have another few strategies which I think will work so I am very confident in getting this to work reliably.
     
  13. BMcF
    Joined: Mar 2007
    Posts: 1,173
    Likes: 182, Points: 63, Legacy Rep: 361
    Location: Maryland

    BMcF Senior Member

    That's also something I'm keen to follow as you get a chance to test it out.
     
  14. MurphyLaw
    Joined: Aug 2012
    Posts: 123
    Likes: 5, Points: 18, Legacy Rep: 10
    Location: Mars

    MurphyLaw Senior Member


  15. Doug Lord
    Joined: May 2009
    Posts: 16,679
    Likes: 349, Points: 93, Legacy Rep: 1362
    Location: Cocoa, Florida

    Doug Lord Flight Ready

    ===================
    Dr. Sam and his assistant used wands to control the mainfoils on the model .Dual mainfoils could be controlled manually but to get all the benefits each side would have to be independently controlled or else you wouldn't have the benefit of the foils developing all the RM for the boat as they do automatically with dual independent wands.
    I wish you good luck with your experiments-a new type altitude control for T-foils would be spectacular and I would use it to change the ama foils on the fullsize version of the Fire Arrow(WOLF) to t-foils! Uptip foils are great and automatic but I'd prefer t-foils if I didn't have to use wands for altitude control.
    So, again, good luck!
     
Loading...
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.