Board-dat/SCU/SCU1012-DAT/2026-01-13-16-52-23.png
... ...
Binary files /dev/null and b/Board-dat/SCU/SCU1012-DAT/2026-01-13-16-52-23.png differ
Board-dat/SCU/SCU1012-DAT/SCU1012-DAT.md
... ...
@@ -34,20 +34,23 @@ MG995 / MG996R are metal-gear servos with high torque suitable for RC cars, boat
34 34
35 35
### Specifications
36 36
37
-| Item | Specification |
38
-|---|---|
39
-| Model | MG995 / MG996R |
40
-| Gear material | Metal (copper) gears |
41
-| Cable length | 30 cm (Signal = yellow, V+ = red, GND = brown) |
42
-| Dimensions (L×W×H) | 40.7 × 19.7 × 42.9 mm |
43
-| Weight | 66.2 g |
44
-| No-load speed | 0.17 s / 60° @ 4.8 V; 0.13 s / 60° @ 6.0 V |
45
-| Stall torque (working torque) | 13 kg·cm |
46
-| Deadband | 4 µs |
47
-| Connector | JR / FUTABA compatible |
48
-| Operating voltage | 3.0–7.2 V |
49
-| Operating temperature | -30 to +60 °C |
50
-| Accessories included | Servo horns, mounting screws, vibration-damping sleeves, aluminum adapter |
37
+| Item | Specification |
38
+| ----------------------------- | ------------------------------------------------------------------------- |
39
+| Model | MG995 / MG996R |
40
+| Gear material | Metal (copper) gears |
41
+| Cable length | 30 cm (Signal = yellow, V+ = red, GND = brown) |
42
+| Dimensions (L×W×H) | 40.7 × 19.7 × 42.9 mm |
43
+| Weight | 66.2 g |
44
+| No-load speed | 0.17 s / 60° @ 4.8 V; 0.13 s / 60° @ 6.0 V |
45
+| Stall torque (working torque) | 13 kg·cm |
46
+| Deadband | 4 µs |
47
+| Connector | JR / FUTABA compatible |
48
+| Operating voltage | 3.0–7.2 V |
49
+| Operating temperature | -30 to +60 °C |
50
+| Accessories included | Servo horns, mounting screws, vibration-damping sleeves, aluminum adapter |
51
+
52
+![](2026-01-13-16-52-23.png)
53
+
51 54
52 55
## Accessories
53 56
Tech-dat/acturator-dat/motor-dat/motor-brushed-dat/Motor-reduction-Gear-dat/Motor-reduction-Gear-dat.md
... ...
@@ -5,7 +5,7 @@
5 5
6 6
- [[Motor-reduction-Gear]]
7 7
8
-
8
+- [[stepper-dat]]
9 9
10 10
## planetary gear motor
11 11
... ...
@@ -39,9 +39,9 @@
39 39
- high torque / low RPM motores
40 40
41 41
42
-- [[N20-motor-dat]]
42
+- [[N20-motor-dat]] based on [[motor-130-dat]]
43 43
44
-- [[motor-TT-dat]]
44
+- [[motor-TT-dat]] based on [[motor-130-dat]]
45 45
46 46
- [[MG513-dat]] - [[MG540-dat]] - [[MG545-dat]]
47 47
Tech-dat/acturator-dat/motor-dat/servo-dat/servo-dat.md
... ...
@@ -78,6 +78,10 @@ Taking the 180-degree angle servo as an example, the corresponding control relat
78 78
79 79
![](2025-06-15-14-21-31.png)
80 80
81
+
82
+
83
+
84
+
81 85
## code
82 86
83 87
### arduino
... ...
@@ -177,11 +181,28 @@ Fine-tune by sending 1500 µs and adjusting slightly if needed.
177 181
178 182
## servo 360 degree
179 183
180
-360度舵机:实际相当于无极变速的减速电机,可以控制速度和方向。没有0-360度角度控制的功能。控制方式和一般舵机的控制信号相同。是瓦力改装的合适动力源
181
-
184
+360° (continuous-rotation) servo
185
+A 360° servo is effectively a geared DC motor with continuous-variable speed and direction control — it does not provide absolute angle positioning. It uses the same PWM control signal as a regular hobby servo, but the pulse width controls motor speed and direction instead of shaft angle. (Commonly used as a power source for modified robots and drivetrains.)
186
+
187
+Control notes
188
+
189
+- Typical PWM time base: ~20 ms period (50 Hz). Pulse width (high time) is usually in the ~0.5–2.5 ms range; 1.5 ms is the neutral/stop point for many servos.
190
+- Behavior for continuous-rotation servos:
191
+ - Pulse < center (e.g., 0.5 ms → 1.5 ms): forward rotation. The smaller the pulse, the faster the forward speed (0.5 ms → fastest forward).
192
+ - ~1.5 ms: stop / neutral.
193
+ - Pulse > center (e.g., 1.5 ms → 2.5 ms): reverse rotation. The larger the pulse, the faster the reverse speed (2.5 ms → fastest reverse).
194
+- Some servos use narrower ranges (e.g., 1.0–2.0 ms). Always check with a servo-tester or measure the actual response for the specific model.
195
+
196
+Example mapping (typical)
197
+
198
+- 0.5 ms — fastest forward
199
+- 1.0 ms — moderate forward
200
+- 1.5 ms — stop
201
+- 2.0 ms — moderate reverse
202
+- 2.5 ms — fastest reverse
203
+
204
+Arduino tip: use Servo.writeMicroseconds(x) to send precise pulse widths (e.g., 1000–2000 µs) and calibrate the stop point for your servo.
182 205
183
-- 高电平为1毫秒~1.5毫秒时,舵机正转(1毫秒时正转速度最快,越接近1.5毫秒越慢,1.5毫秒时舵机停转),
184
-- 高电平为1.5毫秒~2毫秒时舵机反转(1.5毫秒时舵机停转,越接近2毫秒反转的速度越快,2毫秒时以最快的速度反转)
185 206
186 207
- [[N20-motor-dat]]
187 208
Tech-dat/acturator-dat/motor-dat/stepper-dat/stepper-dat.md
... ...
@@ -17,6 +17,9 @@
17 17
18 18
-standard - [[NEMA-dat]] - [[NEMA17-dat]] - [[NEMA-23-dat]]
19 19
20
+
21
+
22
+
20 23
## common options
21 24
22 25
- dual shaft
code-dat/motor-driver-code-dat/dual-foot-dat/dual-foot-2.ino
... ...
@@ -0,0 +1,234 @@
1
+#include <WiFi.h>
2
+#include <WebServer.h>
3
+#include <ESP32Servo.h>
4
+
5
+// ===== WiFi 配置 =====
6
+const char* ssid = "motor_control";
7
+const char* password = "electrodragon";
8
+
9
+// ===== DRV8871 / GPIO 定义 (ESP32) =====
10
+// DRV8871 has two inputs IN1 and IN2. Set both to control direction.
11
+// Forward: IN1=HIGH, IN2=LOW
12
+// Reverse: IN1=LOW, IN2=HIGH
13
+// Stop: IN1=LOW, IN2=LOW (or both HIGH for brake)
14
+const int IN1_PIN = 15; // IN1 -> IO15
15
+const int IN2_PIN = 18; // IN2 -> IO18
16
+
17
+// Servo pins (GPIO numbers)
18
+const int SERVO1_PIN = 11;
19
+const int SERVO2_PIN = 12;
20
+const int SERVO3_PIN = 13;
21
+const int SERVO4_PIN = 14;
22
+
23
+// Relay pins (GPIO numbers) for ON/OFF control
24
+const int RELAY1_PIN = 5;
25
+const int RELAY2_PIN = 6;
26
+const int RELAY3_PIN = 19;
27
+const int RELAY4_PIN = 20;
28
+
29
+// ===== Web Server =====
30
+WebServer server(80);
31
+
32
+// Servo objects
33
+Servo servo1;
34
+Servo servo2;
35
+Servo servo3;
36
+Servo servo4;
37
+
38
+// ===== HTML Web 控制界面 =====
39
+const char html_page[] PROGMEM = R"rawliteral(
40
+<!DOCTYPE html><html>
41
+<head>
42
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
43
+<title>ESP32 Motor & Relay Control</title>
44
+<style>
45
+body { font-family: Arial, sans-serif; max-width: 640px; margin: 0 auto; padding: 20px; background-color: #f0f0f0; }
46
+h2 { text-align:center; color:#333; }
47
+.container { display:flex; flex-direction:column; gap:14px; }
48
+.control-panel { background:white; padding:20px; border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,0.08); display:flex; gap:10px; justify-content:center; }
49
+.servo-panel { background:white; padding:14px; border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,0.04); display:flex; gap:8px; justify-content:center; }
50
+.relay-panel { background:white; padding:14px; border-radius:10px; box-shadow:0 2px 8px rgba(0,0,0,0.04); display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
51
+.dir-btn { padding:16px 22px; font-size:18px; font-weight:bold; border:none; border-radius:8px; cursor:pointer; }
52
+.sml-btn { padding:10px 14px; font-size:14px; font-weight:bold; border:none; border-radius:6px; cursor:pointer; }
53
+.relay-btn { padding:10px 12px; font-size:14px; font-weight:bold; border:none; border-radius:6px; cursor:pointer; }
54
+.forward-btn { background:#2196F3; color:white; }
55
+.reverse-btn { background:#FF9800; color:white; }
56
+.stop-btn { background:#f44336; color:white; }
57
+.s90-btn { background:#4CAF50; color:white; }
58
+.s180-btn { background:#9C27B0; color:white; }
59
+.on-btn { background:#4CAF50; color:white; }
60
+.off-btn { background:#f44336; color:white; }
61
+.dir-btn:active, .sml-btn:active, .relay-btn:active { transform:scale(0.97); opacity:0.9; }
62
+.relay-item { display:flex; gap:6px; align-items:center; }
63
+@media (max-width:420px){ .control-panel{flex-direction:column;} }
64
+</style>
65
+</head>
66
+<body>
67
+<h2>Motor & Relay Control</h2>
68
+<div class="container">
69
+ <div class="control-panel">
70
+ <button class="dir-btn forward-btn" onclick="sendCmd('fw')">Forward</button>
71
+ <button class="dir-btn stop-btn" onclick="sendCmd('st')">STOP</button>
72
+ <button class="dir-btn reverse-btn" onclick="sendCmd('rv')">Reverse</button>
73
+ </div>
74
+ <div class="servo-panel">
75
+ <div style="align-self:center;font-weight:bold">Servo14:</div>
76
+ <button class="sml-btn s90-btn" onclick="sendCmd('s90')">90°</button>
77
+ <button class="sml-btn s180-btn" onclick="sendCmd('s180')">180°</button>
78
+ </div>
79
+ <div class="relay-panel">
80
+ <div class="relay-item"><div style="font-weight:bold">Relay1:</div><button class="relay-btn on-btn" onclick="sendCmd('r1_on')">ON</button><button class="relay-btn off-btn" onclick="sendCmd('r1_off')">OFF</button></div>
81
+ <div class="relay-item"><div style="font-weight:bold">Relay2:</div><button class="relay-btn on-btn" onclick="sendCmd('r2_on')">ON</button><button class="relay-btn off-btn" onclick="sendCmd('r2_off')">OFF</button></div>
82
+ <div class="relay-item"><div style="font-weight:bold">Relay3:</div><button class="relay-btn on-btn" onclick="sendCmd('r3_on')">ON</button><button class="relay-btn off-btn" onclick="sendCmd('r3_off')">OFF</button></div>
83
+ <div class="relay-item"><div style="font-weight:bold">Relay4:</div><button class="relay-btn on-btn" onclick="sendCmd('r4_on')">ON</button><button class="relay-btn off-btn" onclick="sendCmd('r4_off')">OFF</button></div>
84
+ </div>
85
+</div>
86
+<script>
87
+function sendCmd(cmd){
88
+ fetch('/control?cmd='+cmd)
89
+ .then(r=>{})
90
+ .catch(e=>console.error(e));
91
+}
92
+</script>
93
+</body></html>
94
+)rawliteral";
95
+
96
+// ===== 处理 Web 请求 =====
97
+void handleRoot() {
98
+ server.send(200, "text/html", html_page);
99
+}
100
+
101
+void handleControl() {
102
+ // Simple command-based control: cmd=fw|rv|st|s90|s180|rX_on|rX_off
103
+ if (server.hasArg("cmd")) {
104
+ String c = server.arg("cmd");
105
+ if (c == "fw") {
106
+ // Forward: IN1=HIGH, IN2=LOW
107
+ digitalWrite(IN1_PIN, HIGH);
108
+ digitalWrite(IN2_PIN, LOW);
109
+ Serial.println("Motor: Forward");
110
+ } else if (c == "rv") {
111
+ // Reverse: IN1=LOW, IN2=HIGH
112
+ digitalWrite(IN1_PIN, LOW);
113
+ digitalWrite(IN2_PIN, HIGH);
114
+ Serial.println("Motor: Reverse");
115
+ } else if (c == "st") {
116
+ // Stop: both LOW
117
+ digitalWrite(IN1_PIN, LOW);
118
+ digitalWrite(IN2_PIN, LOW);
119
+ Serial.println("Motor: Stop");
120
+ } else if (c == "s90") {
121
+ // Servo4 to 90 degrees
122
+ servo4.write(90);
123
+ Serial.println("Servo14: 90°");
124
+ } else if (c == "s180") {
125
+ // Servo4 to 180 degrees
126
+ servo4.write(180);
127
+ Serial.println("Servo14: 180°");
128
+ } else if (c == "r1_on") {
129
+ digitalWrite(RELAY1_PIN, HIGH);
130
+ Serial.println("Relay1: ON");
131
+ } else if (c == "r1_off") {
132
+ digitalWrite(RELAY1_PIN, LOW);
133
+ Serial.println("Relay1: OFF");
134
+ } else if (c == "r2_on") {
135
+ digitalWrite(RELAY2_PIN, HIGH);
136
+ Serial.println("Relay2: ON");
137
+ } else if (c == "r2_off") {
138
+ digitalWrite(RELAY2_PIN, LOW);
139
+ Serial.println("Relay2: OFF");
140
+ } else if (c == "r3_on") {
141
+ digitalWrite(RELAY3_PIN, HIGH);
142
+ Serial.println("Relay3: ON");
143
+ } else if (c == "r3_off") {
144
+ digitalWrite(RELAY3_PIN, LOW);
145
+ Serial.println("Relay3: OFF");
146
+ } else if (c == "r4_on") {
147
+ digitalWrite(RELAY4_PIN, HIGH);
148
+ Serial.println("Relay4: ON");
149
+ } else if (c == "r4_off") {
150
+ digitalWrite(RELAY4_PIN, LOW);
151
+ Serial.println("Relay4: OFF");
152
+ }
153
+ }
154
+
155
+ server.send(200, "text/plain", "OK");
156
+}
157
+
158
+// ===== 初始化 =====
159
+void setup() {
160
+ Serial.begin(115200);
161
+ delay(100);
162
+ Serial.println("ESP32 DRV8871 AP Motor Controller starting...");
163
+
164
+ // Configure GPIO pins as outputs
165
+ pinMode(IN1_PIN, OUTPUT);
166
+ pinMode(IN2_PIN, OUTPUT);
167
+
168
+ // Relay pins
169
+ pinMode(RELAY1_PIN, OUTPUT);
170
+ pinMode(RELAY2_PIN, OUTPUT);
171
+ pinMode(RELAY3_PIN, OUTPUT);
172
+ pinMode(RELAY4_PIN, OUTPUT);
173
+
174
+ // Default: stop motor and relays OFF (LOW)
175
+ digitalWrite(IN1_PIN, LOW);
176
+ digitalWrite(IN2_PIN, LOW);
177
+ digitalWrite(RELAY1_PIN, LOW);
178
+ digitalWrite(RELAY2_PIN, LOW);
179
+ digitalWrite(RELAY3_PIN, LOW);
180
+ digitalWrite(RELAY4_PIN, LOW);
181
+
182
+ // Attach servos and set to center (0°)
183
+ servo1.attach(SERVO1_PIN);
184
+ servo2.attach(SERVO2_PIN);
185
+ servo3.attach(SERVO3_PIN);
186
+ servo4.attach(SERVO4_PIN);
187
+
188
+ servo1.write(0);
189
+ servo2.write(0);
190
+ servo3.write(0);
191
+ servo4.write(0);
192
+
193
+ // 启动为 WiFi AP 模式,使用固定 IP
194
+ Serial.println("Starting WiFi AP...");
195
+
196
+ WiFi.disconnect(true);
197
+ WiFi.mode(WIFI_AP);
198
+ delay(100);
199
+
200
+ bool apStarted = WiFi.softAP(ssid, password);
201
+ if (!apStarted) {
202
+ Serial.println("AP start failed! Retrying...");
203
+ delay(1000);
204
+ WiFi.softAP(ssid, password);
205
+ }
206
+
207
+ delay(1000);
208
+ IPAddress apIP(192, 168, 50, 1);
209
+ IPAddress apGateway(192, 168, 50, 1);
210
+ IPAddress apSubnet(255, 255, 255, 0);
211
+ if (!WiFi.softAPConfig(apIP, apGateway, apSubnet)) {
212
+ Serial.println("softAPConfig failed");
213
+ }
214
+
215
+ delay(500);
216
+ Serial.println("");
217
+ Serial.println("==========================");
218
+ Serial.print("AP SSID: ");
219
+ Serial.println(ssid);
220
+ Serial.print("AP Password: ");
221
+ Serial.println(password);
222
+ Serial.print("AP IP: ");
223
+ Serial.println(WiFi.softAPIP());
224
+ Serial.println("==========================");
225
+
226
+ // Web 服务
227
+ server.on("/", handleRoot);
228
+ server.on("/control", handleControl);
229
+ server.begin();
230
+}
231
+
232
+void loop() {
233
+ server.handleClient();
234
+}
... ...
\ No newline at end of file
code-dat/motor-driver-code-dat/motor-driver-code-dat.md
... ...
@@ -1,7 +1,7 @@
1 1
2 2
# motor-driver-code-dat
3 3
4
-
4
+- [[motor-tt-dat]]
5 5
6 6
## drive by wifi and webserver
7 7