Automatic Gate Slider Under $100

by badarsworkshop in Circuits > Arduino

25919 Views, 75 Favorites, 0 Comments

Automatic Gate Slider Under $100

Opening Image.jpg

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

plan.jpg

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"

IMG_20190525_123839.jpg

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

IMG_20180808_134954.jpg
IMG_20180808_135001.jpg
vlcsnap-2018-09-13-18h02m29s082.png
vlcsnap-2018-09-13-18h01m58s536.png
vlcsnap-2018-09-13-18h03m38s291.png
vlcsnap-2018-09-13-18h04m13s244.png
vlcsnap-2018-09-13-18h05m58s976.png

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

IMG_20180807_123857.jpg
vlcsnap-2018-09-22-15h28m56s053.png
vlcsnap-2018-09-13-18h13m47s417.png
vlcsnap-2018-09-13-18h11m43s851.png

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

vlcsnap-2018-09-22-15h33m07s691.png
vlcsnap-2018-09-22-15h34m31s193.png
vlcsnap-2018-09-22-15h35m34s121.png

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

vlcsnap-2018-09-22-15h43m06s464.png

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

schematic.png

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

IMG_20180802_222414.jpg

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

IMG_20180809_230854.jpg

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

IMG_20180817_183255.jpg
IMG_20180817_183313.jpg

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

Capture.PNG

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?)

IMG_20180817_183317.jpg
IMG_20180817_183327.jpg

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

C-400-DEV-A000046-a.jpg
1871-1.jpg
Good Quality Windshield Wiper Motor.jpg

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.

  1. Wind Shield Wiper Motor AliExpress = $10 from junkyard
  2. 12V 4.5Ah Lead Acid Battery = $10
  3. 12V Battery Charger = $10
  4. Motorcycle Chain = $20 (less from junkyard)
  5. Relay Module AliExpress = $3
  6. Arduino Uno AliExpress = $4
  7. Current Sensor AliExpress = $2
  8. RF Module AliExpress = $2
  9. RF Remote AliExpress = $5
  10. Housing = $15
  11. Limit Switch AliExpress = $5
  12. Misc (Steel, Wire etc.) = $14

Total = $100

Conclusion

IMG_20190525_071236.jpg

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.