Back to list
dev_to 2026年4月24日

動作が始まる前のサーボ取付がぐらつく理由

Why Your Servo Installation Twitches Before It Starts

Translated: 2026/4/24 20:36:39
servoarduinoroboticspower-supplyembedded-systems

Japanese Translation

動作が始まる前のサーボ取付がぐらつく理由 アーduino Stack Exchange の Maker が 48 個の SG90 サーボを 2 つの Arduino Megaボードと 6 つのブレッドボードを通して接続していました。症状は単純でした:コンピュータを拔ぐ際に、一部のサーボがチクチクと振動し、遅延し、ジャイリング(揺らめき)しました。もう一つの Maker は Electronics Stack Exchange で、コンテスト用ロボットが起動時にサーボをランダムな位置に移動させました。この微小的な起動時の振動は、真の動作が始まる前にロボットを不合格にしました。これは多くのチュートリアルで省略される部分です。サーボプロジェクトは正しくコードを持っていても、「神経質」な挙動を示す可能性があります。問題は角度制御だけではありません。それは起動時の振る舞い、電源アーキテクチャ、そしてその物体が動く権利を与えられているかどうかの問題です。多くの初心者の草書はこれをします: #include Servo Servo armServo; void setup() { armServo.attach(9); armServo.write(90); } これは清潔に見えますが、電源オン時に、サーボはノイズ、弱いレーン、またはシステムが準備されていない前に制御パルスを見出せます。ホーンが振動し、物体は驚かれたように見えます。デスクトップトイにとって、これは厄介です。動的彫刻にとって、これは安っぽく見えます。ロボット競技において、それは即座の失敗となります。設計のルールは単純です:相互作用が状態を持つ前にアクチュエータを動かさないでください。Arduino の 5V ピンから複数の SG90 または MG996R サーボに直接電源を供給しないでください。停止電流に適した別の 5V スーパーPLY を使用し、その後、それを接続してください。サーボのグランドを Arduino グランドに接続してください。 ワイヤリング:サーボ赤い線 → 外部 5V サーボ茶色または黒い線 → 外部 GND Arduino GND → 外部 GND サーボシグナル線 → Arduino ピン 9 グラウンドが共有されていなければ、シグナルには安定したリファレンスが得られません。スーPLY が弱い場合、負荷変化時にサーボはジャイリングします。 サーボを最初のアクションとして接続およびコマンドを出さないでください。電源が落ち着くように、安全な位置を定義し、次に接続してください。90 度へのジャンプは観客にとって中立ではありません。それはパニック応答のように見えます。制御されたランップは意図的に見えます。 #include Servo Servo armServo; const int servoPin = 9; int currentAngle = 90; void setup() { // 中国セクション:電源を最初に安定させる前に、モーターを即座に運転しない // 中国セクション:サーボ制御シグナルを接続した後、最初に安全な角度を送る delay(800); armServo.attach(servoPin); armServo.write(currentAngle); delay(500); } void loop() { // 中国セクション:突然のジャンプを代替するための緩やかな移動を使用 moveServoSmoothly(90, 120, 12); delay(1000); moveServoSmoothly(120, 90, 12); delay(1000); } void moveServoSmoothly(int startAngle, int endAngle, int stepDelay) { int stepValue = startAngle < endAngle ? 1 : -1; for (int angle = startAngle; angle != endAngle; angle += stepValue) { armServo.write(angle); delay(stepDelay); } armServo.write(endAngle); } これはすべてのサーボ問題を解決するものではありません。最初の感情的な問題を解決します:物体が自身の電源スイッチによって驚かれたように見えないことです。 チクチクという振動は、機械が自分のやるべきことを知っている前に目覚めていたことを告げます。 制御された起動は、機械が待ち、そして動くことを選択することを告げます。 その差が、インタラクティブな作業におけるサーボタイミングがなぜ重要なのかを説明します。 観客はあなたの電源レーンを見出しません。彼らは不安、自信、またはパニックを見出します。 あなたのサーボプロジェクトが安っぽく感じる場合は、全体の草書を書き直す前に、これらを確認してください: サーボは別々の 5V スーPLY から電源を受けていますか? Arduino GND がサーボスーPLY の GND に接続されていますか? コードが接続と最初のコマンドの前に待っていますか? 運動はジャンプではなくランップしますか? 機械負荷はサーボトルク評価内ですか? 小さなインタラクティブビルド: SG90 マイクロサーボ:軽量プロトタイプと運動研究に適しています。 Amazon MG996R メタルギヤーサーボ:機構に負荷があるか、人が触れる可能性がある場合に適しています。 Amazon 専用 5V 2A 電源:別々のサーボ電源は多くのチクチクとリセット問題を防止します。 Amazon 本記事は、合格した購入から収入を得ています。 サーボジャイリングは単に機械的な問題だけではありません。それは設計の問題です。 起動時にチクチクするサーボは、観客にオブジェクトが制御されていないことを告げます。 待機し、状態を受信し、スムーズに動かすサーボは、オブジェクトに意図があることを観客に告げます。 コードは小さいです。感覚ではありません。

Original Content

Why Your Servo Installation Twitches Before It Starts A maker on Arduino Stack Exchange had 48 SG90 servos connected through two Arduino Mega boards and six breadboards. The symptom was simple: some servos were ticking, delayed, and jittered when the computer was unplugged. Another maker on Electronics Stack Exchange had a competition robot that moved its servos to random positions at startup. That tiny startup twitch would disqualify the robot before the real behavior even began. This is the part most tutorials skip. A servo project can have correct code and still feel nervous. The problem is not only angle control. It is startup behavior, power architecture, and whether the object has permission to move yet. Most beginner sketches do this: #include Servo armServo; void setup() { armServo.attach(9); armServo.write(90); } That looks clean. But at power-up, the servo may see noise, a weak rail, or a control pulse before the system is ready. The horn twitches. The object looks startled. For a desk toy, this is annoying. For a kinetic sculpture, it looks cheap. For a robot in a competition, it can be an instant failure. The design rule is simple: Do not let the actuator move before the interaction has a state. Do not power multiple SG90 or MG996R servos from the Arduino 5V pin. Use a separate 5V supply sized for stall current, then connect the supply ground to Arduino ground. Wiring: Servo red wire to external 5V Servo brown or black wire to external GND Arduino GND to external GND Servo signal wire to Arduino pin 9 If the grounds are not shared, the signal has no stable reference. If the supply is weak, the servo jitters when the load changes. Do not attach and command the servo as the first action. Let power settle, define your safe position, then attach. A jump to 90 degrees is not neutral to the viewer. It looks like a panic response. A controlled ramp feels intentional. #include Servo armServo; const int servoPin = 9; int currentAngle = 90; void setup() { // 中文區塊:先讓電源穩定,不立刻驅動馬達 delay(800); // 中文區塊:接上伺服控制訊號後,先送安全角度 armServo.attach(servoPin); armServo.write(currentAngle); delay(500); } void loop() { // 中文區塊:用慢速移動取代突然跳動 moveServoSmoothly(90, 120, 12); delay(1000); moveServoSmoothly(120, 90, 12); delay(1000); } void moveServoSmoothly(int startAngle, int endAngle, int stepDelay) { int stepValue = startAngle < endAngle ? 1 : -1; for (int angle = startAngle; angle != endAngle; angle += stepValue) { armServo.write(angle); delay(stepDelay); } armServo.write(endAngle); } This does not solve every servo problem. It solves the first emotional problem: the object no longer looks like it is surprised by its own power switch. A twitch says: The machine woke up before it knew what it was doing. A controlled startup says: The machine is waiting, then choosing to move. That difference is why servo timing matters in interactive work. The viewer does not see your power rail. They see hesitation, confidence, or panic. If your servo project feels cheap, check these before rewriting your whole sketch: Is the servo powered from a separate 5V supply? Is Arduino GND connected to servo supply GND? Does the code wait before attach and first command? Does motion ramp instead of jump? Is the mechanical load within the servo torque rating? For small interactive builds: SG90 Micro Servo: good for lightweight prototypes and motion studies. Amazon MG996R Metal Gear Servo: better when the mechanism has load or people might touch it. Amazon Dedicated 5V 2A Power Supply: separate servo power prevents many twitch and reset problems. Amazon I earn from qualifying purchases. Servo jitter is not just a mechanical issue. It is a design issue. A servo that twitches at startup tells the viewer the object is uncontrolled. A servo that waits, receives a state, and moves smoothly tells the viewer the object has intention. The code is small. The feeling is not.