Basic motors¶
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 3). 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).
Time constraints:
starting from 90 min
Exercise¶
Determine how many degrees in one second the pointer connected to the large (medium) servo motor will rotate at speeds 100,70, 50, 34. Verify the 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 3. How much rotation does the last (smallest at the top) 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 1 and Figure no 2).
Theory¶
Mathematics science¶
Exercise 1.
Determine how many degrees in one second the pointer connected to the large (medium) servo motor will rotate at speeds 100,70, 50, 34. Verify the calculation.
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 argument speed=50, they will run at different speeds and different number of rotations. Take a look at an example and complete the calculations for 70, 50, 34.
The large motor will run
100% x 1050 = 1050 degree per second ( it’s almost 3 rotation)
70% x 1050 = …
The medium motor will run
100% x 1560 = 1050 degree per second (it’s over 4 rotation)
70% x 1560 = …
We would like to obtain 1 rotation of motor. Calculate what value of speed we have to use for a large motor. Do the same for the medium motor.
speed/100 x 1050 = 360 degrees per seconds
speed = 360 x 100/1050
speed=34.2
Exercise no. 2
Use the gears to build the structure shown in Figure 3. How much rotation does the last gear (smallest at the top) 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 number of teeth of gear connected with the motors. The number in the denominator of the first fraction is equal to the number of teeth of second gear etc. If the motor rotates 1, the wheel on top will rotate 9 times.
Now swap the gear (first and second and next first and second and five and six together) and compute the results.
Exercise no. 3 (by LEGO MINDSTORMS education)
Create a programme in which the robot moves forward 1 m.
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 * x rotations
x = 100 cm ÷ 9.42 cm = 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
Short help on programming¶
#!/usr/bin/env python3
Import library
from ev3dev2.motor import LargeMotor
from ev3dev2.motor import MediumMotor
#Create an instance of class
lm=LargeMotors()
mm=MediumMotors()
The useful function
on_for_seconds(speed, seconds, brake=True, block=True )
on_for_rotations(speed, rotations, brake=True, block=True)
Speed is an integer which represents the percentage of the rated maximum speed of the motor [-100,100].
Brake is a Boolean parameter (True or False).
If it is True then once the motor completes its motion the motor will actively try to keep the motor in a fixed position. If the argument brake is False then once the motor completes its motion the motor will coast gradually to a stop.
‘Blocking’ a program means making the program execution pause until the current command has completed.
It is also possible to specify speeds in degrees per second or rotations per second or degrees per minute or rotations per minute.
#!/usr/bin/env python3
from ev3dev2.motor import SpeedDPS
lm=LargeMotors()
lm.on_for_seconds(speed=SpeedDPS(360), seconds=3)
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).