# Elevator Project

**URL:** <https://forum.arduino.cc/t/elevator-project/1307640>\
**Category:** General Guidance\
**Created:** [October 3, 2024, 12:41pm UTC](https://forum.arduino.cc/t/elevator-project/1307640 "2024-10-03T12:41:54Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![arduinoelevator](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/arduinoelevator/32/1098883_2.png) [@arduinoelevator](https://forum.arduino.cc/u/arduinoelevator)\
**Post date:** [October 3, 2024, 12:41pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/1 "2024-10-03T12:41:54Z")

</div>

Hello everyone, im currently in the middle of a project. We have to make an intelligent elevator with two cab that will choose respond in a intelligent way.

So far we've done this : the elevator's structure, with two cabs, 10 leds for each column. 10 call buttons for each cabs and 10 buttons for outside of the cabs. We have programmed the elevator but so far it can only respond to one call at a time, i dont know how to store multiple call and then having the elevator to answer them (once this is done i will try do research intelligent algorithm)

---

<div class="post-metadata">

**Author:** ![Dave\_Lowther](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dave_lowther/32/1092885_2.png) [@Dave\_Lowther](https://forum.arduino.cc/u/Dave_Lowther)\
**Post date:** [October 3, 2024, 1:02pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/2 "2024-10-03T13:02:55Z")

</div>

> [@arduinoelevator](#):
>
> i dont know how to store multiple call

You could store 10 "button has been pressed" states in a bool array with 10 elements. Maybe you would have 4 arrays, one for each of: cab 1 internal buttons, cab 2 internal buttons, cab 1 external buttons, cab 2 external buttons.

> [@](#):
>
> and then having the elevator to answer them

After answering one call, look through the appropriate arrays and pick the next one to answer.

> [@](#):
>
> once this is done i will try do research intelligent algorithm

That will determine which call to pick to answer next when you are looking through the arrays

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [October 3, 2024, 1:40pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/3 "2024-10-03T13:40:02Z")

</div>

Will it be up collective or down collective at specific times of day? Will it have express mode again at different times of the day. If simulation is for very tall buildings, sometimes a return to middle mode is used.  
Of course 50% or more of the circuitry is devoted to safety for a real elevator.

---

<div class="post-metadata">

**Author:** ![robtillaart](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robtillaart/32/1098811_2.png) [@robtillaart](https://forum.arduino.cc/u/robtillaart)\
**Post date:** [October 3, 2024, 2:04pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/4 "2024-10-03T14:04:26Z")

</div>

For a minimalistic version you need to use an array of boolean to hold the information if for a certain level a button is pressed.

```arduino
bool buttonPressed[10];

```

initially these are to be set to false. If a button is pressed you make it true.  
Then you only need to go through that array to see where to go.  
The trick is to handle them all.

* * *

In an alternative version you use an array of timestamps.

```arduino
uint32_t buttonPressed[10];

```

default set to zero, and if a button is pressed you check if there is a timestamp set for that level, if not set it to the current millis.

Then you search for the level with the oldest timestamp and go to it.  
When arriving at that level reset the array element to zero again.

This way it is sure you handle all request.  
Still there are ways to optimize this strategy.

(best way to learn is to ride an actual lift and see how it behaves in detail,

---

<div class="post-metadata">

**Author:** ![robtillaart](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robtillaart/32/1098811_2.png) [@robtillaart](https://forum.arduino.cc/u/robtillaart)\
**Post date:** [October 3, 2024, 2:07pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/5 "2024-10-03T14:07:00Z")

</div>

> [@sonofcy](#):
>
> Of course 50% or more of the circuitry is devoted to safety for a real elevator.

Think more, especially if you include the mandatory mechanical safety mechanisms.

> **[High-Rise Safety Systems](https://www.otis.com/en/us/tools-resources/high-rise-safety-systems)**
>
> Safety systems in a modern high-rise elevator

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [October 3, 2024, 2:12pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/6 "2024-10-03T14:12:04Z")

</div>

I know, I was trying to not scare him off.  
If it isn't obvious a spent a short time in the elevator business, my friend did maintenance work and I often accompanied him. Lots of stories from standing on top of the cars and listening and occasionally seeing what folks get up to inside.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [October 3, 2024, 2:22pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/7 "2024-10-03T14:22:16Z")

</div>

I suspect what their teacher was doing was using a (poor) example of one arduino controlling multiple 'things'. The choice of an elevator was poor in that in real life the vast majority of the electro-mechanical system is devoted to human safety.  
A full simulation of the entire system would be a good graduate project especially since modern elevators use MCUs and MPUs. Becomes a bit meta real quick.

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [October 4, 2024, 3:33am UTC](https://forum.arduino.cc/t/elevator-project/1307640/8 "2024-10-04T03:33:36Z")

</div>

The elevator projects on The Forum that made it to the build stage were involved. Multi-floor, multi-call, arrival light/bell, door open, floor choice, door close, going-up/down indicator, stepper motors, servos, LEDs, OLEDs, buzzers, buttons. I can't find any that went beyond an idea with the search tool, but they exist (or exist **ed** if this is the age of purging at two years dormancy).

Most die on the vine.

> [@sonofcy](#):
>
> Becomes a bit meta real quick.

Is this English?

I think @DaveX did a wokwi sim of multi-function elevator.

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [October 4, 2024, 3:40am UTC](https://forum.arduino.cc/t/elevator-project/1307640/9 "2024-10-04T03:40:00Z")

</div>

> [@arduinoelevator](#):
>
> We have programmed the elevator but so far it can only respond to one call at a time,

Hello [arduinoelevator](https://forum.arduino.cc/u/arduinoelevator)

Welcome to the best Arduino forum ever 🙂

Post the current sketch and schematic to see how we can help.

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [October 4, 2024, 5:51am UTC](https://forum.arduino.cc/t/elevator-project/1307640/10 "2024-10-04T05:51:17Z")

</div>

> [@xfpd](#):
>
> I think @DaveX did a wokwi sim of multi-function elevator.

I don't think it was me & don't see mention of elevator in my Wokwi stuff. ISTR doing something like that that back in the 80s in a controls lab with a PLC.

Maybe you're thinking of:

> [@Problem with buttons on simple 3 story elevator](https://forum.arduino.cc/t/problem-with-buttons-on-simple-3-story-elevator/1159706/7):
>
> Hello @jordanangelo - I put @paulpaulson edit of your sketch into a simulation that you can freely experiment with. The BUTTONs are the floors calling. The LEDs are the indication of IN1 and IN2 (motors) being called.

(...with a broken link.)

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [October 4, 2024, 6:13am UTC](https://forum.arduino.cc/t/elevator-project/1307640/11 "2024-10-04T06:13:56Z")

</div>

Ooh. Maybe @alto777 had the WS2812 elevator sim?

---

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [October 4, 2024, 12:43pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/12 "2024-10-04T12:43:10Z")

</div>

Not me. Good thing too, because if it were, it would mean looking for the thing amongst the trash pile of wokwi simulations I have created or modified for these fora. I try to throw them away, but have been lazy, as well as reluctant to throw away something that's been linked here. Which is why I also try to post at least the code.

I do tanks and pumps as well as heating and cooling, neither perhaps conceptually that good as an analog elevator.

@arduinoelevator - usually there is an "up" button and a "down" button on each floor. This would be useful information when planning optimal operations.

a7

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [October 4, 2024, 2:33pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/13 "2024-10-04T14:33:33Z")

</div>

> [@arduinoelevator](#):
>
> We have programmed the elevator but so far it can only respond to one call at a time, i dont know how to store multiple call

@alto777’s suggestion makes this easier. Just storing the button-called state for each up and down button automatically stores that information for you. The lights on the elevator buttons are all there for more than informing the users that the elevator is on the way—they are integral to the planning: If you are going down and reach a floor with a lit down button, stop and service it.

> [@arduinoelevator](#):
>
> (once this is done i will try do research intelligent algorithm)

You need to plan ahead for adaptability (state machines, non-blocking, millis() not delay), because adding in intelligence to a some bare minimum code will be difficult.

Show your code. Or read these and start fresh:

> [@Best first 5 topics to read to reach Trust Level 1?](https://forum.arduino.cc/t/best-first-5-topics-to-read-to-reach-trust-level-1/1287592/1):
>
> - [Planning and Implementing an Arduino Program](https://forum.arduino.cc/t/planning-and-implementing-an-arduino-program/252364/2) by @Robin2-- A great way to plan your program to be flexible, easy to read, understand, maintain, and extend. ( Live Sim: [Lesson A](https://wokwi.com/projects/407398005837428737) ... [Lesson G](https://wokwi.com/projects/407397568486835201) )
> - [Demonstration code for several things at the same time](https://forum.arduino.cc/t/demonstration-code-for-several-things-at-the-same-time/217158) by @Robin2-- An example running a couple blinking LEDS, a button and two servos, all independently. ([Live Simulation](https://wokwi.com/projects/366664987128970241))
> - (Off-site: [Adafruit: Multiasking the Arduino Part 1](https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview), [Part 2](https://learn.adafruit.com/multi-tasking-the-arduino-part-2/overview))

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [October 4, 2024, 3:10pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/14 "2024-10-04T15:10:21Z")

</div>

> [@alto777](#):
>
> trash pile of wokwi

I have been using wokwi without logging-on to keep my account "clean" (ahahhhaha!). Wokwi allows me to store in-work sims with a URL and title when I am NOT logged-in. I can access the sim with the URL, but I can't edit the sim once I exit wokwi, and there is no "dashboard/projects". With these temporary sims, I post the sketch.ino and diagram.json on the forum using the **\<details\>** markup. For example, this is a "new" minimal sketch/sim that I now can not edit because my cookies are cleared when I exit my browser, but there is no author: [minimal - Wokwi ESP32, STM32, Arduino Simulator](https://wokwi.com/projects/410827224402595841)

Warning: logging-off wokwi makes you log-in using email... so if you can not access your email, you are locked out of your wokwi account.

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [October 4, 2024, 3:17pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/15 "2024-10-04T15:17:11Z")

</div>

Hello Ladies and Gents

I would think of two data structures with member functions.  
One structured array for the abstraction of a floor and a second for the cabin.

The following member functions are conceivable:

- LED - on/of/blink
- Button - read & debounce
- MotorControl - stop/up/down
- etc...

---

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [October 4, 2024, 3:43pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/16 "2024-10-04T15:43:10Z")

</div>

I see. Something like:

> [@4leds 4 buttons](https://forum.arduino.cc/t/4leds-4-buttons/1240125/8):
>
> Hello [shirogig](https://forum.arduino.cc/u/shirogig) Welcome to the world's best Arduino forum ever. Do you have experience with programming in CPP? My recommendation is to use a structured array. This structured array contains all information about the pins and a service to debounce the pins and a service to detect state changes. The results of the state change detection can be further processed for a blinking task. Consider: //https://forum.arduino.cc/t/4leds-4-buttons/1240125 //https://europe1.discourse-cdn.com/arduino/ori…

and

> **[4Led4Button\_Paulson - Wokwi ESP32, STM32, Arduino Simulator](https://wokwi.com/projects/405862678942568449)**
>
> Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!

A 10 floor, 2 car elevator with the normal set of lights and buttons is a lot of IO: at least 40 leds+40 buttons, and that's before touching doors and motors.

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [October 4, 2024, 3:58pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/17 "2024-10-04T15:58:11Z")

</div>

Solved:  
 ![](https://europe1.discourse-cdn.com/arduino/original/4X/c/8/d/c8de74ca59f917cd4729ad89d4a8326ab58fb76c.gif)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [April 2, 2025, 3:58pm UTC](https://forum.arduino.cc/t/elevator-project/1307640/18 "2025-04-02T15:58:27Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
