Lego Elevator

0 41648 Easy
projectImage

(This article copied from hackster.io,  Author: Ingo Lohs)


Things used in this project

 

Hardware components

Pololu 1135 - Sharp GP2Y0D810Z0F (www.pololu.com #1135) × 1

Arduino UNO & Genuino UNO Arduino UNO & Genuino UNO or equal device × 1

Jumper wires (generic) Jumper wires (generic) × 1

DFRobot DRI0001 - Motor Shield for Arduino × 1


Software apps and online services 

Arduino IDE


Story 

Take boredom, open-mindedness and Lego bricks and mix it with an Arduino device, a Sharp distance sensor (2-10 cm) or alternatively, you can also use an Ultrasonic HC-SR04, as well as an axis of a disused inkjet printer/scanner/All-in-one device.

projectImage

In the Lego housing, both the Arduino is made invisible and the axis of the printer is stabilized in the horizontal.

The axis has to be freed of paint residues from the color cartridges. It is better to put on disposable gloves and think of a pad for your desk. Usually, the axis is used horizontally in the printer: in our project, the baskets now transport the Lego helicopter pilots up from the elevator entrance instead of the color. How?The trigger is triggered by the hand: as soon as the Sharp sensor detects the hand, the "elevator" goes down. If the hand is removed from the sensor, it moves upwards.

Technical pictures from DC Motor, axis, Jumper and Shart Distance Sensor:

projectImage
projectImage
projectImage

Lego figures like Batman, elevator passengers, astonished passers-by and trellis standing escorts:

projectImage
projectImage
projectImage
projectImage

Spend time with children!


Code 

Lego elevator   C/C++  

CODE
int sharpState = 0;

int EN1 = 5;
int IN1 = 4;

void Motor1(int pwm, boolean reverse) {
analogWrite(EN1, pwm); //set pwm control, 0 for stop, and 255 for maximum speed

if (reverse) {
digitalWrite(IN1, HIGH);
}
else {
digitalWrite(IN1, LOW);
}
}

void setup() {
}

void loop() {

  sharpState = digitalRead(3), BIN;
    
    if (sharpState == HIGH) {
    Motor1(240, true); // play around this values to make it slower/faster
  } else {
    Motor1(100, false);
  }
}
License
All Rights
Reserved
licensBg
0