Arduino

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alucard
    Lieutenant Commander
    • Aug 2023
    • 101

    #16
    I watched the two posted video's that John did and I see the great possibilities of the Arduino, which I may explore after i actually build my first sub. I am sorry that gentlemen passed, he seems very nice and knowledgeable. The more i look around the forums the more I see why people get so caught up in the build process and customization of the Subs.

    Comment

    • bwi 971
      Captain
      • Jan 2015
      • 915

      #17
      In a final attempt to pinpoint the source of the servo jittering, I performed an experiment.
      Assumptions are the mother of all fu**ups.

      I conducted a test without the receiver, using code to move the servo back and forth between X and Y degrees.
      Interestingly, during this test, the servo operated smoothly without any jitter.
      This observation suggested that the interference or noise causing the jitter likely originated from the process of reading signals from the receiver.

      To address this issue, I introduced a filter into the code, which effectively averaged the received PWM signal before instructing the servo to move. Through careful adjustment of the filter's sample size and the deadband settings, I successfully eliminated the servo jittering.​

      The small blue PCB on the left is the accelerometer and Gyroscope that will be used for the auto-leveling.

      Grtz,
      Bart

      Click image for larger version

Name:	image.jpg
Views:	154
Size:	47.9 KB
ID:	174983
      Practical wisdom is only to be learned in the school of experience.
      "Samuel Smiles"

      Comment

      • Nathan
        Lieutenant, Junior Grade
        • Jan 2023
        • 30

        #18
        I used an Arduino to control servos in a project once and used a capacitor on the power lines to absorb interference. The same idea as those used on brushed motors. Have you tried that?

        Comment

        • redboat219
          Admiral
          • Dec 2008
          • 2774

          #19
          Originally posted by bwi 971
          I'm moving forward and currently working on writing the code for the auto-leveling and pitch control, which will be controlled by the forward dive planes. These forward dive planes will operate independently and won't be controlled by the transmitter.
          Normally forward dive planes are for depth control, stern planes for angle keeping. But then again, who am I to question your plan.
          Last edited by redboat219; 10-16-2023, 06:23 PM.
          Make it simple, make strong, make it work!

          Comment

          • bwi 971
            Captain
            • Jan 2015
            • 915

            #20
            Originally posted by Nathan
            I used an Arduino to control servos in a project once and used a capacitor on the power lines to absorb interference. The same idea as those used on brushed motors. Have you tried that?
            No I did not, I will for sure give it a try, thks!
            Practical wisdom is only to be learned in the school of experience.
            "Samuel Smiles"

            Comment

            • TuptubBuilder
              Lieutenant, Junior Grade
              • Sep 2020
              • 36

              #21
              Originally posted by redboat219

              Normally forward dive planes are for depth control, stern planes for angle keeping. But then again, who am I to question your plan.
              Sir, would you please explain the reasoning behind said arrangement for my edification. Thank you.

              Comment

              • redboat219
                Admiral
                • Dec 2008
                • 2774

                #22
                The stern planes are like the elevators on a plane. Since they are located far aft from the boat's centre of buoyancy ( also the boat's center of gravity) any deflection up or down will produce a pitching moment through lever action.

                Bow/ fairwater/ sail planes are located closer to the COB so they exert less turning force but cause hull to rise and fall vertically.
                Make it simple, make strong, make it work!

                Comment

                • TuptubBuilder
                  Lieutenant, Junior Grade
                  • Sep 2020
                  • 36

                  #23
                  Originally posted by redboat219
                  The stern planes are like the elevators on a plane. Since they are located far aft from the boat's centre of buoyancy ( also the boat's center of gravity) any deflection up or down will produce a pitching moment through lever action.

                  Bow/ fairwater/ sail planes are located closer to the COB so they exert less turning force but cause hull to rise and fall vertically.
                  I'm a bit slow on the uptake and needed a visual aid but now I get it.
                  The stern planes and propellers are aft of the center of gravity and center of buoyancy so the stern planes can cancel the pitch vector of the propeller thrust.
                  The centers of buoyancy and gravity are between the bow plane and propeller causing the boat to ascend or descend.

                  Attached Files

                  Comment

                  • bwi 971
                    Captain
                    • Jan 2015
                    • 915

                    #24
                    Originally posted by redboat219

                    Normally forward dive planes are for depth control, stern planes for angle keeping. But then again, who am I to question your plan.
                    I chose this approach because it matches the layout of my Akula, and it functions adequately.
                    Have there been any tests conducted to ascertain if there's a noticeable difference between these setups? I presume someone has compared both configurations.
                    Additionally, I assume it might also depend on the type of submarine and the hydrofoil's size relative to the hydrodynamic area.
                    Practical wisdom is only to be learned in the school of experience.
                    "Samuel Smiles"

                    Comment

                    • TuptubBuilder
                      Lieutenant, Junior Grade
                      • Sep 2020
                      • 36

                      #25
                      Technically, redboat219 is correct. I proved it with a free body diagram and summation of forces. Maybe someone else can present it better than me. In practice it may not make a noticeable difference because of the magnitude of the forces and other factors. Fluid dynamics can get very complex. Consider bow planes for depth control and stern planes for pitch control a “best practice”.

                      Comment

                      • bwi 971
                        Captain
                        • Jan 2015
                        • 915

                        #26
                        I've successfully implemented automatic pitch control.
                        This was achieved by utilizing a PID loop, it will require the adjustment of kP, kI, and kD values during the commissioning of the submarine.
                        I tried to explain the P,I and D of the controler in below example:

                        Proportional (P): Picture yourself inside the submarine, with a control system at your disposal for altering its angle. The proportional component of the PID controller functions like your swift response. When the front of the submarine veers too low, the controller takes action to bring it back to a level position. Similarly, if it tilts excessively upward, it intervenes to restore a horizontal alignment. This component promptly addresses deviations from the desired level.

                        Integral (I): The integral component is akin to a long-term perspective. Over time, you may observe that the submarine tends to gradually incline slightly, despite your efforts to maintain a level position. The integral part addresses this issue by making minor, continuous adjustments to return the submarine to a horizontal orientation, eliminating any persistent tilting.

                        Derivative (D): The derivative component is akin to anticipating changes. When the submarine tilts too rapidly, the controller detects this and takes corrective measures to counteract the swift movement. It serves to avoid sudden, abrupt motions, thereby enhancing the submarine's stability.

                        Consequently, with the PID controller in place, the submarine continuously monitors its angle and performs the necessary modifications to sustain a horizontal orientation. It accomplishes this by rapidly responding to immediate alterations (P), progressively rectifying long-term drift (I), and pre-emptively countering rapid tilting (D), all in the pursuit of maintaining the desired level position beneath the water's surface. This intelligent control system ensures the submarine remains steady and balanced.

                        Link a short footage of the pitch control in ation https://drive.google.com/file/d/1DYK...ew?usp=sharing

                        ​I adjusted my Basis Of Design, it descibes what I want to do:
                        Receiver:
                        This component receives signals from the RC transmitter, providing input to the control system.

                        Arduino Nano:
                        Each channel from the receiver is connected to an Arduino Nano, which processes the input signals and generates output commands for the various control surfaces and components.

                        Channel 1 - Rudder Control:
                        This channel controls the rudder. To have a "setpoint rudder" indicating the desired rudder angle and an "output servo" that adjusts the rudder's position accordingly.

                        Channel 4 - Thrust Control:
                        This channel controls the thrust of the submarine. To have a "setpoint thrust" representing the desired thrust level, and an "output ESC" that regulates the power to the propulsion system to achieve the set thrust level.

                        Channel 3 - Depth Control:
                        This channel adjusts the depth of the submarine. Using a pressure sensor and a PID controller to control the AftPlanes servo, which manages the depth of the submarine.

                        Channel 5 - Logic control:
                        Enables & disables Diving and Surfacing logic.

                        Pitch Control:
                        The pitch control system uses an accelerometer and Gyroscope sensor and a PID controller to adjust the position of the FwdPlanes servo. This helps control the pitch (tilting) of the submarine.

                        Ballast Pump Control:
                        The ballast control system manages the ballast system, which controls the submarine's buoyancy. The functions include "filling," "off," and "empty," allowing to control the water ballast tank.

                        Diving Logic:
                        Ballast Pump Filling: When the "Diving" command is received on Channel 5 ((indicating the desire to dive), enable the ballast pump to fill the tank with water.
                        Timer: Set a timer for XX seconds to control how long the pump should operate.
                        Pitch and Depth Control: After XX seconds, activate the pitch and depth control systems. This will involve using the PID controllers for the Aft Planes servo and depth control using the pressure sensor.

                        Surfacing Logic:
                        Ballast Pump Discharge: When the "Surfacing" command is received on Channel 5 (indicating the desire to surface), enable the ballast pump to discharge water from the tank.
                        Overrule PID Controllers: During this time, set both the forward and aft dive planes to XX°, effectively overruling the normal PID control.
                        Timer: Set a timer for XX seconds to control how long the pump should operate and the planes should be at XX°.
                        Stop Pump and Reset Planes: After XX seconds, stop the ballast pump and reset the forward and aft dive planes to their neutral positions.
                        Disable Plane Control: Disable the forward and aft dive plane control systems, so they no longer respond to pitch and depth commands.​

                        Have a nice day,
                        Bart

                        Practical wisdom is only to be learned in the school of experience.
                        "Samuel Smiles"

                        Comment

                        • Alucard
                          Lieutenant Commander
                          • Aug 2023
                          • 101

                          #27
                          Very good, I will come back to this post in the future when I try using Arduino, which will not be until my second billed, too much to learn on the first already, lol.

                          Comment

                          • He Who Shall Not Be Named
                            Moderator
                            • Aug 2008
                            • 12369

                            #28
                            Originally posted by bwi 971
                            I've successfully implemented automatic pitch control.
                            This was achieved by utilizing a PID loop, it will require the adjustment of kP, kI, and kD values during the commissioning of the submarine.
                            I tried to explain the P,I and D of the controler in below example:

                            Proportional (P): Picture yourself inside the submarine, with a control system at your disposal for altering its angle. The proportional component of the PID controller functions like your swift response. When the front of the submarine veers too low, the controller takes action to bring it back to a level position. Similarly, if it tilts excessively upward, it intervenes to restore a horizontal alignment. This component promptly addresses deviations from the desired level.

                            Integral (I): The integral component is akin to a long-term perspective. Over time, you may observe that the submarine tends to gradually incline slightly, despite your efforts to maintain a level position. The integral part addresses this issue by making minor, continuous adjustments to return the submarine to a horizontal orientation, eliminating any persistent tilting.

                            Derivative (D): The derivative component is akin to anticipating changes. When the submarine tilts too rapidly, the controller detects this and takes corrective measures to counteract the swift movement. It serves to avoid sudden, abrupt motions, thereby enhancing the submarine's stability.

                            Consequently, with the PID controller in place, the submarine continuously monitors its angle and performs the necessary modifications to sustain a horizontal orientation. It accomplishes this by rapidly responding to immediate alterations (P), progressively rectifying long-term drift (I), and pre-emptively countering rapid tilting (D), all in the pursuit of maintaining the desired level position beneath the water's surface. This intelligent control system ensures the submarine remains steady and balanced.

                            Link a short footage of the pitch control in ation https://drive.google.com/file/d/1DYK...ew?usp=sharing

                            ​I adjusted my Basis Of Design, it descibes what I want to do:
                            Receiver:
                            This component receives signals from the RC transmitter, providing input to the control system.

                            Arduino Nano:
                            Each channel from the receiver is connected to an Arduino Nano, which processes the input signals and generates output commands for the various control surfaces and components.

                            Channel 1 - Rudder Control:
                            This channel controls the rudder. To have a "setpoint rudder" indicating the desired rudder angle and an "output servo" that adjusts the rudder's position accordingly.

                            Channel 4 - Thrust Control:
                            This channel controls the thrust of the submarine. To have a "setpoint thrust" representing the desired thrust level, and an "output ESC" that regulates the power to the propulsion system to achieve the set thrust level.

                            Channel 3 - Depth Control:
                            This channel adjusts the depth of the submarine. Using a pressure sensor and a PID controller to control the AftPlanes servo, which manages the depth of the submarine.

                            Channel 5 - Logic control:
                            Enables & disables Diving and Surfacing logic.

                            Pitch Control:
                            The pitch control system uses an accelerometer and Gyroscope sensor and a PID controller to adjust the position of the FwdPlanes servo. This helps control the pitch (tilting) of the submarine.

                            Ballast Pump Control:
                            The ballast control system manages the ballast system, which controls the submarine's buoyancy. The functions include "filling," "off," and "empty," allowing to control the water ballast tank.

                            Diving Logic:
                            Ballast Pump Filling: When the "Diving" command is received on Channel 5 ((indicating the desire to dive), enable the ballast pump to fill the tank with water.
                            Timer: Set a timer for XX seconds to control how long the pump should operate.
                            Pitch and Depth Control: After XX seconds, activate the pitch and depth control systems. This will involve using the PID controllers for the Aft Planes servo and depth control using the pressure sensor.

                            Surfacing Logic:
                            Ballast Pump Discharge: When the "Surfacing" command is received on Channel 5 (indicating the desire to surface), enable the ballast pump to discharge water from the tank.
                            Overrule PID Controllers: During this time, set both the forward and aft dive planes to XX°, effectively overruling the normal PID control.
                            Timer: Set a timer for XX seconds to control how long the pump should operate and the planes should be at XX°.
                            Stop Pump and Reset Planes: After XX seconds, stop the ballast pump and reset the forward and aft dive planes to their neutral positions.
                            Disable Plane Control: Disable the forward and aft dive plane control systems, so they no longer respond to pitch and depth commands.​

                            Have a nice day,
                            Bart

                            You're trying to effect pitch control with the forward planes??

                            David
                            Who is John Galt?

                            Comment

                            • bwi 971
                              Captain
                              • Jan 2015
                              • 915

                              #29
                              Originally posted by He Who Shall Not Be Named

                              You're trying to effect pitch control with the forward planes??

                              David
                              yes.....a nono?

                              Redboat219 also made the remark.

                              Works for my Akula.
                              Last edited by bwi 971; 10-17-2023, 12:15 PM.
                              Practical wisdom is only to be learned in the school of experience.
                              "Samuel Smiles"

                              Comment

                              • bwi 971
                                Captain
                                • Jan 2015
                                • 915

                                #30
                                Originally posted by Alucard
                                Very good, I will come back to this post in the future when I try using Arduino, which will not be until my second billed, too much to learn on the first already, lol.

                                When it works it will be open source.....available for everyone.
                                Practical wisdom is only to be learned in the school of experience.
                                "Samuel Smiles"

                                Comment

                                Working...