How to build a crane?

Crane

Crane

Facts about cranes:

A crane is a type of machine, generally equipped with ropes, that can be used both to lift and lower materials and to move them horizontally. It is mainly used for lifting heavy things and transporting them to other places that otherwise are difficult to reach.

Today we are going to build a simple crane that can be controlled remotely by two dimmers. A Dimmer is technically a potentiometer with variable resistance. The first dimmer will control the height of the load and the second dimmer will control the directional movement of the load.

When we turn the dimmer from far left to far right it will change the dimmers’ value from 0 to 1024.

So, we divide the range into three parts
   [0 342],   [343 682]    and    [683 1024] 
and assigning the action of moving [left], [stop] and moving [right] to the above value ranges, i.e. when the values from the first dimmer is less than 342, the crane moves backwards and when the value of the first dimmer goes beyond 683, the crane moves forwards and stops for any value that lies in between. Likewise, when the reading from the second dimmer is less than 342, the crane moves upwards. When the reading is larger than 683, it moves downwards, and for any value that lies in between, the crane stops.

We could build and code the crane with the above logic by following five easy steps below.

Facts about cranes:

A crane is a type of machine, generally equipped with ropes, that can be used both to lift and lower materials and to move them horizontally. It is mainly used for lifting heavy things and transporting them to other places that otherwise are difficult to reach.

Today we are going to build a simple crane that can be controlled remotely by two dimmers. A Dimmer is technically a potentiometer with variable resistance. The first dimmer will control the height of the load and the second dimmer will control the directional movement of the load.

When we turn the dimmer from far left to far right it will change the dimmers’ value from 0 to 1024.

So, we divide the range into three parts
   [0 342],   [343 682]    and    [683 1024] 
and assigning the action of moving [left], [stop] and moving [right] to the above value ranges, i.e. when the values from the first dimmer is less than 342, the crane moves backwards and when the value of the first dimmer goes beyond 683, the crane moves forwards and stops for any value that lies in between. Likewise, when the reading from the second dimmer is less than 342, the crane moves upwards. When the reading is larger than 683, it moves downwards, and for any value that lies in between, the crane stops.

We could build and code the crane with the above logic by following five easy steps below.

Step 1. Technical knowledge: (review from previous lesson No. 6)

Get to know your servo motor. 360° servo motor vs 180°servo motor;

One of the major components we needed to build a crane is an engine, in our case a 360° servo motor. There are two types of servo motors, a 180° servo motor and a 360° server motor. A 180 ° servo motor is a geared motor that can be controlled precisely to a specific position within a range of 0° to 180 ° and can maintain a particular position until it is instructed to move to another position. On the other hand, a 360° server motor can rotate continuously but not stay in a particular angle, but we can control the speed instead.

Both types of servo motors are controlled by electrical pulses. Those pulses are signals that will turn on and off very quickly. Typically, a servo motor needs to get 50 signals per second (50Hz) or 1 signal every 0.2 seconds (20 milliseconds) respectively, whereby the signal length (pulse) itself is only between 1 to 2 milliseconds long. The length of this signal determines the turning degree or speed of the servo motor. The technical term for this method is Pulse Width Modulation (PWM).

Both 360° servo and the 180° servo are identical in size an look, but there is an opening for accessing the fine-tuning screw underneath the 360° servo motor. This fine-tuning screw is used when the motor does not stop completely at the stop command or 90-degree command. Turning it a little bit to the left or right would stop the motor completely.

Step 2. PWM with micro:bit:

In order to send “Pulses” to the servo motor using the micro:bit, we could go to the “Pins” tab under the “Advanced” tab or use the servo blocks under the “MuseRobotic” tab. If you cannot find the “MuseRobotic” tab, you could install the tab following the instruction in step 2  from following link: https://muselab.cc/2018/03/15/how-to-connect-microbit-to-the-internet/

This command block is mainly used for 180° servos.

Alternatively we can also use:

We can find servo command blocks for both 180° and 360° servo motor.

Note: In order to maximize the functionality of your Muselab micro:bit Booster, it should be initialized as follow:

Step 3. Build the crane.

Below we are using the Muse Crane of the Muse Mechanical Set I (3in1)

  • Step 01

    Step 01

  • Step 02

    Step 02

  • Step 03

    Step 03

  • Step 04

    Step 04

  • Step 05 (a)

    Step 05 (a)

  • Step 05 (b)

    Step 05 (b)

  • Step 06

    Step 06

  • Step 07

    Step 07

  • Step 08

    Step 08

  • Step 09

    Step 09

  • Step 10

    Step 10

  • Step 11

    Step 11

  • Step 12

    Step 12

  • Step 13

    Step 13

  • Step 14

    Step 14

  • Step 15

    Step 15

  • Step 16

    Step 16

  • Step 17

    Step 17

  • Step 18

    Step 18

  • Step 19

    Step 19

  • Step 20

    Step 20

  • Step 21

    Step 21

  • Step 22

    Step 22

  • Step 23

    Step 23

  • Step 24

    Step 24

  • Step 25

    Step 25

  • Step 26

    Step 26

Step 3. Build the remote control

Step 1

Step 1

Step 2

Step 2

Step 3

Step 3

Step 4

Step 4

Step 5

Step 5

Step 6

Step 6

Step 5. Write the code!

For this code example we are using the fastest and easiest way. Please connect your dimmer and servo motors as shown below:

Dimmer 1  P0, Servo 1  P1, Dimmer 2  P2 & Servo 21  P12.
Please note that P12 is output only, for why you must attach one of the servo motors to it, because it is not able to read the value from your dimmer!

Code to control servo 1:

 

Code to control servo 2:

By now, you should be already quite familiar with the micro:bit PXT editor. Your challenge now is to find the correct blocks in the sidebar , to reconstruct the code. (HINT: Have a closer look on the colours of the blocks shown in the pictures!)

Now it’s time for practice. Enjoy your crane!