Basic motors¶
Prerequisite¶
What students should know before:
No prerequisites
Time constraints:
starting from 90 min
Preparing For This Tutorial:¶
The LEGO Mindstorm EV3 – to do exercise 1 you need only a motor (large or medium) connected to the brick. In exercise 2 you need some gears (see Figure no 2). The LEGO Mindstorm EV3 Robot that coincides with exercise no 3 comes from building specific sections found in the LEGO Mindstorm Education Design Engineer – Make It Move -With Wheels part (see Figure no 1).
Effects¶
Computer science – Students will learn how to work with functions form LargeMotors and MediumMotor classes. They will create a programme that will allow them to understand the basic function of robots - usage of motors.
Mathematics – Students will have to solve equations and use fractions.
Physics – Students will understand why we use gears.
Exercise¶
Determine how many degrees per second the large (medium) motor will run while the speed is 100, 70, 50, 34. Verify your calculation.
We would like to obtain 1 rotation of a motor. Calculate what value of speed we have to use for large (medium) motors respectively.
Use the gears to build the structure shown in Figure 2. How much rotation does the last gear make when the engine makes 1 rotation? Create a program to see the solution.
Create a program in which the robot moves forward 1 m (see Figure no 3 and Figure no 4).
Example solution¶
Mathematics science
Step 1:
Determine how many degrees per second the large (medium) motor will run while the speed is 100,70, 50, 34. (see figure no 1).
Figure no 1¶
Speed is the value which represents the percentage of the rated maximum speed of the motor. The rated maximum speed of the Lego EV3 large (medium) motor is 1050 (1560) degrees per second. Therefore, if a large motor and a medium motor are both set to speed=50, they will run at different speeds and different number of rotations..
The large motor will run
100% x 1050 = 1050 degree per second ( it’s almost 3 rotation)
70% x 1050 = 735 degrees per second
50% x 1050 = 525 degrees per second
34% x 1050 = 357 degrees per second (it’s almost 1 rotation)
The medium motor will run
100% x 1560 = 1050 degree per second (it’s over 4 rotation)
70% x 1560 = 1092 degrees per second (it’s about 3 rotation)
50% x 1560 = 780 degrees per second (it’s over 2 rotation)
34% x 1560 = 530,4 degrees per second (it’s about 1.5 rotation)
We would like to obtain 1 rotation of motor. Calculate what value of the speed we have to use for large (medium) motor respectively.
speed/100 x 1050 = 360 degrees per seconds
speed = 360 x 100/1050
speed=34.2
speed/100 x 1560 = 360 degrees per seconds
speed = 360 x 100/1560
speed=23.07
Program (for large motor)
#!/usr/bin/env python3
2. from ev3dev2.motor import LargeMotor
3.
4. lm = LargeMotor()
5. #lm.on_for_seconds(speed = 34.2, seconds=1)
6. lm.on_for_seconds(34.2,1)
7. #lm.on_for_seconds(speed=\ **SpeedDPS(360)**, seconds=1)
Comment:
Add line 7 to the program - It will make the servo rotate 360 degrees in 1 second (change 1 second to 2 seconds).
Functions: SpeedDPS, SpeedRPM, SpeedRPS, SpeedDPM (degree per seconds, rotation per minutes, rotation per seconds, degree per minutes) convert a value in degrees (or rotations) per second (or minutes) into the corresponding speed value (only in library ev3dev2).
Note. Remember to import the necessary library.
from ev3dev2.motor import SpeedDPS, SpeedRPM, SpeedRPS, SpeedDPM
Program (for medium motor)
#!/usr/bin/env python3
from ev3dev2.motor import MediumMotor
mm = MediumMotor()
#mm.on_for_seconds(speed = 23.07, seconds=1)
mm.on_for_seconds(23.07,1)
Exercise 2.
Use the gears to build the structure shown in Figure 2. How much rotations does the last gear make when the engine makes 1 rotation? Create a programme to see the solution.
Physics science
Gears operate in pairs to transmit and modify rotary motion without slip, the teeth of one gear engaging the teeth on a matching gear.
Figure no 2.¶
[by Yoshihito Isogawa, Lego Mindstorms EV3 page 21]
\(\frac{36}{12}\ \cdot \frac{4}{4}\ \cdot \frac{36}{12} = \frac{3}{1} \cdot \frac{1}{1} \cdot \frac{3}{1} = 9\)
The number in the numerator of the first fraction is equal to the teeth of gear connected with the motors. The number in the denominator of the first fraction is equal to the teeth of second gear etc. If the motor rotates 1, the wheel on top will rotate 9 times.
Program
#!/usr/bin/env python3
from ev3dev2.motor import MediumMotor
mm = MediumMotor()
mm.on_for_rotations(50,1)
Program
#!/usr/bin/env python3
from ev3dev2.motor import MediumMotor
mm = MediumMotor()
for i in range(0,9):
print(i+1)
mm.on_for_rotations(50,1/9.0)
Note. Now you can swap the gear (first and second and of course first and second and five and six together).
Exercise 3 . (by LEGO MINDSTORMS education)) Create a programme in which the robot moves forward 1 m (see Figure no 3).*
Figure no 3 |
Figure no 4 |
The small wheel is approximately 3 cm in diameter.
Circumference = Diameter * pi
Circumference = 3 cm * 3.14 = 9.42 cm
So we obtain that 1 wheel rotation gives 9.42 cm distance.
Calculate how many wheel rotations are required for the robot to move 100 cm.
100 cm = 9.42 cm per rotation * x rotations
100 cm ÷ 9.42 cm per rotation = 10.6 rotations.
Adjust the motor rotations multiplying them by the gear ratio. Yellow gear has 12 teeth, black gear has 20 teeth, so the ratio is \(\frac{20}{12} = \frac{5}{3} = 1.67\)
Geared rotations = 10.6 rotations * 20 / 12-gear ratio
Geared rotations = 10.6 rotations * 1.67 gear ratio = 17.7 geared rotations
Program
#!/usr/bin/env python3
from ev3dev2.motor import MediumMotor
mm = MediumMotor()
mm.on_for_rotation(50,17.7)
Summary¶
We have just learnt how to use functions from LargeMotor and MediumMotor classes.
All source codes presented above are placed in the file Motors.zip