Electric Gate controller safety stop

Hello. I am new to Arduino, but making some good progress. Recently, my swinging gate controller expired, so I decided to make my own controller.

I have written the code, and the gate opens and closes at the correct times, and overall operates well.

My only concern is that I do not have a safety mechanism in place should the gate encounter an obstacle eg. one of my kids. The gate will continue to operate until a limit switch is activated. One method I have thought of, but can't seem to find a way to write code is where the gate will monitor the time to it reaches the "fully closed limit switch" and open if this is exceeded? Would appreciate any advice. Best regards, Mark. PS the gate opens inwards, thus a beam will not work

I don't think the software solution would work and even if a kid were to get dragged under the fence, it might not be enough to slow the fence down.

I guess it would really help if I saw a picture of the fence or something so I could see what you were doing. Maybe some type of pressure sensor could be used. If anything puts any type of force on the gate while it's moving, it would just stop.

I think it's more of a hardware problem, than a software problem. I guess it's hard to know with such limited information.

If you continuously measure the current taken by the motor and it stalls or the gate hits an object, the current drawn will rise. If you know what the 'free moving' current is and it goes above this level, you can stop the motor (or reverse it) immediately. [Edit]See this link, provided by Grumpy Mike in another thread. Arduino Current Sensor

Thanks for the reply.

The original gate controller would stop the gate in the event of any obstruction, and work by analyzing the load on the motor, and stop it at a particular reading. If the reading exceeded a certain point, not only would it stop the gate - but also blow a fuse on the board.

This is probably the path I should also take, (safer and more instant), rather than using timing etc. Guess I was just interested in any other methods.

FYI the gate is not operating until I resolve the safety issues!

Best regards,
Mark

If any known obstructions could be present (e.g. parked car) a few proximity sensors may be helpful.