Go Down

### Topic: Micro elevator with stepper (Read 1 time)previous topic - next topic

#### copachino

##### Nov 09, 2012, 06:25 pm
HI, im today with a few questions about this project, i got all the mechanics parts, but, the programming its still in blank....

my idea its to use some hall effect sensors, en the "floors" to recognize when a floor its pass, but... this create a big complx in the program, for example, if the elevator its on the 3rd floor, and i want to go to the five(the last), how can arduino recognize in which floor its the elevator???

#### Far-seeker

#1
##### Nov 09, 2012, 07:42 pm
Have a counter that increments or decrements based on both the hall sensor(s) and which direction the motor is running at the time the hall sensor(s) trigger.

#### copachino

#2
##### Nov 09, 2012, 08:42 pm
i can use something like

if stepper +180(180 steps per revolution its equal to 1 floor)

counter_floor++

else
counter_floor

this is in c++....

#### Far-seeker

#3
##### Nov 09, 2012, 09:20 pm
You could, but I presume the elevator also goes down.  So there should be similar code for moving the stepper in the opposite direction.

On the other hand I was thinking of still using hall sensor(s) (you could use one sensor on the elevator or one per floor, depending the available IO pins) to detect the elevator actually passing by a floor.  However, you'd have a couple of flag variables; e.g. one set to "true" when the motor turns clockwise and the other set to "true" when it moves counter clockwise.  Then you have an conditional blocks similar to below...
Code: [Select]
`if (sensorTrigged == true)   {   if (clockwise == true && counterclockwise == false) floorNumber = floorNumber++;  //check both flags to rule out some potential errors   if (clockwise == false && counterclockwise == true) floorNumber = floorNumber--;   }`

#### copachino

#4
##### Nov 09, 2012, 09:54 pm
i believe that should do the job..... im goin to use only one sensor on the elevator, on the floor i will use neodymiun magnets.... i believe that im going to use interrumpts for the sensor....

but the next step, would br to manage several calls, example floor 1, 3 going down..... but maybe this gets too much complex for my level

Go Up