Skip to content

Commit 67d7adc

Browse files
committed
actuator section
1 parent e000476 commit 67d7adc

File tree

1 file changed

+6
-11
lines changed
  • docs/_sections/_guide-primaries/sensors-and-actuators

1 file changed

+6
-11
lines changed

docs/_sections/_guide-primaries/sensors-and-actuators/actuators.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ parent: Hardware
66
nav_order: 5
77
---
88

9-
# TODO: elaborate more on how servos and DC motors actually work
10-
119
# Actuators
1210

1311
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
2119

2220
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.
2321

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 motors 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.
2523

2624
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.
2725

@@ -74,22 +72,19 @@ The following is an example of configuring and running the motor in software:
7472
#include "sdkconfig.h"
7573
#include <Arduino.h>
7674

77-
#define IN1 27 // Control pin 1
78-
#define IN2 14 // Control pin 2
79-
#define ENA 12 // PWM pin
75+
#define IN1 16 // Control pin 1
76+
#define IN2 17 // Control pin 2
8077

8178
void setup() {
8279
Serial.begin(115200);
8380
pinMode(IN1, OUTPUT);
8481
pinMode(IN2, OUTPUT);
85-
pinMode(ENA, OUTPUT);
8682
}
8783

8884
void loop() {
8985
// 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
9388

9489
delay(1000); // Run for 1 second
9590

@@ -108,7 +103,7 @@ Again, more detailed information about the DRV8833 motor controllers can be [fou
108103

109104
## What Are Servos?
110105

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.
112107

113108
## How to Use Servos?
114109

0 commit comments

Comments
 (0)