Schoolhouse
Greenhouse
A middle school technology team
contacted me at Parallax Tech Support one day
about a project they were working on. This
team of girls was creating a model greenhouse
using a Stamp and a continuous rotation servo.
The group was trying to open and close a door
on the greenhouse to regulate air flow, but
quickly realized they could not get consistent
control of the servo. Turning it for the same
number of pulses in one direction or the other
did not result in the same amount of
movement each way.
There was no encoder or active feedback
to set a position, nor was it convenient to add
an encoder to the system. The solution was to
implement a limit switch of sorts, but they
weren’t sure how to read the switches and
move the servo at the same time. Furthermore,
they were limited on options for a limit switch
due to space constraints, as well as the way the
door mechanism operated.
Based on the information provided, I
created a small demo of the style of door they
were using. This was a vertical sliding door, and
was lifted up by the servo using a piece of
fishing line or string wrapped around the servo
shaft. To open the door, the servo reels in the string lifting
the door. To close the door, the servo lets the string back
out and the weight of the door allows it to close. You can
see the mock-up I created in Figures 2a and 2b. This
allowed me to test their existing code and devise a solution
using parts they already had in the BASIC Stamp kit.
It was clear that given the mechanical aspects of this
design, traditional mechanical limit switches would be
difficult to implement. I decided to use optical limit switches
since the plastic could be easily drilled for the optical
elements and the door itself would make a great optical
interrupter.
Refining the Demo
While I was able to describe to the students how they
could implement the servo control and limit switches, it
occurred to me that with a better demo I could show more
people how to go about controlling a door. So, I enlisted a
colleague from Parallax, Matt Gilliland to laser cut me
something that could serve as a demo for what I was trying
to do. The results are shown in Figure 3.
This project is essentially a demo for showing how to
control a vertical sliding door using pushbuttons and optical
limit switches. The demo includes a continuous rotation
servo, two pushbuttons, a bi-color LED, the sliding door
mechanism, and two optical limit switches which are really
just an IR LED and a phototransistor aimed at each other
with a gap in between. The top also contains a battery
pack power supply and a controller; in this case, the
Parallax Board of Education with a Stamp 2 installed.
There is a schematic and example code for controlling
the door with one or both pushbuttons. The bi-color LED is
used for status feedback and is optional.
How It Works
Typically in a microcontroller application, your code will
have a main loop. Within this main loop, you are waiting
for some indication that the door needs to be opened or
closed. In our case, this is done by monitoring the
pushbuttons within the main loop. Once a button has been
SERVO 09.2016 43
Figure 2B. Rear of door
project prototype.
Figure 2A. Front of door
project prototype.
Resources
Parts:
www.parallax.com
Project Website:
www.savagecircuits.com
Savage///Circuits You Tube Channel:
www.youtube.com/savagecircuits
Post comments on this section and find any associated files and/or downloads at
www.servomagazine.com/index.php/magazine/article/September2016_Automated-Doors-Robot-Control-Fundamentals.