Door Control Default State

Thread Starter


Joined Apr 23, 2021
Hi Readers,

I am working on a project where a door gets opened and closed by two actuator assemblies, one on each side. This actuator assembly has a brushed motor with encoders and the shaft that extends (for opening) and retracts (for closing). The microcontroller that controls these door actuators need to see the door being closed and latched at the time the microcontroller wakes up. Otherwise, the microcontroller doesn't execute any door command. So I am looking for a solution where the controller is able to detect any position of the door (besides closed and latched) when microcontroller wakes up from sleep.

Solution 1

Q1. To register the last know state of the door and the door angle before NBCM goes to sleep. If so, in which memory of microcontroller this last known state will be stored?
Q2.How much memory will be required to store one of 4 possible states (Fully Open, Fully Closed & Latched, Fully Closed but not latched, Open) of the door? along with door angle which is the range of 0-90 degree.

Solution 2

What would be other way that allows the controller to know any door state without having the controller store the door state in the memory before going to sleep?
Last edited:


Joined Apr 4, 2016
So the only feedback you get from the actuators is the encoder?
No limit switches - for fully open and fully closed?
The problem with the motor encoder is that it is probably an "incremental" encoder. It only tells you how far (in pulses), how fast and what direction it is moving. An "absolute" encoder gives a position output which doesn't change on a power cycle and basically outputs a binary value of absolute position. Absolute encoders are much more expensive.
Systems that use incremental encoders have to use a "homing" sequence on power-up to establish the "home" or zero point.
This usually means traveling slowly to one end of the travel - which can be a hard mechanical end stop (where the drive will stop on a torque limit) or a limit switch or sensor, stopping there and zeroing the encoder counter. From then on, all moves are based on this zero position.
For your doors you really need limit switches or sensors for "fully closed" and fully open". Don't bother with the encoder.


Joined Jan 8, 2017
There are a number of things that are not clear to me from post #1.
1, I can't visualise why two actuators are required to open and close one door.
2, What is NBCM ?
3, What actually decides the motion of the door ?
4, What causes the microcontroller to wake up ?

Your question about the amount of memory required to store the door position depends on the resolution you require. If the resolution was one degree then there are only 90 discrete positions so only 7 bits would be required. In practice you would probably use one byte. To store the 4 states would require 2 bits. Again in practice you would probably again use one byte.
You would probably use EEPROM memory to store this information.
A project I built several years ago has some similarities with you project. It is a roller blind that has a crude encoder that generates two pulses per revolution. It works by being supplied from a plug in timer that applies power for two minutes in the morning and two minutes in the evening. When the blind is opening the pulses increment a counter. When the blind is closing it decrements the counter. When the power is removed the value of the counter is stored in one byte of EEPROM. One bit of another byte is a flag to store the last action. (Opening or closing.) When it is first installed it has a setup mode where it is manually positioned in the open and closed positions and these two counts are stored in two more bytes of EEPROM.
Although this is very crude it has worked many years without a problem. This uses a PIC16F84.