Jump to content
  • projects-database-banner3.png

  • Share your completed boat projects!  DIY or Professional Installs

    Imagine a single giant database of boat projects for all brands, organized by category, boat type or budget.   Share your projects, find inspiration for a new upgrade, or learn the basics or low budget solutions from projects before you.   We can all share and learn from each other in one place.  

    No project is too plain, cheap or lame to post... all will be helpful to someone.  Let's build this!!!!

    Please register or log in first:

    1) Pick a category

    2) Click "Add New Project"

    3) Update your project anytime!

    ***Professional Shops are also welcome to showcase custom work for any category, but you must designate your company name under "installation shop"  with included info.

  • Glide Promo Ad3-01.jpg

  • Arduino Controller for Automatic gates


    Jhartt3
    • Year: 1999 Brand: Malibu Model / Trim: Sunsetter VLX Device Type : Other Surf Device Material: Other Control: Powered with Automated Controller Cost: $0-$249 Installation Shop: Self Install Platform Type: Teak

    The following is a low-cost automated controller based on the Arduino, which can be used for many things — including controlling surf devices.   Per Arduino's website: "Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects.”   Arduino board are able to read inputs - such as a switch or sensor, and turn it into an output - such as activating a motor.  You can tell your board what to do by sending a set of instructions to the microcontroller on the board.

    If you find this helpful consider making a donation to Wake the World - KC  venmo @WTWKC   PayPal -  Donation Link 

    If you'd like to purchase a pre programmed arduino i have a classified for that HERE

    So the Arduino beast has been conquered.

    Parts list and Pin out can be found HERE  (or below)
     

     

    Arduino Pin GPS Pin Motor Driver Pin Surf Left Switch Surf Right Switch
    0        
    1        
    2 TXD      
    3 RXD      
    4       L1/white
    5     L2black  
    6   in1    
    7   in2    
    8   in3    
    9   in4    
    10        
    11        
    12        
    13        
    5V VCC +5V    
    GND GND   B2 B1
             
             
             
    Motor Driver Board
           
    GND Battery GND      
    out1 Right Lenco - White white    
    out2 Right Lenco - Black black    
    out3 Left Lenco - White green    
    out4 Left Lenco - Black red    
    POWER Battery +12VDC      
             
    Relay        
    87 Blue
    12vDC from battery
       
    87a yellow Ground    
    86 white
    Motor driver board
       
    85 black Ground    
    30 red To lenco    
    Qty Item Price  
    1 GPS Antenna $12.95
    1 Antenna Pigtail $3.95
    1 Enclosure $32.00
    1 9VDC Power Supply $11.85
    1 Arduino $12.99
    1 GPS Module $20.99
    1 Screw Shield $9.98
    1 Jumper Wires $6.98
    1 Motor Driver $6.98
    1 Rotary Switch $15.86
    2 Lenco Fast Actuators $169.97
    1 Relays $24.99

     


    Logic for the NEWLY TESTED transfer capable surf devices can be found HERE 
    Libraries needed - Serial Library - GPS Library - you'll need to add these to your online or offline arduino editor library for the code to work properly. 

    Video of the test with just the switch can be found HERE

     

    The gate is set to deploy between 7 and 15 MPH you can edit the logic to change those speeds - 

    the gate is set to deploy for ~2 seconds and retract for ~3 seconds you can change that time in the logic

    next step will be using some type of pot device to vary the deploy time. 

    Attached are some pictures of the bench test wiring setup - i'll get the final boxed version uploaded sometime in the next week hopefully if my parts show up

     

     

    IMG_20171216_092324.jpg

    IMG_20171216_092328.jpg

    IMG_20171216_092335.jpg

    IMG_20171216_092340.jpg

    IMG_20171216_092349.jpg

    IMG_20171216_092742.jpg

     



    User Feedback

    Recommended Comments

    Transfer code tested with GPS good to go. only "issue" is the outputs stay high for 2x as long when transferring - not a big deal but just an FYI gates still retract and deploy in about 4 seconds. 

    I'll update the table and the video shortly - 

     

    Also has auto manual logic now 

    Pin 10 when connected to gnd allows you to run just off the switch with no GPS.  

    Share this comment


    Link to comment
    Share on other sites

    Nice work - glad to see it open sourced.  That said - Have you tested this under load?  You really shouldn't use the motor controller to drive the lencos, even for these short periods, the board will overheat quickly.  Under load they will draw 7-8A+ which is more than that board can handle without heatsink modifications (the amazon/ebay specs are inaccurate at best...)

    You should swap in standard marine relays to control the actuators (4 of them - just like you'd normally wire in tabs with switches.)  You can then use your existing motor driver -- or just get an even cheaper L298N h-bridge (<$5) or just an h-bridge chip to just trigger the relays the same way you have it wired now.  That reduces the amps from 7-10A+ on the h-bridge to ~120ma and lets you put your control box at the dash or someplace else nice and dry.

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites

    I dont think it should be an issue they say they are rated for that and they arent running for long amounts of time - while testing if they ran continuously for over 30 seconds the FETs would get hot to the touch.  but there is never a time these will be running for that long.  i'll watch the draw under load.  not sure why this couldnt be mounted under the dash with this setup either.  i'll watch temp when i test it once the weather warms up. 

    Share this comment


    Link to comment
    Share on other sites

    Sorry in advance for the long reply ;)

     

    They will draw significantly more power when there is load (IE water) pushing on them.  Like 3-4x as much.  Retracting will be the same as you see now (or less with the water assist) but both running at the same time, one extending and one retracting will put you over 10-12a easily.  Altho those boards claim 15A+ they are not properly heatsinked to support anywhere near that (they usually melt down around 7 in my experience.)  If it's getting hot at 30s with no load that's not a great sign.

    You'll need to watch out for voltage drops (and heat) with long runs - the electric motor in the actuator will fry pretty easily if you undersize the wiring.  Optimally you don't really want the wiring to be > 10-12ft total on each actuator.  The relays fix that issue and are super cheap/easy.  At the end of the current actuator 6ft cable should be the relay -- which is tied directly into the battery.  From there you can run your relay controls where ever you want with no concerns around load.  If you just add the relays to your setup nothing else has to change. Wiring example - just use your relays in place of the switch http://www.instructables.com/id/Troubleshooting-Testing-and-Bypassing-SPDT-Power-/

    Although preferred <10-12ft, below is a helpful table - electric motors are in the 3% drop  class.  Each actuator run needs a 15A line as per specs, so you may need 8AWG depending on total length between actuator and battery (including actuator 6ft -  realistically to the dash you're going to be over 30ft, it adds up quickly.)  Or you can just toss a relay there and run 16-18AWG as far as you want since there's < 200ma on it!

    DC_wire_selection_chartlg.jpg

     

    Incase it helps, here's the logic ripped out of mine for the deploy/retracts that will fix your long run time - no need for delays.  Similar logic to yours, i just use an array to reduce the code. coolDown is a period to prevent the actuator from running in the opposite direction too quickly if i'm bouncing around speed limit or GPS has issues -- currently 500ms.  On mine tabTime is specific to the profile loaded and can be adjusted on demand with a pot to adjust the deployment- you can just set it to a static number for your config.

    surf=0/1/2  (off, left, right)

    tabMap[0] =off, tabMap[1] = left, tabMap[2] = right (this is just for reporting on a small screen and phone app I have, and serial)

    deployed[ ] is 0 off, 1= left 2= right.. etc..  for all the other ones.  Timers are -1 when they are not running.

    I call tabTimers() at the start of my loop() and goSurf() after I have collected GPS data/etc in the loop.

     

    void deployTab(int tab) {
        Serial.print("Deploying: ");
        Serial.println(tabMap[tab]);
        for (i = 1; i < 3; i = i + 1) { // loop thru to see if we need to retract anything before starting.  Skipping cooldown currently to reduce any lags since this should only be for transfers.
          if(i != tab and (deployed[i] == 1 or deployTimers[i] > 0)) {
            retractTab(i);
          }
        }
    
        //Do deploy start logic here
        deployTimers[tab] = millis();
    }
    
    void retractTab(int tab) {
        Serial.print("Retracting: ");
        Serial.println(tabMap[tab]);
        //do retract start logic here
        retractTimers[tab] = millis();
    }
    
    void goSurf() {
      
      if(surf > 0) { // Is surf enabled?  surf 1=left surf2=right
        
        if(speedlimit ==1) { // Are we in a deploy speed range
          if(deployTimers[surf] == -1 and retractTimers[surf] ==-1 and deployed[surf] != 1 and (millis()- coolDownTimers[surf]) > coolDown) { // are we not deploying or retracting and not deployed and not in a cooldown for this actuator?
            deployTab(surf);
          }
        }
        
        // Check if we have anything to retract
        if(speedlimit ==0) { // Are we outside of a deploy speed range
            for (i = 1; i < 3; i = i + 1) { // loop thru both to see if we need to retract
              if(retractTimers[i] == -1 and deployTimers[i] ==-1 and deployed[i] == 1 and (millis()- coolDownTimers[surf]) > coolDown) { // are we not deploying or retracting and deployed and not in a cooldown for this actuator?
                retractTab(i);
              }
            }
          }
          
      } else { //  auto-retract when surf is off
       for (i = 1; i < 3; i = i + 1) { // loop thru both to see if we need to retract
        if(retractTimers[i] == -1 and deployTimers[i] ==-1 and deployed[i] == 1 and (millis()- coolDownTimers[surf]) > coolDown) { // are we not deploying or retracting and deployed and not in a cooldown for this actuator?
            retractTab(i);
          }
        }
      }
    }
    
    void tabTimers() {
      // Check timers for status
      for (i = 1; i < 3; i = i + 1) {
        if(deployTimers[i] > 0 and (millis()- deployTimers[i]) > tabTime[i] and retractTimers[i] == -1) {
          deployed[i] = 1;
          //Do your deploy complete logic here, IE: set pins
          Serial.print("Deploy complete: ");
          Serial.println(tabMap[i]);
          deployTimers[i]=-1;
          coolDownTimers[i] = millis();
        }
      }
      for (i = 1; i < 3; i = i + 1) {
        if(retractTimers[i] > 0 and (millis()- retractTimers[i]) > tabTime[i] and deployTimers[i] ==-1) {
          deployed[i]=0;
          //Do your retract complete logic here, IE: set pins
          Serial.print("Retract complete: ");
          Serial.println(tabMap[i]);
          retractTimers[i]=-1;
          coolDownTimers[i] = millis();
    
         }
      }
    }

     

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites

    if what you're saying is true about the motors not working well if being extended to the dash of the boat the martin's box that has the motors tie in at his box would be causing people's setups to die earlier.  i understand what you're saying about over heating it - i feel if it melts down i have reason to go get my money back from amazon and change to the relay setup.  b/c the product description was wrong.  if i install these relays you speak of now i have about 40% more wiring to do plus i have to find a place to mount them in my boat ... i'm skeptical of its need. as running both motors doesnt cause any warmth to the FETs under no load even when they are on for 8 seconds.  

    Thanks for you logic its harder to read someone else's and apply it.  but i'll look at in detail tonight.  i tried forever to get the millis function to work properly really wish this was just a PLC and my life would have been much easier. 

    Share this comment


    Link to comment
    Share on other sites

    He's actually using the same marine relays I mentioned, but inside his control box.  In his doc he doesn't address wiring lengths, but does say to use the same size wiring - and specified a 30A fuse - so his wires must be sufficient size. 

    If you do go your route, just double check the volts at the actuator once you're all wired up (and that your driver and wires aren't hot when in use under load.)  IMHO the relays are easier but as long as you're getting +12v and not melting down you're probably ok :) 

    If you wanna test your bridge before you put it in the water - try picking up some heavy things with them (there will be 200+lb force on them) attach to a piece of plywood and pick some stuff up (and down, repeat.)

    Happy to help with the code changes if you have any questions - i just didnt include your pin logic, but it's pretty straight forward start/stop logic - everything else should be handled for you.  If you want my full code let me know, i just stripped out a lot as i have a ton of other stuff in there.

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites

    the voltage will be quite a bit higher than 12Volts when the gates are operating due to the engine running should be around 13.3Volts so the drop shouldnt be too significant.  i'll hook it up this weekend.  there are some heat sinks i could add to them as well if they are getting hot.  i'm going back and forth on the relays b/c i'm not sure where to mount them.  but the enclosed plastic box will already be hot in the summer so the FETs will heat up faster.  

    Share this comment


    Link to comment
    Share on other sites

    The relays are the small cube style ones and take up no space - they usually have nice little mount tabs or just leave them bundled inline (Make sure you use "marine"/waterproof ones - and don't forget fuses whichever way you go!)

    The voltage drops are larger than you'd think (and the distance adds up fast!) - but as long as you're using the right gauge you're fine - just google DC voltage calculator and enter in all your amps/length/voltage/etc.  Manual calls for a 15A fuse on each -- 30A total from battery if you run a single line.  You'll probably find 8-10AWG will work for you.  http://assets.bluesea.com/files/resources/reference/20010.pdf 

    The way i see it, the main plus for you on the relays is no more heat issues on your FETs as they'd be only driving <200ma vs 7-10A+ and saving money on the smaller gauge wiring including not having to haul 30A all the way up front to begin with..) 

     

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites

    Not to thread-jack but since I had a couple people ask - I have shared full code of the above example  - feel free to submit any changes you'd like to propose or any issues you run into.  You can use all the hardware above but I would recommend wiring relays in as I will including in my wiring diagram and not driving off the motor driver alone.

    https://github.com/jonthompson/surfgate

    I'll also post my more advanced code once i remove a few of my specific configurations and a fritzing diagram when I have a second.

    Share this comment


    Link to comment
    Share on other sites

    Did you ever get a chance to hook these up in boat and test them?

    Watching video's, I see the lenco's fully deploy and detract, are you also going to be able to fine tune if you want....like bring tab up/down an inch to see how it effects the wave? I ask cause I know on some boats the optimal degree of deployment can be different for best wave.

    This is pretty awesome, my brain is not wired for stuff like this....I have really considering adding something like GSA but the cost is prohibitive since suck gate works so well, but if something like this were available for a more reasonable cost, I would do it. You mentioned something about listing a complete system in the classified section once it was a done deal and working, is that still in the works?

    Share this comment


    Link to comment
    Share on other sites

    not setup to be fine tuned still working the kinks out - i think the motor driver board i was using will need to be replaced with a smaller board.  i currently do not have any external inputs to change the time delay used for deploying the gates to shape the wave differently its a 100% deploy 100% retract.  since the system runs off of a timer you could fine tune it to your boats needs by changing the deploy times. - i may tackle this once its working well - still have not had this work properly and be trouble free so i'm just focusing on that right now. 

    Share this comment


    Link to comment
    Share on other sites

    Pretty sure I've got this figured out. Old motor control board was the problem. Usung and L298n now with 4 marine relays. Went on a short lake test this evening and all is well I'll post updated info to install the setup I have now as well as new code in the next few days after I test it a few more times. Also the spray problem I was having was fixed by trimming my gates. 

    Share this comment


    Link to comment
    Share on other sites

    the logic in the post has been updated i have no manual mode - you'll need to use an L298n Motor controller board with interposing 12vdc relays i've included links above.  I really think this is it guys but its only been on one minor lake test just driving it to my life after dropping it in.  Planning to go out tonight to ride and see if we have any issues.  

     

    My next step will be to add control for the ability to adjust deploy times.  if anyone has any ideas on this i'm all ears.  havent research but was hoping to get some type of knob with LCD display that shows in seconds. 

    Share this comment


    Link to comment
    Share on other sites
    On 5/23/2018 at 8:15 AM, Jhartt3 said:

    the logic in the post has been updated i have no manual mode - you'll need to use an L298n Motor controller board with interposing 12vdc relays i've included links above.  I really think this is it guys but its only been on one minor lake test just driving it to my life after dropping it in.  Planning to go out tonight to ride and see if we have any issues.  

     

    My next step will be to add control for the ability to adjust deploy times.  if anyone has any ideas on this i'm all ears.  havent research but was hoping to get some type of knob with LCD display that shows in seconds. 

    Glad you got the kinks worked out!  Just a heads up - after a bunch of work on this - and a few boats running it - i found the best was a rotary encoder for fine tuning.  I had a fancy screen and wifi controls and it was a huge pain in the ass to do while on the water.  The dial works great, you do it in real time - and has a click button to save deploy state to eeprom on the arduino when you dial it in so your state is saved and ready to go the next time you hit surf speeds.  I'll upload that code to my repo this weekend if you wanna grab it, i just installed it on a friends boat today and it's working great!

    Share this comment


    Link to comment
    Share on other sites
    On 5/29/2018 at 1:28 PM, Jhartt3 said:

    what rotary encoder are you using? 

    Sorry for delay - missed this.  I'm using - https://www.amazon.com/gp/product/B06XQTHDRR/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1

    20 pulses + push button (I use the dial to tweak and once happy you can push the button in to save that setting to the eeprom for that surf tab so it persists through reboots.)  I'm using rotary instead of a pot because it was a nicer feel to just turn the dial infinitely to tweak and not have issues with current state settings each time you switch sides.

    I'm also using a single led for status (deploy solid, moving flash, fast flash for gps errors.)  I haven't searched out a not-ugly one yet - so i'm using these right now - https://www.amazon.com/gp/product/B07BL2FR4B/

     

    I'll check in the rotary code shortly on github - i had some tweaks to it to improve feel after a test this weekend.  I've also replaced the uno in my builds with nanos as they are much smaller and the screw shield is solid and there's no chance of it falling out.  Otherwise everything is the same.

    Share this comment


    Link to comment
    Share on other sites
    2 hours ago, Jhartt3 said:

    interested to see your final build with the nano its screw shield is much better i'll likely upgrade to your system in the offseason 

    yeah the nano screw shield is much more secure and MUCH smaller - i've been building them in junction boxes: https://www.homedepot.com/p/4-in-x-4-in-x-2-in-PVC-Junction-Box-E989NNJ-CAR/100404097

    I was using aviation connectors for all the inputs before but i got so sick of soldering i'm just running wire out with bullet connectors -  MUCH easier instead of soldering 16 tiny aviation pins.

    Amusingly now all of my friends have slick gps controlled gates running my software and i'm still on a suckgate... haven't had time to design my gate design yet - nor plan to till fall.

    Share this comment


    Link to comment
    Share on other sites
    On 5/28/2018 at 10:50 PM, jonthompson said:

    Glad you got the kinks worked out!  Just a heads up - after a bunch of work on this - and a few boats running it - i found the best was a rotary encoder for fine tuning.  I had a fancy screen and wifi controls and it was a huge pain in the ass to do while on the water.  The dial works great, you do it in real time - and has a click button to save deploy state to eeprom on the arduino when you dial it in so your state is saved and ready to go the next time you hit surf speeds.  I'll upload that code to my repo this weekend if you wanna grab it, i just installed it on a friends boat today and it's working great!

    is the current code on github updated for the rotary encoder?  awesome work guys....i'm an IT geek by trade but have never gotten into this level of coding so i'm amazed at what you're doing!

    Share this comment


    Link to comment
    Share on other sites
    On 6/8/2018 at 8:46 AM, jtryon said:

    is the current code on github updated for the rotary encoder?  awesome work guys....i'm an IT geek by trade but have never gotten into this level of coding so i'm amazed at what you're doing!

    sorry not yet - i wanted to test a few changes this weekend on my friends SAN -- i did - have a couple tweaks to make - and will upload in the next day or two along with a full wiring description instead of just a fritzing as it will be easier for folks to understand ;)  

    Either way - if you do build it - its easy to do software updates over USB so you can tweak/apply new changes down the line..

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites

    Hi guys!  I have just about finished my new swimdeck with surfgates and I am ready to start building the adruino controller. 

    Thank you both for posting all that information and working all the bugs out of this built. It is something that i would have never even imagined possible, but once its been done, i am hoping that i will be able to just copy it, even if i do not understand everything that i am doing. 

    At this point, i bought everything on the list including the new motor board and relays  

    can you guide to the next step?  I just follow the chart and connect and solder everything?

    Quick question. On the pictures i see a white board used for quick connections i guess, i do not have one like that. Do i just solder those wires?

    I will probably have a lot more dumb questions like that haha.  

     

     

     

    Share this comment


    Link to comment
    Share on other sites

    Here is a picture of where I stand right now with this project. This is the information that I was not able to figure out

    I do not understand how to hookup the 4 relays.  I understand that they will be instaled at the end of the actuators cables. At the back of the boat. I should run an 8 gage wire, directly from the battery for power but the pin chart says that the ground from the battery shoud go to the motor driver board? Is that right? 

    I can then run 16-18 gage From the motor driver board to the relays

    my other question has to do with the 9vdc power supply.  How do I hook it up?6EBB8689-68FE-40EE-AEC0-4EA2A7179EEB.thumb.jpeg.f0f07bf713c81405a6aab0d2ab3acab3.jpeg

     

    Share this comment


    Link to comment
    Share on other sites

    Your wire gauge assumptions work. 9vdc power supply connects to 12vdc from battery then Vin and ground on the Arduino. There are many grounds that need to be connected. They are all the same

    Edited by Jhartt3

    Share this comment


    Link to comment
    Share on other sites

    Ok. I hooked up the power supply. 

    For the relays. Do I connect the 4 blue wires together to the battery 12vDC, the 4 Yellows together to the battery ground?

    The white wire from each relay to: out, 1 to 4 on the motor driver board.  

    And then the black and red to the actuators. I am guessing there will be 2 relays per actuator, one for opening one for closing, so there should be 2 red wires from the relay, connected to the white wire of the actuator and 2 black wires from the relay connected to the black wire of the actuator.

    this is just my best guess. Hopefully i am not too far off. 

    Thanks again

     

     

    Share this comment


    Link to comment
    Share on other sites

    It's a bit off the relay pin out is listed above both grounds on the relay connect to battery ground. Only one wire from the actuator connects to one wire on each relay. The relay output. I'm on my phone and can get you a more detailed answer tomorrow. 

    Share this comment


    Link to comment
    Share on other sites
    Relay        
    87 Blue
    12vDC from battery
       
    87a yellow Ground    
    86 white
    Motor driver board
       
    85 black Ground    
    30 red To lenco

    I guess i need you to be more specific as to what you dont understand from this Black and yellow are tied together to battery ground - the White goes to the motor control board output, and the red goes to the proper wire for the lenco.  only one lenco wire per relay per the table below.  Out1 would go to Relay1 for sake of simplicity and then that would wire to the white wire on your starboard mounted actuator.  Out2 would go to relay 2 and the black wire of the starboard mounted actuator.  

    Motor Driver Board
           
    GND Battery GND      
    out1 Right Lenco - White white    
    out2 Right Lenco - Black black    
    out3 Left Lenco - White green    
    out4 Left Lenco - Black red    
    POWER Battery +12VDC

    Share this comment


    Link to comment
    Share on other sites

    Thanks again for the clarifications. This is a crude drawing of the way I understand it now. Hopefully I am a little closer to the solution. I guess thst one thing that is throwing me off is the column with the wires white black green red. All my relays have red wireBAFD7E48-2DD6-4D24-94FC-ED6DA6EDC740.thumb.jpeg.8e0e1e565b87279560179a0d237e4461.jpeg

    Share this comment


    Link to comment
    Share on other sites

    Do i install the motor board close to the adruino in the dash?

    Can i run a single paire of 8 gage wire from the battery (power and gnd) to the dash, and then split between the power supply and the motor board ?

    I would then run an other pair of 8 gage wire from the battery to the back of the boat and split it between the 4 blue wires of the relays for the power and the 4, black and yellow for the ground   i would run 4, 16-18 gage wires to connect the white wires from the relays to the motor board out, 1to4  

    is that right?

     

    Share this comment


    Link to comment
    Share on other sites

    The adruino, motor board and gps?

    does it matter what size of wire for the 5 volts connection from adruino to motor board?  I used the small wires like the rest of the connections inside the adruino. And for the switch. i used a blue wire that i had on hand but i am not sure exactly what it is. 

    Share this comment


    Link to comment
    Share on other sites

    no it really doesnt its just to power the circuits on the board.  the only wire size that truly matters is the power to the motors - you can run 16awg to the relays from the MCB

    Share this comment


    Link to comment
    Share on other sites

    anything up to 50 amp - 30amp is plenty for the motors.  i ran 10awg for mine.  fuses protect the wire so it doesnt catch on fire.  and 8awg is max 50amp 10awg is max 30amp

    Share this comment


    Link to comment
    Share on other sites

    From tour experience is 10awg enough?  Or if you had to do it again you would use 8awg??? There is a bit of a of a price difference between the two, so if 10 is good, i will use 10awg

    Edited by Antoine

    Share this comment


    Link to comment
    Share on other sites

    Marine ancor primary wire, size 10 is $0.47 a foot and size 8 is $1.12 a foot. I figure i will need somthing like 80 feet total to run two wires to the dash and 2 wires to the back of the boat. 

    Edited by Antoine

    Share this comment


    Link to comment
    Share on other sites

    hey guys - sorry i have been MIA and haven't been back up to my boat to test the latest code - will be up on Friday to upload it and once I am done with a test run i'll upload it.

     

    In the interim - here is the latest code and instructions on github - i renamed everything to avoid any legal hassles with the name - https://github.com/jonthompson/surfactuator

     

    Just a note - i don't know if you mentioned it, but you MUST PULL THE 5V REGULATOR JUMPER ON THE MOTOR CONTROLLER.  Otherwise you will fry the motor controller with >12V from the battery and potentially your arduino if it fries the regulator.  You will power the logic with 5v from the arduino.  L298N_Motor_Driver_Connections.jpg

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites
    21 hours ago, Antoine said:

    Marine ancor primary wire, size 10 is $0.47 a foot and size 8 is $1.12 a foot. I figure i will need somthing like 80 feet total to run two wires to the dash and 2 wires to the back of the boat. 

    Just to clarify, the only wire you need at 10-12AWG is a single run from your battery to the relays for the actuators. You can size that wire up to 25-30a from that chart above to cover both actuators safely - put appropriate sized fuses for the wiring. Dont way overdo it on the fuses - you want them to blow if there's an issue ;)

    Everything else can be 18ga as they are low draw.  The arduino/motor controller/gps/etc draws<300ma.  You can wire that into something else under your dash that has power - and then run 2 pairs of 18ga wire back to the relays to control them.

    The code I have posted on github currently works great with just a switch (the uno version is the latest.)  I'll upload the rotary encoder changes (optional) once i get to test on the water.

    I've also found the cheapest enclosure for everything are standard junction boxes -- if you use a nano - you can fit everything in a 4x4x2 (tightly) - otherwise size up to a 6x6x4 for more space.

    Share this comment


    Link to comment
    Share on other sites

    Incase you're curious this is what it looks like in a 4x4x2 box - it's tight - but it fits well.  I'm no longer doing aviation connectors as they are a huge pain to solder - i'm just doing RJ45 from here on out, easy to replace if there's an issue and it doesnt need to be water tight under the dash.  This has the latest code on it and i'm tossing it in my friends boat Friday morning to confirm it all works well.

    IMG-2487.JPG

    Share this comment


    Link to comment
    Share on other sites
    On 6/27/2018 at 2:35 PM, jonthompson said:

    Just to clarify, the only wire you need at 10-12AWG is a single run from your battery to the relays for the actuators. You can size that wire up to 25-30a from that chart above to cover both actuators safely - put appropriate sized fuses for the wiring. Dont way overdo it on the fuses - you want them to blow if there's an issue ;)

    Everything else can be 18ga as they are low draw.  The arduino/motor controller/gps/etc draws<300ma.  You can wire that into something else under your dash that has power - and then run 2 pairs of 18ga wire back to the relays to control them.

    The code I have posted on github currently works great with just a switch (the uno version is the latest.)  I'll upload the rotary encoder changes (optional) once i get to test on the water.

    I've also found the cheapest enclosure for everything are standard junction boxes -- if you use a nano - you can fit everything in a 4x4x2 (tightly) - otherwise size up to a 6x6x4 for more space.

    I thought that I had to run a separate pair of 10agw wire to the dash for the power supply of the adruino, but I will happily save me the trouble and piggy back on something else in the dash.  Thanks for the info.

    Share this comment


    Link to comment
    Share on other sites

    Jhartt3, I am using your design, do I need to  PULL THE 5V REGULATOR JUMPER ON THE MOTOR CONTROLLER?

    If so, can you explain in a little bit more details what this is?

    Share this comment


    Link to comment
    Share on other sites

    If you are using the L298N you need to remove this jumper:

    cdn3.bigcommerce.com/s-vt19phz/product_images/uploaded_images/l298n-dual-2a-motor-driver-module-tronixlabs-australia-pinout.jpg?t=1416543556

    You also need to run 5V to the L298N from the 5V pin on the arduino - he mentioned this above - everything can be small gauge wire as you're not dealing with high draws with the arduino stuff - that is the point of the relays, they isolate the high amperage actuators and just operate like a light switch between them and the battery.)

     

    (Tech detail on why: this jumper controls the onboard regulator which converts 12V or less power to a regulated 5V output on the 5V screw.  This is super handy if you're dealing with <12V because you can power your arduino with this 5V output efficiently.  That said, boats run at 14V+ when running and >12V will fry the regulator killing the motor board - and potentially your arduino and other accessories..)

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites
    On 6/25/2018 at 8:27 AM, Jhartt3 said:
    Relay        
    87 Blue
    12vDC from battery
       
    87a yellow Ground    
    86 white
    Motor driver board
       
    85 black Ground    
    30 red To lenco

    I guess i need you to be more specific as to what you dont understand from this Black and yellow are tied together to battery ground - the White goes to the motor control board output, and the red goes to the proper wire for the lenco.  only one lenco wire per relay per the table below.  Out1 would go to Relay1 for sake of simplicity and then that would wire to the white wire on your starboard mounted actuator.  Out2 would go to relay 2 and the black wire of the starboard mounted actuator.  

    Motor Driver Board
           
    GND Battery GND      
    out1 Right Lenco - White white    
    out2 Right Lenco - Black black    
    out3 Left Lenco - White green    
    out4 Left Lenco - Black red    
    POWER Battery +12VDC

    Thanks jon,, the jumper is removed.  sorry I have one more question, To be more specific, for the motor board, Do I wire the ground and the power directly to the battery, or to the output of the power supply, or do i just connect the 5v and the ground to the adruino screwsheild 5v and gnd with the small wires?

    Edited by Antoine

    Share this comment


    Link to comment
    Share on other sites
    27 minutes ago, Antoine said:

    To be more specific, for the motor board, Do I wire the ground and the power directly to the battery, or to the output of the power supply, or do i just connect the 5v and the ground to the adruino screwsheild 5v and gnd with the small wires?

    Wire the 12V/GND on the motor controller to the 12v BEFORE the 12-9V regulator  (but make sure both are on switched power that is not always on, do not run directly to battery.)

    Treat it as 2 independent power systems:

    1) Ardiuno controller (GPS, motor shield, etc - low draw, use whatever you want) - everything here shares a common ground.

    2) Acutator relays (High amp draw, make sure power/gnd are same gauge.)  This is a dedicated power/ground from the battery of an acceptable gauge.

    You are dealing with 4 different voltages on the arduino - so that makes it confusing, 12v source (regulator, motor driver), 9v (arduino output from regulator), 5v (motor controller and anything on the 5v arduino regulator) and 3.3V (gps, switch, etc).

    The wiring diagram on my project might help - i am using the LM2596 in place of the 12-9V but it is doing the same thing -https://github.com/jonthompson/surfactuator

     

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites
    53 minutes ago, Antoine said:

    thanks for the clarifications

    I can still run directly from the battery to the relays?

    Yup! A single pair of the same gauge wire for both +12 and GND - so a 25A-30A line under-30ft should be 10AWG - as per the power table i shared above.  

    Edited by jonthompson

    Share this comment


    Link to comment
    Share on other sites

    Ok, i am going to try this tomorrow morning on the boat. My actuators are already installed so the easiest way to test is to install it. I double checked everything but chances are, i am missing something. 

    Please let me know if you see something wrong. C12781F5-B1FD-49C4-9B8D-C7D3784EF006.thumb.jpeg.0e09e684c6a410a0546238ff1662eb47.jpeg27AE6CC4-EE4A-4DD1-A468-E8A851B038EB.thumb.jpeg.550f3c2f62bd856ea75fadde61029809.jpegA079DA77-8DB2-4F53-8C13-9E5387C07651.thumb.jpeg.602368236eb80afd8f080adfa9c34cb0.jpegCF6B5F1F-3BFA-4EFB-8916-EF22264F3855.thumb.jpeg.5080850174f9092b343af7e1e6875036.jpeg

    Share this comment


    Link to comment
    Share on other sites

    Make sure the 9v black and yellow are on Vin and ground. 

    You can change the lower speed to -1 in the logic and it will work in your driveway for testing. 

    Share this comment


    Link to comment
    Share on other sites

    SUCCESS,  it works, almost perfect.

    Guys, thank you soo much for creating this and all the help you provided.  I would have never been able to do it, but just copying your project, i learned a bunch of stuff, and I realy enjoyed the process.

    Unfortunately, the gps does not work.  Everything works good when I change the speed in the code for -1, but when I put back 7 mph, it becomes very unreliable. So it does realy does itsd function but at leasrt, i know that all the connections and the hardware part is good.

     

    Share this comment


    Link to comment
    Share on other sites

    Wait NVM it's in the wrong spot should be on inputs 2/3 not tx rx.  See the pin out above in op for where txd and rxd go. Should solve your problem

    Edited by Jhartt3

    Share this comment


    Link to comment
    Share on other sites

    Thanks jhartt3. I am going back to the boat this afternoon. I can’t wait to try this.

    I went this morning to tiewrap the wires in place and cleanup the boat  

    It’s Canada Day here in the national capital (Ottawa). There’s going to be a million boats on the river to participate in the celebrations and watch the fireworks. Its a real zoo on the water. 

     

    Share this comment


    Link to comment
    Share on other sites

    Jhartt3, i didn’t have a chance to re-test during the long weekend. I double checked the connections and it was on imput 2/3. It is just the angle at which the picture was taken. 

    I took the time to install everything properly and glue the gps antenna in front of the windshield. Hopefully it will help, originally i had just installed it quickly to test, with the intention of doing a better job after i was certain it worked  

    One of the reason i didn’t finish the test is that i had a couple of problems with the boat.  One of my ballast pumps keeps starting on its own even when the switch is off and even when the key is off. And then one of my surfgate connection to the actuator came off .  I will have to use bolts and go through the gates instead of using screws.

    So it will be a few more days before i can test it again. I will certainly keep you posted

     

     

     

     

    Share this comment


    Link to comment
    Share on other sites

    The test didn’t go so well. 

    The gates are repaired and they held good this time.

    When I set the speed to -1mph, I can use the switch to activate one side, the other side and even  switch side and both actuators work together perfectly. 

    When I set the speed to 7 mph, it will work for the first time and even retract when I slow down but after a that, nothing works.

    I have tried different speed settings, use 5v for the gps instead of 3v, I installed the gps antena in front of the boat, but nothing seems to work. 

    I am starting to think that I have a bad gps or antenna. For now this is a huge improvement over the suck gates that I was using so I am still extremely happy with the system. And very greatfull for your contribution.  I have triple check all connections. At this point i might juste order a gps and antenna. 

    Would you know if we can see the readinds of the gps on the computer. I would like to find out if it is reading speed properly

    Share this comment


    Link to comment
    Share on other sites
    33 minutes ago, Jhartt3 said:

    yeah could be that. i'm not really sure.  what your issue is other than hardware at this point. you can read the GPS @jonthompson maybe able to help better than I. 

    Do you have the ability to hook up a laptop to the controller to get serial printouts while you are testing?  Kind of a pain - but it'd be much easier to debug this issue.  Are you using jhartt3's code or mine on github?  Mine prints stats out every second to serial - if you point me at the code you're using i can add some debug logic to it for you to see if we can track down the issue.

     

    Share this comment


    Link to comment
    Share on other sites

    I am using Jhartt3 logic and hardware.  Its easy for me to hook up a laptop in the boat.  I have done that to test the system and go bakc and forth with different min speed settings.  I use my cell phone to share an internet connection.

    If you guys can help, it would be great

    Share this comment


    Link to comment
    Share on other sites
    7 minutes ago, Antoine said:

    I am using Jhartt3 logic and hardware.  Its easy for me to hook up a laptop in the boat.  I have done that to test the system and go bakc and forth with different min speed settings.  I use my cell phone to share an internet connection.

     If you guys can help, it would be great

    Happy to help  -- not to hijack jhartts thread - do you want to drop this to PM?   Or you can facebook chat me -- just we dont clutter up this thread further!  - https://www.facebook.com/jon.thompson1  -- can post back the final response once we troubleshoot it.  

    Share this comment


    Link to comment
    Share on other sites

    Just a heads up - I added a simple cheap DIY surf band to my controller over the weekend and just checked in the code to my github  The added parts are under $20:

    This waterproof SOS band (cheap, waterproof, sealed battery, somewhat lame looking but easier than building one.)  https://www.amazon.com/gp/product/B01BQYTM6Q/ref=oh_aui_detailpage_o04_s00?ie=UTF8&amp;psc=1

    and

    Using the receiver like this: https://www.amazon.com/Transmitter-Receiver-Regeneration-Wireless-Burglar/dp/B01AL5Q7SC

    (Can also get a 5 pack for about the same price without the antennas and just add your own wiring.)

    Logic is - pressing button while surfing overrides the current deploy state until the boat slows below the speed limit - then it returns to whatever you have the switch set to.  This is great for transfers controlled by surfer -- and then not confusing for the driver when restarting.

    Share this comment


    Link to comment
    Share on other sites

    I know this stuff is all relatively cheap and all, but I have a different Arduino (Mega 2560) and Motor Board than you guys are using, so the pins are also labeled differently. Should I just bite the bullet and buy what you guys are using, or do you think my stuff will work with this project? Here are pictures:

     

     

    Edited by jtryon

    Share this comment


    Link to comment
    Share on other sites

    If you end up grabbing my code (which I am actually updating right now moving a pin around to work better with the surf band) the code will work exactly the same on your board as the nano and mega share the same pin configs - the mega just adds a ton more (which is great!)  The only thing i would change is i'd use one of the mega's dedicated RX/TX for GPS instead of the pins I'm using (8/9.) This should just work out of box with my code - no changes required (GPSPort handles that magically for you.)

    Your motor driver looks a little confusing but your pin outs are actually the same as the L298N.  You likely just bridge M1ENA -> M1PWM and M2ENA->P2PWM (we have jumpers for this.)  I didn't check the specs but if you have a 5V regulator onboard that cant handle >12V make sure you disable that (The L298N does, its a jumper.)  Just double check the sheet for how to correctly wire to  make sure i'm not missing anything as Im not familiar with that board.

    Otherwise you just wire the INA/INB the same way as the L298N - you have M1INA, M1INB, M2INA, M2INB instead of IN1, IN2, IN3, IN4 on the L298N - but its the same just different names.

    Share this comment


    Link to comment
    Share on other sites

    Perfect - then yes - it is basically identical.  Just wire it the same as the L298N.. You don't need speed control (normally done with the PWM pins) but you will need to drive the PWM pins high most likely - so you'll need 2 additional wires (the ENA/PWM bridging wont work on that one i dont think.)

    That said - Is there a reason you're using it?  I might pick up a $1 L298N vs a $50 motor board ;)

    I would still plan to use automotive relays with it instead of driving the lencos directly from that board (although it says it can drive 12A, there's really no need to have it do all that work and run all that larger gauge wiring.)

    Share this comment


    Link to comment
    Share on other sites

    i only have it because the first iteration of this project was 2 years ago and that's what the guy i got the code at that time from said to get haha

    I'm still going to use the relay's--i already bought those.  thanks again Jon!

    Share this comment


    Link to comment
    Share on other sites
    On 7/19/2018 at 11:32 AM, jonthompson said:

    Just a heads up - I added a simple cheap DIY surf band to my controller over the weekend and just checked in the code to my github  The added parts are under $20:

    @jonthompson what is the pinout for the surf band receiver to the arduino?

    Share this comment


    Link to comment
    Share on other sites
    On 8/6/2018 at 10:53 AM, jtryon said:

    @jonthompson what is the pinout for the surf band receiver to the arduino?

    Power/gnd should be self explanatory ;)  but one of the RX wires -> D2 (INT0 --There are 2 interrupt pins on the arduino, D2=INT0 and D3=INT1.)  Sorry i haven't addressed the surfband in the docs yet.  It will only switch sides when "speedlimit" is valid -- and it resets once speedlimit is no longer valid (this is intentional since there is a physical switch at the helm, i didnt want it to be confusing.)

    I havent verified if multiple of those bands have the same transmitting ID - i assume they do - but if it doesnt work let me know and I'll send you some simple testing code to capture the output from your band so update the source until I get a chance to write a capture-code part.

    Share this comment


    Link to comment
    Share on other sites

    I apologize in advance, as I have no previous experience with arduinos.  I tried following the install on github, but I didn't have the gpsport or the rcswitch packages.  I was able to locate the rcswitch and install, but not the gpsport.  Also in the .ino I didn't see the AltSoftSerial.  I'm assuming the code is up to date, but maybe not the install in the readme?  Once again, sorry if this is a no brainer, but I don't speak the language haha.

    Share this comment


    Link to comment
    Share on other sites

    Greetings Gentlemen.

    This is my first post on the Garage.  I have been intently reading this thread for some time now and I finally got around to building one and My God...  It works!  Great job JHart and jonthompson.  I will be sending in a donation to the Garage soon.

    I have a question that maybe the Garage Gurus can assist.  I used a simple SPDT switch to control the L/R Lencos.  It works great.  I wanted to geek out and use these LED push button switches, one for each side red and green. (see below)  I wanted to press the button on the surf side and the LED would turn on.

     

    Here is the switch schematics.(see below)

     

    I set the program at -1 MPH to test the controller.  When I connected the switches, the arduino controller works in reverse.  I press the switch and the lenco retracts.  I turn off the switch and the lenco extends.   I connected Pin 4 and Pin 5 to the right side (NO) of each switch on the schematic.  The negative obviously went to ground.  On the left side (NO) I connected to 12V.  The top was jumped to the right side to power the internal LED.  

    What am I doing wrong?  I'm thinking I'm sending 12v back into the arduino board.  Do I need to install a diode?  Can you guys help? 

    IMG_1530.jpg

    IMG_1531.jpg

    Edited by Clutch-n-Throttle
    fixed pictures

    Share this comment


    Link to comment
    Share on other sites

    Those look cool...   where did you find that switch?   I may want one for a different purpose.

     @Jhartt3 or @jonthompson may or may not be able to help you on the switch side.   They sure did a phenom job on the Arduino. 

    Share this comment


    Link to comment
    Share on other sites
    On 5/24/2019 at 5:51 AM, Rugger said:

    Those look cool...   where did you find that switch?   I may want one for a different purpose.

     @Jhartt3 or @jonthompson may or may not be able to help you on the switch side.   They sure did a phenom job on the Arduino. 

    I found them on Amazon

    Share this comment


    Link to comment
    Share on other sites

    I just looked at your schenatic more. The switch should connect to the Arduino you should pull 5v off of it and send that back to the input. You should not be sending 12v to an Arduino. You may have friend it. 

     

    On a separate note this stuff is really robust. Somehow my controller box ended up full of water.  The only part that needed replaced after drying out was the GPS module. 

    • Like 1

    Share this comment


    Link to comment
    Share on other sites
    18 hours ago, Jhartt3 said:

    I just looked at your schenatic more. The switch should connect to the Arduino you should pull 5v off of it and send that back to the input. You should not be sending 12v to an Arduino. You may have friend it. 

     

    On a separate note this stuff is really robust. Somehow my controller box ended up full of water.  The only part that needed replaced after drying out was the GPS module. 

    Thanks for the response Jhartt.  You are correct.  I did fry a few Arduino boards.  🤣  My problem was that I was connecting the switch from a 12V source and connecting it to 5V Arduino.  My electronics-Fu is not strong.  But I think I worked it out like you suggested.  

    I thought I could connect the LED switch to 12V so I can get a bright light out of the switch.  If I connect the switch straight from the Arduino's 5V (Pin 4 or 5) source, I can get it to work.  The LED switch light is a little dimmer than if it was connected to a 12V source, but I think it will be fine.  I made a quick circuit to test it out.  Its below in black:

    In red would be the arduino board and its connections.  I will try it out later this week. 

     

    IMG_1545.jpg

    Edited by Clutch-n-Throttle