Introduction: Elevetor Model Design and Control Using Arduino

Picture of Elevetor Model Design and Control Using Arduino

did you ever dream of building your own tiny elevator , so you can watch it and think of all the possibilities! just IF you were small enough to fit in there you'd have the world between your hands . you'd be able to travel vertically for almost 30 cm in 6 or 7 seconds MAX!!

back to reality, this is just a model that I built to complete my series "useless stuff you can make with ultrasound sensors". and to utilize some extra MDF pieces that I had in the workshop .

by the way This was made in Fablab Jubail , that's Saudi Arabia , if you were American then please be assured that this instructable doesn't support or sponsor any terrorist group or act , and the knoledge within it doesn't really help them that much with suicidal attacks , so please don't sue me ( link if you didn't get it )

so, using a sensor and a DC motor you can program an Arduino to control an elevator model . in addition to few push buttons of course

we will go through the steps then talk about the code

Step 1: List of Materials

Picture of List of Materials
  • DC motor
  • Arduino motor shield
  • Ultrasound sensor
  • Push button
  • wires
  • MDF
  • Acrylic Sheet

you don't need exactly the same stuff , you can use a stepper motor if you like. and if you got anothe material to make the elevator structure then go for it

the code was written for the Arduino shield , so if you are using something else then make sure to change the code

Step 2: Elevator Model

Picture of Elevator Model

I used a CNC machine to cut an MDF board , then added some acrylic strip to the inside walls to decrease the friction between the moving parts

you can do it using power tools, or even by hand if you were using foam instead of wood

Step 3: Soldering Pushbuttons

Picture of Soldering Pushbuttons

to control the elevator , you need some kind of interface. the easiest is using some buttons

every button have two wires, one of the is connected to your power source ground (cathode or the side with the minus sign ) and the other is connected to one of digital pins of the Arduino ( pins 0 to 13 )

setting the pin mode to INPUT_PULLUP will make it easier , when you push the button , it will connect the pin to the ground . so the pin will read definite Zero . which we will use in our code to trigger the elevator. otherwise when the button is not pressed the pin will be connected to 5 volt through the pull-up resistor . if you didn't get it, don't worry its just some shit electronics nerds do to make sure that the pin is not floating between 5 and 0 for some weird reason

anyhooo , you need to repeat that for each level of the elevator . in the code i'm posting, I used pins 4,5,6

Step 4: Connecting Ultrasound Sensor

Picture of Connecting Ultrasound Sensor

connecting the sensor is straight forward , as shown in the schematic

except i'm using pin 2 for trig and 7 for echo ( you can see 'trig' and 'echo' labeled next to the pins on the sensor itself)

Step 5: Motor Shield

Picture of Motor Shield

you can check this instructable for full details about the shield

I followed the same instruction for DC motor for channel A

Step 6: The Code

Picture of The Code

you can find the code attached , just download it , and open it in arduino IDE

to break it down simple steps, I'll try to explain it below

the first 3 pins is set up as output to the motor shield

pinMode(12, OUTPUT); // Direction
pinMode(3, OUTPUT); // PWM pinMode(9, OUTPUT); // Brake

the next three is for the pushbuttons , defined as pull-up


check the control panel buttons , and assaign the value as a destination floor

if(firstFloor_Button ==0)   
destinationFloor =1; else if (secondFloor_Button == 0) destinationFloor = 2; else if (thirdFloor_Button ==0) destinationFloor = 3;

compare the current floor variable to the destination floor , is it higher, lower or the same

if ( destinationFloor > currentFloor){
digitalWrite(9, LOW); // lose Brake digitalWrite(12, HIGH); // set direction analogWrite(3,180); // set speed }else if ( destinationFloor < currentFloor){
digitalWrite(9, LOW); // lose Brake digitalWrite(12, LOW); // set direction analogWrite(3,180); // set speed } else if ( destinationFloor == currentFloor){ Serial.print("We Arrived"); Serial.println(); digitalWrite(9, HIGH); // Brake analogWrite(3,0); // set speed }

now we move to ultrasound sensor to measure the distance , it uses a simple code , send a sound wave , shutup and listen. finally do you homework and convert the diffrence in time to distance

pinMode(trig, OUTPUT);    // check the distance bettween elevetor and ceiling
digitalWrite(trig, LOW); delayMicroseconds(2); digitalWrite(trig, HIGH); delayMicroseconds(5); digitalWrite(trig, LOW); pinMode(echo, INPUT); duration = pulseIn(echo, HIGH); cm = duration / 29 / 2; // convert time to distance in normal humans units

take the distance from the last part and determine which floor is the elevator in , it a simple if statement with predefined distances , you'll need to change it suit your model since it'll have different proportion

if ( cm < 10 )
currentFloor = 3; else if (25 > cm && cm > 20 ) currentFloor = 2; else if (cm >= 35 ) currentFloor = 1;

Step 7: Conclusion

Picture of Conclusion

well , it's not much. but you got a model that act like an elevator manufactured by ACME

you push the button and it'll move to the corresponding floor

MDF was really heavy for the motor, it barely move , also the friction didn't help so I added acrylic to the inside walls

Good luck and happy dreams


pokilbandi (author)2016-10-04

Do you think we could use this concept for a connected sofa convertible in bed motorised ?

FABLABJubail (author)pokilbandi2016-10-06

First, that's a great idea! , you'll need to work out the mechanical part. but the code would be the same . depending on the weight of the sofa/bed you might need a bigger motor and maybe a relay instead of a motor shield if you were using high voltage motor ..

Modern Rustic Workshop (author)2016-10-01

Pretty cool.

DIY Hacks and How Tos (author)2016-10-01

This is really cool. I can imagine that you could make a sort of automated dumb water to move objects all around large buildings.

About This Instructable



More by FABLABJubail:Sustainable building modelPhotography BoxMake a Birdhouse Using CNC
Add instructable to: