You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_sections/_guide-primaries/sensors-and-actuators/actuators.md
+6-11Lines changed: 6 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,6 @@ parent: Hardware
6
6
nav_order: 5
7
7
---
8
8
9
-
# TODO: elaborate more on how servos and DC motors actually work
10
-
11
9
# Actuators
12
10
13
11
The word "actuators" is just a fancy word for "devices that create motion," which can include anything ranging from hydraulic pistons to motors. In our case, electric motors will be the key to your robot's motion! In this competition, you will be dealing with servo motors.
@@ -21,7 +19,7 @@ You will be using DC (direct current) motors as the primary means of moving your
21
19
22
20
DC motors operate on electromagnetic principles. Inside the motor, there are permanent magnets (stator) that create a stationary magnetic field, and wire coils (rotor/armature) that carry electrical current. When current flows through the rotor windings in the presence of the magnetic field, electromagnetic forces cause the rotor to spin. A commutator and brushes automatically switch the current direction in the windings as the motor rotates, ensuring continuous rotation.
23
21
24
-
The motor's speed is controlled by varying the applied voltage (typically using PWM), while direction is reversed by switching the voltage polarity.
22
+
The motor’s speed depends on the applied voltage; higher voltage makes the motor spin faster. The torque (rotational force) depends on the current; more current allows the motor to push harder, such as when moving a heavier robot. Motor speed is controlled by pulse-width modulation ([PWM](https://learn.sparkfun.com/tutorials/pulse-width-modulation/all)), which is when the supply voltage is switched on and off rapidly. By adjusting the ratio of “on” to “off” time, you can smoothly control the average voltage the motor receives. Direction is reversed by by switching the voltage polarity.
25
23
26
24
However, directly connecting a DC motor to the ESP32 is not desirable due to lack of direction control and higher voltage/current requirements of the motor. This is where motor controllers come into play.
27
25
@@ -74,22 +72,19 @@ The following is an example of configuring and running the motor in software:
74
72
#include"sdkconfig.h"
75
73
#include<Arduino.h>
76
74
77
-
#defineIN1 27 // Control pin 1
78
-
#define IN2 14 // Control pin 2
79
-
#define ENA 12 // PWM pin
75
+
#defineIN1 16 // Control pin 1
76
+
#define IN2 17 // Control pin 2
80
77
81
78
voidsetup() {
82
79
Serial.begin(115200);
83
80
pinMode(IN1, OUTPUT);
84
81
pinMode(IN2, OUTPUT);
85
-
pinMode(ENA, OUTPUT);
86
82
}
87
83
88
84
voidloop() {
89
85
// Spin motor
90
-
digitalWrite(IN1, HIGH);
91
-
digitalWrite(IN2, LOW);
92
-
analogWrite(ENA, 255);
86
+
analogWrite(IN1, 255); // PWM signal
87
+
digitalWrite(IN2, LOW); // Direction control
93
88
94
89
delay(1000); // Run for 1 second
95
90
@@ -108,7 +103,7 @@ Again, more detailed information about the DRV8833 motor controllers can be [fou
108
103
109
104
## What Are Servos?
110
105
111
-
Servos are motors that are designed for precise position control. Instead of freely rotating when powered, servos listen to a control signal (usually [PWM](https://learn.sparkfun.com/tutorials/pulse-width-modulation/all)) to determine where to rotate. Some servos offer limited rotation, while others can rotate continuously (like ours). More advanced servos have other ways to be even more precise such as a feedback system on top of the control signal, but that is not necessary for this competition.
106
+
Servos are motors that are designed for precise position control. Instead of freely rotating when powered, servos listen to a control signal (usually [PWM](https://learn.sparkfun.com/tutorials/pulse-width-modulation/all)) to determine where to rotate. Some servos offer limited rotation (like 0°–180°), while others can rotate continuously (like ours). More advanced servos have other ways to be even more precise such as a feedback system on top of the control signal, but that is not necessary for this competition.
0 commit comments