Robomow Garage Door Opener – Configuring the Raspberry Pi

There are 2 Raspberry Pi add-on components we need to properly connect to the Raspberry PI in order to get  the garage door closing mechanism to function properly.  The Servo Motor that will close the door and the limit switch which will be used to notify us when the robomow is inside the garage.   Lets look at the wiring for each.

Connecting the Servo Motor to the Raspberry Pi

I am not an electricla engineer so to accomplish this task I found a few nice tutorials on youtube that walked me through the process.  It was quite simple.  Really cool and fun to do!  Here is a Tutorial I followed.  Helped me understand the basics about a Servo.

The most important part is connecting the servo wires to the proper pins on the Raspberry PI.


Connecting the Limit Switch to the Raspberry PI

I really could not find any good tutorials for how to connect limit switches to a Raspberry PI.  If anyone knows of any please comment below.  I used tutorials on how to configure a button and that seemed to do the trick.  The basic pin layout is show below.

The Code

You can see below the code is really simple.  I will break it down further

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)

GPIO.setup(17, GPIO.OUT)

p = GPIO.PWM(17, 50)

p.start(7.5)

try:

while True:
p.ChangeDutyCycle(7.5) # turn towards 90 degree
time.sleep(1) # sleep 1 second
p.ChangeDutyCycle(2.5) # turn towards 0 degree
time.sleep(1) # sleep 1 second
p.ChangeDutyCycle(12.5) # turn towards 180 degree
time.sleep(1) # sleep 1 second
except KeyboardInterrupt:
p.stop()
GPIO.cleanup()




THE MOTION OF CLOSING THE DOOR

When first using the servo motor, I thought the motor I had was to small did not have enough power to force the door closed.  After some experimenting I discovered you can increase the torque by easing into the DutyCycles slowly by making multiple calls as you try to move the garage lever from lying horizontally (lets say 0%) to moving to a postion of 90% completely vertical.  Attempting to do this all at once will result in the motor failing to reach the 90% completely Vertical. 

After the operation is complete, we reset the servo position to180%  which forces the servo to return to its starting position or a little more.


In order to get enough torque to push the door closed ChangeDutyCycles

Here is a quick video that walks you through the process.

00
Days
00
Hours
00
Minutes
00
Seconds

Watch AI in action.  Click HERE to learn more