Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About jonthompson

  • Rank
  1. Arduino Controller for Automatic gates

    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.
  2. Arduino Controller for Automatic gates

    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..)
  3. Arduino Controller for Automatic gates

    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.
  4. Arduino Controller for Automatic gates

    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! 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(); } } }
  5. Arduino Controller for Automatic gates

    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.