Pages: [1] 2   Go Down
Author Topic: Lift with Arduino  (Read 1487 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!
It's my first message here so, hello everybondy smiley

I have a school project: A 4 floors Lift.

I would like to know how could i store all the differents calls, make the motor turn and receive all the data from my sensors IN THE SAME TIME smiley

I have 7 Magnetics sensors: 1 per floor, and 1 between 2 floors to slow the hoist.

Could you help me? Thank you smiley
« Last Edit: May 12, 2013, 06:21:05 am by Neorobot » Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Once you understand the control algorithm you want to use, you can think about implementing that in code. But you need to understand the algorithm first.

Imagine that you are a lift operator. Each sensor you listed operates an indicator lamp that you can see - you have switches to make the lift go up or down and open/close the doors. Also assume that your short term memory is useless - you have to write everything down to remember it. How would you go about operating the lift?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi PeterH,

thank you for your answer.

So about my lift:

- 4 floors
- 7 magnetics sensors (4 to stop the lift when arrived to the floor and 3 between to slow it before the stop)
- 4 contacts switches to verify if the doors are closed
- 4 contact switches to verify that the Lock is activated
- 10 buttons to call the lift (1 at level 1 (you can just go up) + 1 at level 4 (you can just go down) + 2 buttons at level 2 + 2 button at level 3 + 4 button inside the hoist

I don't understand what you mean with "Also assume that your short term memory is useless".
I would like to store if someone call the lift when the lift is already in use.

Thank you smiley
« Last Edit: May 12, 2013, 06:22:21 am by Neorobot » Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand what you mean with "Also assume that your short term memory is useless".
I would like to store if someone call the lift if te lift is already in use.

I want you to write down the things you would need to remember in order to operate the lift, to force you to think about what things you need to remember. These will eventually become variables in your sketch.

For example, if somebody pushes a 'call' button and then releases it, you probably want to remember that it has been pressed, because their need for a lift doesn't stop when they let go of the button.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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.

thank you smiley


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 smiley

A little pic of the structure smiley

« Last Edit: May 12, 2013, 06:25:01 am by Neorobot » Logged

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 103
Posts: 4631
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: May 03, 2013, 02:46:48 am by Neorobot » Logged

London
Offline Offline
Edison Member
*
Karma: 48
Posts: 1462
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) smiley

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 smiley-wink

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26465
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For the blink without delay, a decrement is used.  So if I'm right, I have to decrement the speed of the motor at each cycle of the main loop and not create a special decrement loop ?
« Last Edit: May 04, 2013, 04:27:26 am by Neorobot » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26465
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have to decrement the speed of the motor at each cycle of the main loop
No, because you don't know how long the main loop takes to execute.
You need to decrease the speed of the motor at known intervals.

Quote
For the blink without delay, a decrement is used.
It is?
« Last Edit: May 04, 2013, 06:08:04 am by AWOL » Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have misunderstand ! It's ok now, and actually there's no decrement in that part of code.

Could you just give me more details about saving all the "calls", do I have to use an array?

thanks for your help!
 
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26465
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd probably forget the calls for now, and concentrate on moving the car between any floor, without using delay.
But yes, arrays will be useful.
Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I will start with that for the moment and I think you'll see me again soon smiley-grin

Thank you!
Logged

Pages: [1] 2   Go Up
Jump to: