Automatic Gate Slider Under $100
by badarsworkshop in Circuits > Arduino
26150 Views, 75 Favorites, 0 Comments
Automatic Gate Slider Under $100
Over the summer, my dad motivated me to look into buying a gate automation system and setting it up. So I started my research and looked into package solutions on AliExpress and local vendors. The local vendors were offering complete solutions including installation for > $1000. These were Italian systems and were supposed to be very high quality. But the price was way out of our budget. The systems on AliExpress were also pretty expensive, the cheapest one being $500 before taxes. I pretty much gave up on the idea of buying a complete system and looked into some DIY approaches.
After my initial research, I concluded that it will be very difficult and time consuming to build it from scratch. That too using limited resources. But then I took it as a challenge and started putting a rough plan together.
It took me a lot of trial and error, and a lot of hard work but I was able to set up a reliable system for a price point that no other system can beat.
If you are looking into building something like this, I would encourage you to do so as I explain all the problems that I encountered during my build process. Hopefully you will be able to get some insight and avoid the mistakes that I made.
If you like what I have made and explained, please consider giving me a vote. Any support is highly appreciated. _________________________________________________________________________
Also follow me on other platforms as I share my progress in between projects.
Facebook: Badar's Workshop
Instagram: Badar's Workshop
Youtube: Badar's Workshop
The Plan
I started thinking about how I would go about it. There are many ways that such a project can be tackled, each with its own advantages and drawbacks.
The first thing I did was understand the existing system I was working with. For me this meant my heavy, all metal, sliding gate. For you it might mean something else and I would recommend you to first fully understand your system before settling on a strategy.
I realized that my gate was not built very well and had some variations in its motion. So whatever my translation method was going to be, would have to cater for that variation. That got me thinking about using motorcycle chain. I have used them before so I was familiar with their working. The are cheap and widely available. And their big sections mean minor misalignment will not matter much. The mounting of the chain on the top edge worked well for me since I had a bracket on the top to mount the motor assembly so everything could sit neatly at the top of the gate.
Next came the motor selection. I was shooting for low cost so I dug into my left over parts bin and found a car windshield wiper motor from my combat robot build. I remembered that this motor had a lot of torque and was very well built. So I was confident it would have enough power to drive the gate.
For now I had all the plan that I needed. The electronics and control are whole different story and they will come later on.
Testing the Motor "Accurately"
So I was confident that the motor will be able to move the gate but I was not going to build the entire thing and then be proven wrong. So I did what engineers are supposed to do. Testing.
Well I think they are supposed to do calculations first but I didn't have any values to calculate from. So I dusted my old combat robot and tied it to the gate. The combat robot uses two windshield wiper motors to drive it. And it was the closest thing I was able to set up quickly in the name of testing.
I gave the robot full throttle and what do you know, the gate started moving. Despite the lack of traction, the robot was able to move the gate. That was good enough for me so I proceeded.
Making the Motor Mount
From a past accident, I knew that these motors are no joke. And if you get your finger in the sprocket, you can kiss it good buy. I had a near finger loosing incident when I was building the combat robot so I speak from experience.
Based on that experience, I wanted the assembly to be as tucked away as possible. So I decided to mount it on the bracket that was holding the gate in place.
I first attached a steel sheet between the two angle iron pieces. This was so I can mount my motor assembly on top, without having to worry about having a sturdy base.
I decided to make the motor assemble removable from the main gate base because I might want to work on it separately. Taking the motor off would have been very difficult especially because I was working in a tight space. This paid off later as I took the motor assembly off multiple times to work on it.
As you can see, I attached the motor to the motor assembly. I also attached the sprocket on the motor and a couple of sprockets on either side to guide the chain onto the motor sprocket and not allow it to slip under load.
Making the Chain Bracket
The whole theme of this project was to keep the cost down hence I wanted to reused old bits of steel that I had instead of buying new. I found an old piece of angle stock that was thick enough for my use.
I cut the stock to size using my angle grinder and then welded it together to make the bracket. Then I welded the bracket on top of the gate. An important thing to note is that you dont want to weld on top of a painted surface. Always grind away the paint in the weld area.
I had to redo the welding three times. The first time was because I didnt mount the bracket outside of the physical hard stops of the gate. So when I was testing it and accidentally broke one of the wires to the limit switch, the bracket forced into the limit switch and broke it. So its important to always mount the brackets such that they cannot harm another part of the system if the electronic limit switches fail.
The second time was because I mounted the brackets crooked. This was my first welding project and I didn't have proper clamps so I had a hard time aligning the bracket.
One final mistake I made was to drill a hole after completely welding the bracket. And because welding makes the steel much harder, its much more difficult to drill out. I spent three drill bits and an hour of constant drilling to just make two holes.
So learn from these mistakes if you plan on making something similar. Lets move on to installing the chain.
Installing the Chain
I first had different ideas in mind on how to mount the chain such that it will have shock absorption to prevent motor overload when starting from a static position. But nothing seemed simple enough to implement. So I just went with the cheapest and simplest solution.
I took one chain and cut the middle bearing on the end piece. I then took a 3" bolt and cut off the head. I secured the bolt in the last piece of the chain and welded it on. It might not be the prettiest solution. But it will work.
I connected all the chains end to end and then secured the nut end in the chain bracket on one side. I measured to see where will I have to cut the chain on the other side. I marked it and repeated the nut welding procedure.
I then mounted the chain on top of the gate. I used a couple of bolts to secure the two end such that the bolt wont work itself loose.
The key in my case was not to tighten the chain too much because that would put a lot of stress on the motor and sprockets. Instead, letting the heavy chain rest on the top edge of the gate seemed to be the best way to avoid constant load on the motor.
That way, when the motor does start to move the gate, it has to pull the weight of the chain first before actually pulling the gate. That acts as a spring of sorts to avoid motor overload.
The mechanical part of the gate opener is complete-ish. We can move onto some testing to see if it actually works.
Testing
Now that the mechanical side of the project was done, I could test it out to work out some kinks and possible pitfalls. I used a 12v Lead Acid battery and just manually connected the motor to the battery. And yesss! The gate started moving. All of the effort up till now wasnt for nothing.
I realized a few things during testing. One was that the gate channel needed to be clean and everything needed to be properly lubricated. Otherwise the small motor might have some difficulty moving the gate.
Another important thing was that I needed to have some sort of electronic overload protection for my motor just in case the electronic limit switches stopped working. I didnt want to fry the motor if that happened.
I also determined the right chain tension for optimal performance as I tested the current draw of the motor with different tensions. Lower tension was better because it soaked up all the imperfections in the alignment by wiggling left and right without stressing out the motor.
With these results, I was ready to start work on the electrical side of things.
Electronics Plan
So the plan with the electronics side was to keep things as simple as possible while having the desired functionality.
The power will be coming from a 12V Dry Lead Acid battery which will be connected to a battery charger. Although I had a lot of problems with the charger which I will talk about later.
The brain box will be an arduino board. Nothing fancy, just an arduino uno. The motor control will be through a 4 channel relay board working as a H-Bridge. The RF communication is handled using a 433 mhz receiver module. One of the cheap $1 boards. Although not the best idea in hindsight. More about this later. The current sensing will be using a 20A current sensor. And finally the limit switches and manual operation switches will just be regular switches.
The remotes I used were programmable car remotes. Although they gave me trouble too.
So this was the plan. Let get into the nitty gritty of it.
Electronics Build
The electronics build process wasn't anything complicated. I assembled everything in a manner that I could swap out parts quickly if necessary. I used header pins and spade connectors where ever possible to allow for quick disassembly. I used a relatively large proto board to connect the limit switches and rf board. Having a large board allows me to add more features in the future without having to redo the existing framework.
There are some issues that I ran into with regards to electronics. First was the relay board. The traces on the relay board were not designed to handle large currents at low voltages. Some relay boards have tinned traces but mine didnt. And one of the traces blew up after some time. So I bridged all the high current lines with a appropriate size wire.
Another big issue was the charger causing a lot of EM interference. This was because the charger was off brand and didn't have any kind of certifications. And the interference was messing with the circuit. It would randomly not respond to rf commands. I realized that this was an EM issue when I brought my laptop close to the electronics for programming and it went completely out of control. I bought a full metal body charger which was highly overpowered for my use but seems to work fine for now. I will change it later though.
I also faced problems with the connectors I used for the external switches. They are very fragile and break when taken out multiple times. I still have to figure out some better connectors for it.
The rf module I used is a very basic module and it's range is not impressive at all. But it was what I had on hand and what worked so I stuck with it for now. Although I do plan to upgrade to a better module especially because I want the range to be a non issue. I hate having to walk towards the system just to get it to work.
Housing the Electronics
At first, I just mounted the electronics on a piece of plywood and was planning to build a plastic box on top of it. But I then realized that it would be a lot of work. So instead I bought a large food container that had a waterproof seal on it.
I mounted the battery and charger in the bottom. I mounted the electronics on a piece of plastic that came with the box. I filled notches for all the wires coming out of the box and then used some silicone grease to ensure that no water can go inside. I also made a 3D printed antenna cover in attempts to maximize range.
The box works perfectly. Its clear so I can see if everything is good inside without having to open it. And it has survived some serious spells of rain so it should be good. Although one concern is heat inside the box because it is clear and the sun can heat up electronics fast. Simple solution to that is to cover it with another open cover to avoid direct sunlight.
Limit Switch
The limit switch for the gate was a serious pain point as I had to go through several iterations of the design to get it to work reliably.
At first I just glued two lever switches on both sides of the mount and glues bumpers on the gate to hit the switches. This was a solid idea in principle as I have seen it work in 3D printers. But after some testing, both switches got damaged and the bumpers broke off. I upgraded to bigger switches and added foam infront of the bumpers in hopes to avoid the impact. But they still broke off.
I realized that the gate has a lot of inertia when it hits the limit switch and hence having a force stop limit switch will probably not work. I went to the electronics market to search for ideas and found a roller switch.
I made a 3D printed bracket for it and a 3D printed ramp. This way, the switch would be actuated when it comes to its limit but it wont be in the way if for some reason the gate doesn't stop at all or keeps rolling due to inertia.
Programming the Electronics
Programming the electronics was fairly simple. For the RF receiver, I used the rcswitch library which handles all the nitty gritty details of receiving the signal from the remotes. The rest was just a bunch of if loops to check for different conditions. One of these conditions was checking for over-current protection. I used a loop counter to check for that. You can find the attached code and comment if you want me to explain it in further detail.
Problems Revealed and Their Fix
During the course of this project I faced plenty of mechanical and electrical problems. I have mentioned a few before but I will list them below.
1. Hard stop limit switches: This became a problem as the limit switches would receive a lot of force even after the power to the gate was cut. Such a heavy mass has plenty of inertia. And any hard stop switch I could think of was not enough to absorb that inertia. The fix is to use rolling limit switches like I did.
2. Limit switches placement inside hard limits: You physical placement of your limit switch has to be such that even if the limit switch doesn't work, the gate cant roll into the switch and destroy it. This became an issue when one of the limit switch wires broke off and the gate rolled into the switch, destroying the bracket and the switch. I fixed this by moving the chain bracket outwards so the it cannot hit the limit switch under any circumstance.
3. Chain tension too high: When I first put the chain on, I tightened it so much that it put a lot of force on the motor shaft perpendicular to its plane of motion. Because of this, the motor was ineffective as it was fighting a lot of friction. This wouldn't have been a problem if I made a proper motor mount with bearings and everything but I didn't have the expertise for it. Plus the gate wasn't straight along its length so the chain moved left to right. To fix this issue, I simple loosened the chain. It not runs smoothly.
4. EM Interference from the charger: The battery charger that I wanted to use was producing so much EMI that it was rendering the receiver ineffective and dodgy. I tried to apply shielding but I believe the combination of conductive and radiated EMI was too much for the circuit to handle. The fix for this isn't a permanent solution but I used a much bigger, metal body charger that is almost 20 times as powerful than what is needed. But it works for now.
5. RF Range: The RF receiver I used was not the best. It was one of those cheap $1 ones. The range, although not terrible, is not enough for me to be comfortable. For now I just optimized it using a wire antenna but I will be looking for a better RF solution.
6. Copying RF remotes: This was such a silly issue, when I finally figured it out, I laughed. So I bough these programmable remotes which can learn codes from other remotes. I used one of them as the base line and then tried to copy the codes of that one into the other. After hours of fiddling, I found out that you cant copy the remote from another remote similar to it. You can only copy codes from standard remotes. It took me countless hours to figure that out. So try not to fall into the same trap. Fix is to just use any other standard remote and then copy it to all the programmable remotes.
7. Drilling into Hard steel: This was an annoying issue. When I mounted my chain brackets on the gate, I wanted to drill a hole in them. That's when I found out that the steel had hardened because I welded it. I broke many bits trying to get through this. So my advise it to drill before you weld. Will save you a lot of trouble.
These were some of the issues I faced during my build. I will be adding to this list as I think of more issues.
Finishing the Build (Is a Build Ever Finished?)
I finalized the build by putting everything together. The electronics box went in its place and got wired to power. I finalized a 3D Printed housing for the manual motion switches and mounted them where they could be easily accessed. I put sleeves on the wires and tied them in place to avoid any wire getting caught in the moving parts. I took apart the motor assembly to paint it. I also painted the chain brackets as they had already started to rust.
And that was it. The automatic gate slider was ready to be used. Its been two months since I finished it and its still working as expected. I will be making improvements to it when I go back home so cant really call it a finished build. But finished for now.
I spent more than $100 on it considering all the things I bought which I broke or never ended up using. But I will still list the BOM to show that it can be done under $100 if you put your mind to it.
Bill of Materials
A lot of the parts including the steel, motor etc were recycled. Hence they are not the best thickness or had to cleaned up. But I ended up saving a lot of money.
- Wind Shield Wiper Motor AliExpress = $10 from junkyard
- 12V 4.5Ah Lead Acid Battery = $10
- 12V Battery Charger = $10
- Motorcycle Chain = $20 (less from junkyard)
- Relay Module AliExpress = $3
- Arduino Uno AliExpress = $4
- Current Sensor AliExpress = $2
- RF Module AliExpress = $2
- RF Remote AliExpress = $5
- Housing = $15
- Limit Switch AliExpress = $5
- Misc (Steel, Wire etc.) = $14
Total = $100
Conclusion
This project has been running for two years now. And there have been no further issues. Regardless, I make incremental improvements every now and then. I have upgraded the remotes, added waterproof switches, re-did the wiring, added voltage sensing, upgraded the charger and much more.
The build has proven to be very reliable through high heat and rain. I am proud of what I was able to build, and that too at a very low cost. I will soon be building another system for some relatives with some more improvements on my original design.
I hope you learned something from my journey through this build. If you have any question or comments, please ask away.