Lift based on Thymio II

The lift (elevator) is a well-known programming exercise. It exists for example in the form of Kidule. This page shows an example of a programmable lift with Thymio II. The lift consists essentially of a motorized cabin which moves up and down, markers along its path to mark the floors and an interface allowing the user to choose a floor as destination.

Here is an example using bookshelves:

ascenseur-global_label.jpg

With the detail of the cabin:

detail-cabine.jpg

Some explanations:
Thymion II is used to perform the vertical cabin movement, to detect the floors and to receive commands from the user.
The cabin is mounted on a vertical guide rail fixed to the shelves. A cord is fixed on top of the guide. The cord is rolled up in the cabin by one of Thymio's two motors.
To detect the floors, markers are placed at suitable height. These markers are white and good reflectors. They can be detected by Thymio's ground sensors. In the following image Thymio II and the white floor marker can be seen:

marquage-etage.jpg

Finally Thymio's buttons can be used to tell it whether to move up or down and by many floors. With the following ASEBA code one only needs to press the up or down arrow buttons the number of times the cabin should pass a floor.

var velocity       # cabin speed
var floor           # number of floors to pass
floor = 0           # initialisation of floor count

# user interface:
onevent buttons    
  when button.forward==1 do  # up
     if velocity == -300 then
         floor = 0
     end
     velocity = 300
     floor = floor + 1          # increment the number of floors
  end

  when button.backward==1 do  # down
      if velocity == 300 then
          floor = 0
      end
      velocity = -300
      floor = floor + 1
  end

  when button.center==1 do  # start
      motor.left.target = velocity
  end

# check for floor:
onevent prox
  when prox.ground.reflected[0] > 100 do     # Here the floor marker is detected. The value of 100 depends on the distance and colour of the marker
      floor = floor - 1
      if floor == 0 then        # we are there
          velocity = 0
          motor.left.target = velocity
      end
  end

This code is very limited. One could add an indication of the floor, initialising the lift at ground level with the rear distance sensors, audio announcement of the floor with a recorded sound (the lift's voice), actuation of the door with the second motor, etc.

Finally a video showing the lift in operation:

Another lift example:

HautThymioAscenseur.jpg
4etagesVertical2.jpg

The Thymio is suspended on a black panel with white strips which simulate the floors.
A cord is fixed to the top of the panel and rolled up with the two Thymio motors.
This allows to have the vertical movement of the Thymio.
The white strips are detected by the bottom sensors of the Thymio.

Press the left button of the Thymio to define the starting position of the lift.
The 'prox.horizontal[2]' sensor detects the ground and sets the lowest floor to 0.
The forward and backward Thymio buttons are used to choose the desired floor number.
Press the centre Thymio button to 'Start', and the lift will stop at the selected floor.
This example works with 4 floors but the number can be increased to a maximum of 7.
The floor is displayed by the leds of 'leds.circle'.
The right button of Thymio can be used to stop at any time.

var vitesse             # cabin speed
var etage =-1         # floors to pass (relative)
var init =0
var positetage=0
var ledetage[8]
var i =0

call leds.circle(31, 0, 0, 0, 0, 0, 0, 0)

# user interface:
onevent buttons 
 when button.right ==1 do
 vitesse=-300
 motor.left.target = vitesse
 motor.right.target =vitesse
end

when button.forward==1 do             # Decrement floor
 if etage>1 then
  etage = etage - 1 #
 end
end
when button.backward==1 do         # Increment floor
 if etage<4 then 
  etage = etage + 1 
 end 
end

when button.left ==1 do             #Stop
 vitesse=0
 init=0
 motor.left.target = vitesse
 motor.right.target =vitesse
end
when button.center==1 and init==1 do     # Start
 if etage > positetage and init==1 then
  vitesse=300 
  motor.left.target = vitesse 
  motor.right.target = vitesse 
end
if etage < positetage and init ==1 then 
 vitesse =-300
 motor.left.target = vitesse 
 motor.right.target = vitesse 
end 
end

# detect floor:
onevent prox
when prox.ground.reflected[0] >600 do
 if etage > positetage and init==1 then
  positetage = positetage + 1
  vitesse=300 
  motor.left.target = vitesse 
  motor.right.target = vitesse 
 end
if etage < positetage and init ==1 then
 positetage = positetage - 1 
 vitesse =-300
 motor.left.target = vitesse 
 motor.right.target = vitesse 
end
if etage==positetage and init==1 then
 vitesse = 0
 motor.left.target = vitesse 
 motor.right.target = vitesse 
end 
#floor display
for i in 0:7 do         #reset display to 0
 ledetage[i]=0 
end
ledetage[positetage]=31
call leds.circle(ledetage[0] , ledetage[1], ledetage[2], ledetage[3], ledetage[4], ledetage[5], ledetage[6], ledetage[7]) 
end 
when prox.horizontal[2] >3900 do #floor = 0
 vitesse=0
 motor.left.target = vitesse
 motor.right.target =vitesse
 etage=0
 positetage=0
 init=1
end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License