You are on page 1of 5

Design and Implementation of an Efficient Elevator Control

System using FPGA


Date: 28/11/22

Om Jhaveri (202001050) Kandarp Devmurari (202001052)


Vushil Bhavsar (202001054) Pranav Patil (202001055)

Introduction
In this project, an elevator controller is implemented on an FPGA board using VHDL language. The
elevator controller consists of combinational logic circuits and a finite-state machine. We have created an
elevator that is programmed to move across 3 floors. It also displays where the elevator position is, what
requests have been made, and in which direction the elevator is currently moving in (up or down
direction)

The system uses a Finite State Machine (FSM) to take floor inputs from inside the elevator and up and
down calls from outside the elevator, to determine the movement of the elevator from the current state to
the desired next state. States have been defined floor-wise, depending on whether the elevator doors are
to be opened or closed. Sensors are used to improve the reliability and safety of the elevator by
positioning it appropriately. This elevator controller system has been successfully implemented on Xilinx
Zynq FPGA Board using Very High-Speed Integrated Circuit Hardware Description Language (VHDL).

The system has 2 types of inputs to the FPGA board:


● Inputs are given by the users (i.e calling the lift on each floor)
btn1, btn2,btn3

● inputs that are given by the proximity sensors (i.e used in predicting the current location of the lift
and moving to the target destination
sensor_low , sensor_m_m, sensor_m_p , sensor_top

The system has 3 types of outputs for the FPGA board:


● Output indicating the target floor
t1 (1st floor) t2 (2nd floor) t3 (third floor)
● Output indicating the current floor
Curr1 (elevator is on 1st floor), curr2 ( on 2nd floor),curr3( on 3rd floor)
● Output indicating the current direction of motion of the lift
downled, upled
● Output indicating the direction of motion of the
Motor_msb,motor_lsb [ we took (motor_msb,motor_lsb) = '10'(up), '01'(down), '00'(off)]
State Diagram

State machine

F1 → Sensor_low = 1 , m_m = 0
F2 → m_m = 1 , m_p = 1
F3 → m_p = 0, top = 1

Up/Down contains variables listed as (isMoving, current, target)

Up2 →` (1, 1, 2)
Up3 → (1, 2, 3)

Down2 → (1, 3, 2)
Down1 → (1, 2, 1)
Code Snippets
(For code snippet 1 explanation)

This is the part of the code where we find out the value of the target variable. Here, the value of isMoving
is 0 and thus, the lift is static and is not moving. In each if and elsif clause, we assign values of variables
target, t1, t2, t3. The different btn variables indicate the button pressed. If btn1 is 1, it means the button to
go to the first floor is pressed, and so on. t1,t2, and t3 are indicators to target the floor. If t1 is 1, the target
floor is the first floor, and so on. Thus, the above code snippet is to assign values to some variables which
will be used in the further parts of the code.

(For code snippet 2 explanation)

After getting the values of the variables t1, t2, t3, and target, different clauses are made for each value of
the target. Here, in this snippet, if the value of the target variable is 1, then there are 2 possible cases :
1) It is already on the first floor.
2) It is moving downwards as the first floor is the lowest floor.

In the first case:


We set the curr variable to 1 as the lift is currently on the first floor. Hence, except curr1, other variables
like curr2, and curr3 are set to 0. Since the lift is static in this case, variables like upled, downled,
motor_msb, and motor_lsb are 0.

In the second case:


The lift is moving downwards and hence downled is set to 1 and thus upled is set to 0. The motor_msb is
0 and the motor_lsb is 1 in order to make the 01 combination indicating that the lift is moving downwards.

(For code snippet 3 explanation)

After getting the values of the variables t1, t2, t3, and target, different clauses are made for each value of
the target. Here, in this snippet, if the value of the target variable is 2, then there are 3 possible cases:
1) It is already on the second floor.
2) It is moving downwards.
3) It is moving upwards.

In the first case:


We set the curr variable to 2 as the lift is currently on the second floor. Hence, except curr2, other
variables like curr1, and curr3 are set to 0. Since the lift is static in this case, variables like upled,
downled, motor_msb, and motor_lsb are 0.

In the second case:


Since the lift is moving, the isMoving variable is set to 1.
The lift is moving upwards and hence upled is set to 1 and thus downled is set to 0. The motor_msb is 1
and the motor_lsb is 0 in order to make the 10 combination indicating that the lift is moving upwards.

In the Third case:


Since the lift is moving, the isMoving variable is set to 1.
The lift is moving downwards and hence downled is set to 1 and thus upled is set to 0. The motor_msb is
0 and the motor_lsb is 1 in order to make the 01 combination indicating that the lift is moving downwards.
(For code snippet 4 explanation)

After getting the values of the variables t1, t2, t3, and target, different clauses are made for each value of
the target. Here, in this snippet, if the value of the target variable is 3, then there are 3 possible cases:
1) Lift is already on the third floor.
2) Lift is moving upwards

In the first case:


Since we are on the third floor,
We set the curr variable to 3 as the lift is currently on the third floor. Hence, except curr3, other variables
like curr1, and curr1 are set to 0. Since the lift is static in this case, variables like upled, downled,
motor_msb, and motor_lsb are 0.

In the second state:


Since we have to reach the top floor i.e. third floor,
The lift is moving, isMoving variable is set to 1.
The lift is moving upwards and hence upled is set to 1 and thus downled is set to 0. The motor_msb is 1
and the motor_lsb is 0 in order to make the 10 combination indicating that the lift is moving upwards.

Novelty

● Our code has also taken care of the case when none of the sensors are on which occurs when
the distance between the two sensors is far apart from each other than the length of the lift
● When we are in a moving state we are not taking any inputs for any other target floor once we
reach the earlier target floor

Conclusion

For this project, we learned the basic idea of how the normal elevators run in many cases, even though it
is simplified, we still spent lots of time designing and figuring out many problems when combining all the
cases, of course, the most challenging and time-consuming part is debugging. However, after
accomplishing it, we learned many things beyond this project, so it is a very helpful assignment

Contribution
Everyone has contributed equally

You might also like