Go Down

Topic: Lift with Arduino (Read 1 time) previous topic - next topic

JimboZA

Quote
it's hard to translate that in programming.


That's exactly the point Peter is making, and is why he's encouraging you to get the procedure clear in your head before you go anywhere near the IDE to start writing the program. Design first, construct second...
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Neorobot

#6
May 03, 2013, 09:45 am Last Edit: May 03, 2013, 09:46 am by Neorobot Reason: 1
Thank you for you answer!

So I would think like that:

1) Initialisation at the Start of the arduino (Lift at level 0) (make the motor turning down while the lift is not at floor 0)
2)  Waiting a call
- if just one call -> go to the correct floor
- if there is another call -> verify if this guy want to go up or go down
- if one guy is inside the lift and going in one direction (up for example) and that someone call the lift to go in the same direction, so the lift will stop to take this guy.

if one guy is inside the lift and going in one direction but that a guy is calling the lift to go down, so the guy inside has the priority.

Henry_Best


Hi, i have an idea on how it will work but it's hard to translate that in programming.

So, when I turn on the arduino, i would like a kind of Initialisation. So the lift verify that it's in the bottom of the structure (floor 0 ).


What if it's not at floor 0 when you turn it on?

Quote

And, from that "point", it's waiting for a call. For example, the lift is at level 0, it's called at floor 2, it speeds up, and when it arrives at level 1,5 it speeds down and stops at floor 2.

now, i imagine that the lift is moving, i have absolutely no idea how i can "rember" a push on a button WHILE the motor is turning.


Set the motor running
Start checking
Check the buttons and position switches (save the results in variables)
Has lift reached the point where it needs to slow down?
If it hasn't, go to start checking
If it has, slow the motor.
Has lift reached the floor?
If it hasn't, go to start checking
If it has, stop the motor, open the doors
Now see what buttons have been pressed and act on those.

Quote

EDIT: I also have to respect the priority. If the guy at floor 1 want to go at Floor 3 and that a guy in floor 2 also want  to go to floor 3, so the lift has to stop at floor 2 before going to 3. So I suppose I will have a VAR for the direction of travel :)


And one for each position switch and one for each push button and one for each set of doors (to know whether they are open or shut).

Other things to think about are, if the lift is on, say, level 3, is empty and no buttons have been pressed, does it stay there or does it return to level 0? Do the doors stay open or do they close when the lift is inactive?

Neorobot

Hi Henry,

Quote
What if it's not at floor 0 when you turn it on?


When the arduino is powered on, if the lift is already at floor 0, it doesn't move and if it's not at floor 0, the motor will turn while it's not at floor 0 (detected with a magnetic sensor).

Quote
And one for each position switch and one for each push button and one for each set of doors (to know whether they are open or shut).


I will receive the "state" of the doors in I2C, so il will receive a number from my PCF8574, translate that in binary and i will know the doors that are opened (0), closed(1), Unlocked(0), Locked(1)

Quote
Other things to think about are, if the lift is on, say, level 3, is empty and no buttons have been pressed, does it stay there or does it return to level 0? Do the doors stay open or do they close when the lift is inactive?


In a first time, i would like the lift to stay at the level where it stopped (no return if empty) :)

A thing that i dont understand is how, for exemple, to make tho motor speed down while I check the button.
because you wrote that like "steps" but how to do that in the same time? How can i decrease the speed (PWM) in a loop WHILE I check the buttons?


thank you very much ;)


AWOL

Quote
How can i decrease the speed (PWM) in a loop WHILE I check the buttons?

Have a look at the blink without delay example in the IDE for clues.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up