Go Down

Topic: Rotating door automation (Read 9308 times) previous topic - next topic


I'm hoping I can get some advice about if its possible to use Arduino to solve a problem.

I have a hen house with a door that opens by rotating 180 degrees, operated by a T shaped handle. pictues

Is it feasible to use a servo like this to rotate and counter rotate the door? If so what would I need to construct it?

An arduino unit - which one would be suitable?
A shield?
Something to power the servo
A breadboard and connectors
Geewiz box to house it all

Supplying mains power shouldn't be a problem but if I opted for batteries would that cause more problems or are there battery modules. Assuming open and closing once per day what sort of battery life could I expect?

Opening and closing will be based on either a set time or  on input from a light sensor.

I've read through some of the topics but I can't find if something like this has been done before.

How much programming are we talking about to make this all work?

I know that's a lot of questions but from looking at previous posts it's easier to give accurate information if you provide as much details as possible.

At its most basic all I want is a timer to power a servo to go one way in the morning and the reverse in the evening...


> Is it feasible to use a servo to rotate and counter rotate the door?

If the servo has the torque needed to turn the knob.

> If so what would I need to construct it?

A bracket on which you can mount the servo and some way to connect the servo bellcrank to the knob.  Possibly a dome to protect the servo from rain.

> An arduino unit - which one would be suitable?

Any.  The UNO is the most common.

> A shield?

No need. The servo has a built-in motor controller.

> Something to power the servo

A 7V 1A power supply should serve both the servo (7V) and the Arduino (via Vin).

Note: For time-based operations you should probably get a Real-Time Clock (RTC) chip.  The Arduino UNO is not great for long-term timekeeping.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


That's for the reply. For mounting the servo itself I was thinking of inverting it and having the rotational centre directly above that of the door to keep things straight forward. The servo I linked to was a 13kg load one, does that sound reasonable? The resistance to move the door would be less than it takes to turn a doorknob I'd say so hopefully 13kg will be enough.

Please excuse the proably stupid question but I've not seen the term vin mentioned, what is that?

Would I need to split power off some way to the servo or would it just be a matter of plugging the power into the arduino board and taking it through  to the servo?

I'll add a RTC clock to the shopping list. I've seen various starter kits that include connectors and cables and various other bits and bobs. If there was one that came with a servo that'd be handy - at least I'd know I had everything I need.


vin mentioned, what is that?

VIN, Voltage IN. The voltage applied to the DC barrel jack. Usually between 7 and 12 volts.

Normally you would split the power to the servo and the Arduino, servos like about 6v which unfortunately is not enough to drive the Arduino so that may mean two power supplies.

If you have power then two plug packs, for batteries maybe a 7v2 battery directly to the Arduino and regulated down for the servo.

EDIT: That servo can operate up to 7v2, so it looks like you can use a battery or single plug pack for both.

Rob Gray aka the GRAYnomad www.robgray.com


That's for the reply.

I mean, "thanks". Damn you autocorrect.

So shopping list would be:
13kg 7.2v Servo
A 7v 2amp PSU - split into 2
rev3 UNO kit
RTC Shield

Do I need anything else?

What's your views on this as a project? Am I missing an easier, better way to do this?


That look reasonable to me. The RTC module will not be super accurate but good enough for this I would think.

Do I need anything else?

How are you going to set the time? That will probably have to be done in the field as the RTC creeps over time. This normally requires an LCD and some buttons which is a pain if that's all they are needed for.

An alternative is to have a single button that forces the time to a given value, say 6PM. So every few days/weeks or whatever you press the button at 6 o'clock.

There will be some mechanical linkages to get as well. If this is outside a good enclosure will be required.

Rob Gray aka the GRAYnomad www.robgray.com


I was thinking a geewix box for the enclosure.

Linkages. What's a good source for small gears belts and chains etc in the UK?


No idea, but try model and robotics shops/sites.

Rob Gray aka the GRAYnomad www.robgray.com


Just a small update. I've ordered a starter kit that includes a step motor, small servo and Light dependant resistors.

The kit also has an LCD and some buttons so the time can be changed as you suggested. I know I'll need a heavier servo/motor but my thinking is if I can get it working in principle first I can drop a bigger one into the circuit later.

There's also an IR remote, being able to operate the door using that would be quite handy. I could even get really fancy and have a buzzer go off 10 minutes before the door closes to tell the chickens it's bedtime. They're quite easy to train to that sort of thing. :D


My UNO and accessories have arrived.

For testing I was wondering if I could connect a LDR to the prototype shield and have an LCD display its resistance to calibrate at what light intensity to operate the servo? If that's possible could anyone point me in the direction of a tutorial to output the reading from an LDR to an LCD?

I think I want to sketch to run along the lines of

Detect "night" or "day" every 5 minutes. If its day for 3 consecutive checks, open the door. If its night for 3 consequtive checks, close the door.

Then a button to toggle between Open, Close and Automatic.

I've never done any electronics before so I appreciate any help and advice.


I don't know of any tutes and probably I doubt you'll find one that does both, but there will be LDR tutes and LCD tutes that you can put together.

Start looking in the Arduino playground.


Rob Gray aka the GRAYnomad www.robgray.com


Got the basic code started and tested.


Can anyone suggest an easy way to have the servo move more slowly?

Code: [Select]
#include <Servo.h>

const int THRESHOLD = 680;   // an arbitrary threshold level that's in the range of the analog input
Servo myservo;  // create servo object to control a servo

int LDRpin = 0;  // analog pin used to connect the potentiometer
int LDRval;    // variable to read the value from the analog pin

void setup()
    // initialize serial communications:

void loop() {
  // read the value of the LDR:
  int analogValue = analogRead(LDRpin);

  // if the analog value is high enough, turn on the Servo:
  if (analogValue > THRESHOLD) {
  else {
    myservo.write(0); //Reset the Servo if the value is too low

  // print the analog value:
  delay(150);        // delay in between reads for stability


One easy way to move the servo more slowly is a for loop that moves it a degree at a time, with whatever size delay you need on each iteration.


I have finished (I think) the code and hardware for this and I'm now at the stage where I want a permanent power solution.

Ideally I want to take a hard wired feed from the mains. Are there any recommendations for the easiest way to power an UNO board and servo in this way?


The Arduino can run on 5V at the +5V pin or on 7-12V on the Vin pin.  The servo is probably designed to run at 6V so neither choice is ideal.  Perhaps you could use a hefty 7+V supply and put a few big silicon diodes in the line going  to power the servos.  A silicon diode has a voltage drop of 0.6 to 0.7V so add drops to bring the voltage down to about 6V.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.

Thank you for subscribing!

via Egeo 16
Torino, 10131