Project in progress
LOL Surprise Doll Hotel Elevator controled by mobile phone

LOL Surprise Doll Hotel Elevator controled by mobile phone © LGPL

My daughter made three floor hotel for LOL dolls, but wasn’t satisfied with manual elevator. So I automated it.

  • 1,058 views
  • 0 comments
  • 10 respects

Components and supplies

Apps and online services

About this project

My daughters and I decided to automate an elevator on their's LOL surprise dolls three floor hotel which we made few months ago. Shortly after, they realized that manual elevator is not so attractive. I found out that might be great oportunity for my first experiences with Arduino writing code, not just reusage of other's.

Main part is NEMA 17 stepper motor. Since we can control motor position, I did not implement any sensor which in real elevators detect position. Here, elevator position will be defined with stepper position.

There are three push buttons and three LEDs on each floor. By pressing the push button you are calling elevator, and when elevator reaches targeted floor, LED will turn on. During elevator moving, LEDs are OFF.

After assembly all parts, be careful when starting test for first time. Make sure that initial positions for 2nd and 3rd flor are underestimated, i.e. lower that it might be. I had a starting test in program that makes one revolution clockwise and one counter clockwise, just to check the initialization, and see how much this moves the elevator. Then you can multiply it and estimate postitions for 2nd and 3rd floor in few iterations.

So far at the turn on, position is initialized to zero, so when you turn off the system, it must be on first flor. I'm looking to solve this in next upgrade.

Shortly after we made first version, which worked only with push buttons, my dauthers wandered why we do not support control by mobile phone :)

There was option using wi-fi or bluetooth. I decided to use bluetooth, since the toys will not be limited with wifi router. I used HC-05 bluetooth contoler. It needs only power 5V, GND, and serial TxD and RxD.

So far I did not develop any of mobile application, but I found very simple online tool for Android applications, MIT app inventor on http://ai2.appinventor.mit.edu/. You can donwnload my application on http://ai2.appinventor.mit.edu/b/bmgw , and if you want to build it by yourself, here is a screenshot of design and block screen. At design screen you set and configure blocks, and in block screen you connect blocks and configure actions.

I just created three buttons, where on click each one is sennding text 1, 2 or 3, depending of which flor should be called.

Another improvement I made, was blinking LED on flor where elevator will stop. My initial plan was just to make a function for blinking LED which is called in function GotoFlorX. But, this is not possible since Arduino does not support multi threads. So I added blinking LED part within For loop which is sending pulses to stepper motor. In fact I turn LED on/off every n/7 steps, where n is number of steps that that stepper motor need to run. It is a bit more complicated, but final efect is OK. If anyone has better idea, please let me know!

Code

sketch_nov16b.inoArduino
#include <SoftwareSerial.h>

// define pin input and outputs
#define buttonFlor1 2
#define buttonFlor2 3
#define buttonFlor3 4
#define LEDFlor1 5
#define LEDFlor2 6
#define LEDFlor3 7
#define dirPin 8
#define stepPin 9
#define TxD 10
#define RxD 11
#define stepsPerRevolution 200
#define speed 2000 // in fact us delay between stepper pulses, higher number, slower speed
int position = 0; //current position of elevator
int newPosition = 0;
int positionFlor1 = 0;
int positionFlor2 = 860;
int positionFlor3 = 1720;
int z; 

SoftwareSerial bluetoothSerial(TxD, RxD);
char c;

void setup() {
  // put your setup code here, to run once:
pinMode (buttonFlor1, INPUT);
pinMode (buttonFlor2, INPUT);
pinMode (buttonFlor3, INPUT);
pinMode (LEDFlor1, OUTPUT);
pinMode (LEDFlor2, OUTPUT);
pinMode (LEDFlor3, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);

bluetoothSerial.begin(9600);
Serial.begin(9600);


// Testing LEDs - turn on/off leds 1,2,3
 digitalWrite(LEDFlor1, HIGH);
    delay(1000);
    digitalWrite(LEDFlor1, LOW);
digitalWrite(LEDFlor2, HIGH);
    delay(1000);
    digitalWrite(LEDFlor2, LOW);
digitalWrite(LEDFlor3, HIGH);
    delay(1000);
    digitalWrite(LEDFlor3, LOW);

// Testing steppeer motor - one circle clockwise, one circle counterlockwise
  digitalWrite(dirPin, LOW);
  for (int i = 0; i < stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);
  }
  
  digitalWrite(dirPin, HIGH);
  for (int i = 0; i < stepsPerRevolution; i++) {
    // These four lines result in 1 step:
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);
    }
// set zero position
position = 0;
digitalWrite(LEDFlor1, HIGH);
}

int GoToFlor1(int position, int positionFlor1) {
  //Turn off all LEDs
   digitalWrite(LEDFlor1, LOW);
   digitalWrite(LEDFlor2, LOW);
   digitalWrite(LEDFlor3, LOW);
   
  if (position < positionFlor1) {
  digitalWrite(dirPin, LOW); //define direction CV
     for (int i = position; i < positionFlor1; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);
    }
  }
  
  else    {
  digitalWrite(dirPin, HIGH); //define direction CCV
  z=(position-positionFlor1)/7;
  
     for (int i = positionFlor1; i < position; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);

 if (i>(positionFlor1+z)){
     digitalWrite(LEDFlor1, HIGH); 
    }
     if (i>(positionFlor1+(2*z))){
     digitalWrite(LEDFlor1, LOW); 
    }
      if (i>(positionFlor1+(3*z))){
     digitalWrite(LEDFlor1, HIGH); 
    }
       if (i>(positionFlor1+(4*z))){
     digitalWrite(LEDFlor1, LOW); 
    }
       if (i>(positionFlor1+(5*z))){
     digitalWrite(LEDFlor1, HIGH); 
    }       
      if (i>(positionFlor1+(6*z))){
     digitalWrite(LEDFlor1, LOW); 
    }



    
    }
  }
 
 //Turn on LEDFlor1
 digitalWrite(LEDFlor1, HIGH);

// Set new position
return positionFlor1;

}


int GoToFlor2(int position, int positionFlor2) {
  //Turn off all LEDs
   digitalWrite(LEDFlor1, LOW);
   digitalWrite(LEDFlor2, LOW);
   digitalWrite(LEDFlor3, LOW);
  
    
  if (position < positionFlor2) {
  z=(positionFlor2-position)/7;
  digitalWrite(dirPin, LOW); //define direction CV
     for (int i = position; i < positionFlor2; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);

    if (i>z){
     digitalWrite(LEDFlor2, HIGH); 
    }
     if (i>2*z){
     digitalWrite(LEDFlor2, LOW); 
    }
      if (i>3*z){
     digitalWrite(LEDFlor2, HIGH); 
    }
       if (i>4*z){
     digitalWrite(LEDFlor2, LOW); 
    }
       if (i>5*z){
     digitalWrite(LEDFlor2, HIGH); 
    }       
      if (i>6*z){
     digitalWrite(LEDFlor2, LOW); 
    }
   
    }
  }
  
  else    {
  digitalWrite(dirPin, HIGH); //define direction CCV
     z=(position-positionFlor2)/7;
     
     for (int i = positionFlor2; i < position; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);
    
    if (i>(positionFlor2+z)){
     digitalWrite(LEDFlor2, HIGH); 
    }
     if (i>(positionFlor2+(2*z))){
     digitalWrite(LEDFlor2, LOW); 
    }
      if (i>(positionFlor2+(3*z))){
     digitalWrite(LEDFlor2, HIGH); 
    }
       if (i>(positionFlor2+(4*z))){
     digitalWrite(LEDFlor2, LOW); 
    }
       if (i>(positionFlor2+(5*z))){
     digitalWrite(LEDFlor2, HIGH); 
    }       
      if (i>(positionFlor2+(6*z))){
     digitalWrite(LEDFlor2, LOW); 
    }
    
    }
  }
 
 //Turn on LEDFlor2
 digitalWrite(LEDFlor2, HIGH);
 

// Set new position
return positionFlor2;

}

int GoToFlor3(int position, int positionFlor3) {
  //Turn off all LEDs
   digitalWrite(LEDFlor1, LOW);
   digitalWrite(LEDFlor2, LOW);
   digitalWrite(LEDFlor3, LOW);
   
  if (position < positionFlor3) {
  
   z=(positionFlor3-position)/7;
  

   
  digitalWrite(dirPin, LOW); //define direction CV
     for (int i = position; i < positionFlor3; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);

  if (i>(position+z)){
     digitalWrite(LEDFlor3, HIGH); 
    }
     if (i>(position+(2*z))){
     digitalWrite(LEDFlor3, LOW); 
    }
      if (i>(position+(3*z))){
     digitalWrite(LEDFlor3, HIGH); 
    }
       if (i>(position+(4*z))){
     digitalWrite(LEDFlor3, LOW); 
    }
       if (i>(position+(5*z))){
     digitalWrite(LEDFlor3, HIGH); 
    }       
      if (i>(position+(6*z))){
     digitalWrite(LEDFlor3, LOW); 
    }

   
    }
  }
  
  else    {
  digitalWrite(dirPin, HIGH); //define direction CCV
     for (int i = positionFlor3; i < position; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(speed);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(speed);
    }
  }
 
 //Turn on LEDFlor3
 digitalWrite(LEDFlor3, HIGH);
 

// Set new position
return positionFlor3;

}

void loop() {
  // Check calls for elevator
int CallFlor1 = digitalRead(buttonFlor1);
int CallFlor2 = digitalRead(buttonFlor2);
int CallFlor3 = digitalRead(buttonFlor3);

  if (bluetoothSerial.available()){
    c = bluetoothSerial.read();
    if (c == '1'){
      newPosition = GoToFlor1(position, positionFlor1);
      position = newPosition;
    }
    if (c == '2'){
      newPosition = GoToFlor2(position, positionFlor2);
      position = newPosition;
    }
    if (c == '3'){
      newPosition = GoToFlor3(position, positionFlor3);
      position = newPosition;
    }
    
  }


  if (CallFlor1 == HIGH) {
  newPosition = GoToFlor1(position, positionFlor1);
  position = newPosition;
  }

    if (CallFlor2 == HIGH) {
  newPosition = GoToFlor2(position, positionFlor2);
  position = newPosition;
  }

    if (CallFlor3 == HIGH) {
  newPosition = GoToFlor3(position, positionFlor3);
  position = newPosition;
  }
}

Schematics

shema_elevator-edit2_wKOwas79d5.png
Shema elevator edit2 wkowas79d5

Comments

Similar projects you might like

RCar | Robots for All!

Project tutorial by Luís Rita

  • 7,706 views
  • 1 comment
  • 39 respects

Kid's Majestic Streamer Fan Light Button Box

Project in progress by Team Max 35

  • 1,736 views
  • 0 comments
  • 0 respects

Bluetooth Mini Car

Project showcase by Hesham

  • 11,038 views
  • 4 comments
  • 35 respects

LCD Game

Project showcase by Team Iron_SalsaStudio

  • 12,874 views
  • 11 comments
  • 21 respects

Robotic Car Controlled over Bluetooth by Andriod Phone

Project showcase by S.Ranjith Reddy

  • 7,348 views
  • 1 comment
  • 15 respects
Add projectSign up / Login