How to make a elevator using microcontroller

Microcontroller Topics
Post Reply
chathuranga123
Corporal
Corporal
Posts: 3
Joined: Tue Sep 10, 2013 6:58 am

How to make a elevator using microcontroller

Post by chathuranga123 » Tue Sep 10, 2013 7:33 am

hi, i have to create a prototype electronic elevator with 3 floors.i used 16f877a pic.i want a "pic c" sample code for my elevator.the code must write for inside and outside user interfaces(used 3 push buttons for inside & used 4 push buttons for outside).thanks.
Last edited by Neo on Wed Sep 11, 2013 4:25 am, edited 1 time in total.
Reason: Edited the topic title to be more meaningful
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to make a elevator using microcontroller

Post by Neo » Wed Sep 11, 2013 4:25 am

First of all welcome to the forum. Secondly, we need to take each part of your project and suggest ideas separately. Kindly note that you need to write your code, we will help you as much as possible to come out with the difficulties. Here is the breakdown of the project.

1. Button operations (Inside and outside)
Concerns: Ports/Pins you are going to connect, avoiding de-bounce (hardware or software), etc...

2. Sensor detection on each floor (Inside)
Need to identify when the elevator reaches the right location to stop.

3. Display operations (both inside and outside)
A simple LCD would suffice to show the current floor etc...

4. Motor control (Inside)
This should be given the 90% weight of the project. As I think that you are going to make a prototype first, you may use simple DC motors. Steppers would be easy but when you go in to real application DC motors are generally used. A PID control would be essential to drive the elevator smoothly. If you are not aware of this, you need to study that too.

If you see I miss anything, add those. I recommend to implement 3rd step with stepper motors if this is for a university project. But if this is going to be commercialised, obviously you need t move on to DC or AC motors with PID controllers.

With regard to programming, I would like to know your C knowledge, your experience in writing C programming on PIC microcontrollers and the compiler/platform used (such as Hi-Tech C, Mikro C, etc...).
chathuranga123
Corporal
Corporal
Posts: 3
Joined: Tue Sep 10, 2013 6:58 am

Re: How to make a elevator using microcontroller

Post by chathuranga123 » Wed Sep 11, 2013 6:50 pm

first of all thanks for replying.i'm a university student.and as you told this is for my university mini project.
1.i used 6 push button for in side operation(ground floor,1st floor, 2nd floor,door open, door close, and emergency).and i connected these to D port of 16f877a pic using pull up method. and outside i used 4 push buttons.

2.i used 4 IR sensors to detect the elevator position.

3.i used stepper motor.
i have worked with pic c.and i used pic C (CCS) compiler.i don't have knowledge about Micro C, Hi-Tech C .as i mentioned in the problem i wrote a code and it works.if the elevator car is in ground floor,and when i press the 1st floor switch , its goes to 1st floor.when 2nd floor switch it goes to 2nd floor.and like this it works correctly. but my problem is car is in ground floor and when i press 1st & 2nd floor switches it goes to only 1st floor and stop.i want to modify my code to take 2 user inputs and move according to the inputs.
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to make a elevator using microcontroller

Post by Neo » Thu Sep 12, 2013 12:00 am

You need to use a basic data structure called queues here (priority queue which is a variant to be exact). Say you have 5 flows. A man on each floor can either press up or down buttons. So there could be 10 combinations for 5 floors.

enqueue --> [G -> UP], [1st -> DOWN], [1st -> UP], [4th -> DOWN] ---> dequeue

Note that priority will be always given to the people inside the elevator. So if the elevator is going UP, you need to rearrange the queue to reduce priority on going DOWN requests and vies-versa.

If we rearrange the above queue if the elevator is currently going up, it would be like this.
enqueue --> [1st -> DOWN], [4th -> DOWN], [G -> UP], [1st -> UP] ---> dequeue

If the elevator is going down, then this queue needs to be rearranged as below.
enqueue --> [G -> UP], [1st -> UP], [1st -> DOWN], [4th -> DOWN] ---> dequeue

Next destination is decided by the man inside the elevator. There will be a priority queue for this which the priority is decided by the distance from current floor. For example, if there are two people inside the elevator who want to go to 1st and 4th floors respectively and we are on 3rd floor, it is cost effective for the elevator to go to 4th and then come to 1st. A greedy method algorithm would be easy.

enqueue --> [1st] [2nd] [4th] ----> dequeue

So as you see, you now have two queues to get the decision on moving the elevator. If you think deeply, you will identify a better method to fairly operate the elevator. It is possible to reduce energy usage by putting more intelligence to the algorithm. In later stages, you can introduce emergency requests by changing algorithm that does queue prioritising.

We can discuss further.
Post Reply

Return to “Microcontrollers”