A simple 16 Floor Elevator simulator with Atmega8
In this project, we want to develop hardware/software related to a 16Floor simulator based on an Atmel ATmega8 microcontroller.
1- It has a hand and a face fixture which can be rotated by a stepper motor to indicate the current location of the elevator similar to mechanical indicators which were used in old fashion elevator systems to indicate any current location of cabins.
2- It has a two-digit LED display to indicate the current location of the Elevator Cabin which indicates the same number as the hand and face fixture does.
3- It has 3 Hall Sensors installed at the bottom side of the hand to be activated when the Hour hand when Cabin is located at 1st Floor, Lower than 1st floor (Ed) or Higher than 16th floor (Eu).
4- It has a Cabin door mechanism that can be opened or closed which is controlled by a second stepper motor. The Cabin door can be activated (to be opened or closed) by two 24 VDC input signals respectively.
5- Two Limit Switches are installed to be activated when the Door is either completely opened or closed.
6- There is a Lamp installed inside of the Cabin to be turned on/off when the related signal is activated.
7- The traveling speed of the Cabin is controlled by 4 input signals: F and S input signals represent fast and slow traveling speeds respectively. CW and CCW input signals, on the other hand, represent “clockwise” and “counterclockwise” rotational direction of the Hand. When CW=1, means the Cabin is traveling in an upward direction. On the other hand when CCW = 1, means the Cabin is traveling downward.
8- Two red and green LEDs start flicking with a frequency of 1HZ when the Hand is rotating upward or downward respectively.
9- Control code to generate a pulse anytime cabin clears its location from the previous floor to the next one. The related output signal changes from 0 to 1 for a duration of about 0.5 seconds when the Hand indicator moves from the previous floor number to the next one.
10- Since the simulator hardware is controlling two stepper motors, there should be some way of controlling the angular rotational speed rotation of each stepper motor (the Door and the Hand stepper motors).
11- To control the simulator with a PLC as well, we must design the input/output section of the hardware to function with 0 to 24 VDC. That is why you notice that in Figure 3, the two ends of the two Limit Switches are tied to 24 VDC.
12-To control the speed of two stepper motors, we need to implement some function in the control code to set parameters related to the speed of two stepper motors we have used in this project(1- door stepper motor 2- hand stepper motor). According to Figure 6, we have 4 push buttons to set 3 parameters related to the speed of each stepper motor.
P1 is the parameter that determines the speed of the door stepper motor. P1 is an integer number between 1 to 99 in which 1 is the highest speed.
P2 is the parameter that determines the sped of the “hand” indicator stepper motor. Again P2 is an integer number between 1 to 99 in which 1 is the highest and 99 is the lowest speed respectively.
P3 is the parameter that determines the “angular” rotation of the “hand” indicator stepper motor calculated between two consecutive floor numbers. It is an integer number between 1 to 99.
In our project, I have set these parameters as P1 = 1, P2 = 7 and P3 = 17 degrees.
The meaning of P3 = 17 degrees means every 17 degrees of “angular” rotation between two consecutive floor numbers, microprocessor assumes that “imaginary cabin” has traveled from the previous floor to the next one or vice versa and it is the time to generate “every floor” pulse and to increase (or decrease) the number being displayed on the 2 digit 7-segment.
Figure 1 shows what P3 = 17 degrees between two consecutive floor numbers mean and how P1, P2, P3, and related LEDs are displayed in setting “parameters”.
Setting P1, P2, and P3 parameters
In Figure 6, when PB2 is depressed, control software is placed in the “set” mode of P1 to P3 parameters state, and 7-segment displays P1and two “red” and “green” LEDs are turned on as well. To set the P1 parameter, press P1 again and the system displays the current value of P1 which is an integer number. Now to increase/decrease the P1 value, we can depress either PB1 (+) or PB3 (-) respectively. Every depression of PB1 or PB3 adds or subtracts on a unit to a previous value of P1 current contents. In the end, the depression of PB1 sets P1 to the current number displayed on 7-segment, and now two LEDs are turned off and 7-segment displays the current floor number. The same steps are taken to set P2 and P3. Notice that at step 1, we can change P1 to P2 or P3 simply by depressing PB1 two times and then pressing PB2 again. Obviously, to go from changing P3 to P1 depress, we can PB1 for two times.
Figure 2 shows a rough PCB of the 16-floor simulator with all related I/O terminals.
To raise the output port signal voltage of our microcontroller to 24 VDC we can use an optocoupler IC as shown in Figure 3.2.
Figure 4 shows a schematic related to biasing three UGN3144 Hall effect sensors. Since pin# 3 output of a UGN3144 is “high” in normal or UN-activated condition, I used a 7404 IC to change that “high” output signal level to “0” which makes more sense for me to understand. In this case, any time a “1” signal is detected from any of 3 related input ports; it will mean that a small piece of a magnetic bar that is glued on the “hand” is located on the top of any related sensor. These 3 Hall Effects are glued to the bottom side of “hand” and the 3 related outputs of the 7404 IC are wired to related terminals located on the main PCB.
The table shown in Figure 5 displays summarized project “bill of material”. Figure 6 displays the component side of the controller PCB where all ICs, terminals (etc) are soldered.
Figure 7 shows how wires from 2 stepper motors, 3 Hall sensors, 2 digits LED display PCB, Cabin lamp, and 2 limit switches are connected to the related 4, 3, and 2 pin screw terminals. Finally, P5 is a 2×10 pin header which is used to connect and direct all power and input/output signal wires to the panel installed outside of the controller main PCB.
Notes: A Hall effect sensor is a transducer that varies its output voltage in response to a magnetic field. Hall effect sensors are used for proximity switching, positioning, speed detection, and current sensing applications. In its simplest form, the sensor operates as an analog transducer, directly returning a voltage.
You can view the prototype version of this project in action by clicking here
To download files related to control code, PCB layout, and simulation software, click on the following link:
Click here to download files generated for this project