発行済み 2026-07-13
簡単な回答
接続するにはサーボモーターを Arduino に接続するには、通常、電源 (赤)、アース (茶色または黒)、信号 (黄色またはオレンジ) の 3 本のワイヤが必要です。電源線をArduinoの5Vピンに、グランドをGNDに、信号線をピン9などのデジタルPWMピンに接続します。サーボこの直接接続は機能しますが、高トルクまたは複数の場合には機能しません。サーボArduino の電圧レギュレータの過負荷を避けるために、外部電源の使用をお勧めします。次に、Arduino は、通常は組み込みのサーボ ライブラリを使用して、1 ~ 2 ミリ秒のパルス幅の PWM 信号を送信することでサーボの位置を制御します。一部のサーボは 6V 以上で動作し、別の電源が必要な場合があるため、接続する前に必ず電圧要件を確認してください。
導入
生産ラインが止まってしまいます。ロボットアームは的を外します。精密治具が位置を保持できません。モーション コントロールをプロトタイプまたは小規模な自動化プロジェクトに統合する場合、これらのシナリオは珍しいことではありません。多くのエンジニアや愛好家は、コスト効率の高いコントローラーとして Arduino に注目していますが、サーボモーターまた、Arduino ボードは多くの場合問題の始まりであり、配線の誤り、電力不足、または PWM 設定の誤りにより、不安定な動作、過熱、さらにはモーターやボードの永久的な損傷につながる可能性があります。この記事では、正しい物理接続、電源に関する考慮事項、コード構造、Arduino でサーボ モーターをセットアップする際のよくある落とし穴について説明します。これにより、試行錯誤を回避し、最初のテストからモーション システムを確実に実行できるようになります。
目次
サーボモータの配線規格を理解する
電力要件と外部電源の決定
Selecting the Correct Arduino Pin for PWM Signal
Writing and Testing the Control Code
Common Wiring Mistakes and How to Prevent Them
接続前に確認すべき主な仕様

Questions Buyers Often Ask About Connecting Servo Motors to Arduino
Choosing the Right Setup for Your Application
サーボモータの配線規格を理解する
Most hobby and industrial-grade servo motors follow a three-wire color code: power, ground, and signal. The power wire is typically red, ground is brown or black, and the signal wire is yellow, orange, or white. The power wire should connect to a 5V source, ground to the common ground of the system, and the signal wire to a digital PWM-capable pin on the Arduino. This standard applies to a wide range of マイクロサーボ options, including the popular SG90 and MG996R models, as well as larger industrial servo drives that use a similar three-wire interface for control signals. However, always verify the datasheet of your specific servo model, as some units reverse the power and ground wires or use different voltage levels.
電力要件と外部電源の決定
A common mistake when connecting a servo motor to Arduino is assuming the board can supply sufficient current for the motor. The Arduino Uno, for example, provides approximately 500mA from its 5V pin when powered via USB, and up to 1A when powered through the barrel jack. A single small servo like the SG90 draws around 200mA under load, but peak current can reach 700mA or more during start-up or when holding a position against resistance. If you connect two or more servos, or a high-torque servo, the total current demand can exceed the Arduino's capacity, causing voltage drops, resets, or damage to the voltage regulator. For such cases, using an external power supply rated for the servo's voltage and current requirements is essential. Connect the servo's power wire directly to the external supply, but always tie the ground of the external supply to the Arduino's ground to maintain a common reference for the signal.
Selecting the Correct Arduino Pin for PWM Signal
The Arduino uses pulse-width modulation (PWM) to control servo position. Not all digital pins support hardware PWM. On the Arduino Uno, pins 3, 5, 6, 9, 10, and 11 are PWM-enabled. However, the Arduino Servo library can generate software-based PWM on any digital pin, though hardware PWM pins provide more stable timing, especially when controlling multiple servos simultaneously. For most applications, pin 9 is the recommended choice for a single servo because it uses Timer 1, which is less likely to conflict with other timing functions like 遅れ()またはミリス() . If you are controlling more than one servo, assign each to a separate PWM pin and ensure the total number does not exceed the library's limit of 12 servos on most Arduino boards.
Writing and Testing the Control Code
The Arduino Servo library simplifies the process of controlling a servo motor. The basic code structure includes including the library, creating a servo object, attaching it to a pin in the 設定() function, and then using サーボライト(角度)でループ() to set the target position. A typical test sequence sweeps the servo from 0 to 180 degrees and back. In more practical applications, you may want to map sensor input to servo angles, or use a potentiometer for manual position control. For example, using analogRead() on a potentiometer connected to an analog pin, then mapping the 0-1023 reading to a 0-180 range, allows real-time position control. When writing code for production or testing, always include a short delay between position changes to allow the servo to reach the commanded angle, especially under load. The servo motor control code should also include a detach command after the servo reaches its target if power savings or reduced holding torque is desired.
Common Wiring Mistakes and How to Prevent Them
Several wiring errors occur repeatedly during servo-Arduino integration. The first is reversing the power and ground wires, which can damage the servo or the Arduino instantly. Always confirm the wire color code against the servo's datasheet. The second mistake is connecting the signal wire to a non-PWM pin, which results in no movement or erratic behavior. The third is using the same power source for the servo and other high-current components like LEDs or relays without the checking total current draw. Another frequent issue is failing to connect the grounds between an external power supply and the Arduino, causing signal noise or complete failure of the servo to respond. Finally, using a long or thin signal wire can introduce interference, especially in electrically noisy environments. In such cases, using a shielded cable or a shorter wire run improves signal integrity.

接続前に確認すべき主な仕様
Before wiring your サーボモーター to an Arduino, verify the following specifications from the servo's datasheet:
Checking these parameters before connecting helps ensure reliable operation and prevents common failures. For industrial-grade servos, additional parameters such as feedback resolution, communication protocol, and protection features should also be reviewed.
Questions Buyers Often Ask About Connecting Servo Motors to Arduino
Can I connect a servo motor directly to Arduino without external power?
For a single small servo like the SG90, direct connection to the Arduino's 5V pin is acceptable for light loads. For multiple servos or high-torque models, an external power supply is strongly recommended.
What happens if I use the wrong PWM pin?
The servo will not respond or may produce erratic movement. Always use a PWM-capable pin, preferably pin 9 on Arduino Uno.
Do I need a capacitor when connecting a servo?
Adding a 100-470 µF electrolytic capacitor between power and ground near the servo can reduce voltage spikes and improve stability, especially during rapid acceleration.
How do I know if my servo requires 5V or 6V?
Check the datasheet. Many standard servos operate between 4.8V and 6V. If the datasheet is unavailable, start at 5V and monitor performance.
Can I control more than one servo with a single Arduino?
Yes, the Servo library supports up to 12 servos on most Arduino boards, each connected to a separate PWM pin.
Why does my servo jitter or vibrate?
Jitter can be caused by insufficient power, incorrect pulse width range, electrical noise, or a loose signal connection. Check power supply stability and wire integrity.
Is it safe to use a servo with an Arduino Mega?
Yes. The Arduino Mega has multiple PWM pins and a more robust voltage regulator, making it suitable for projects with multiple servos.
Choosing the Right Setup for Your Application
The correct connection method depends on the specific requirements of your application. For a single low-torque servo used in a proof-of-concept or educational project, direct connection to the Arduino with a simple sweep code is sufficient. For production prototypes or small automation systems involving multiple servors or continuous operation, an external power supply, proper filtering, and stable PWM signal routing become critical. If your project requires precise position feedback or closed-loop control, consider using a servo with a feedback potentiometer or an absolute encoder, and adjust your code accordingly. For users scaling beyond Arduino's capabilities, a dedicated servo controller may offer better timing precision and higher channel counts.
To ensure your first connection is successful, start with a simple test: power the servo through the Arduino's 5V pin for a lightweight model, connect the signal wire to pin 9, upload a basic sweep sketch, and observe the movement. If the servo does not respond, check power polarity, ground continuity, and signal pin assignment. Once the basic connection works, you can expand to more complex control schemes, integrate sensor inputs, or add external power for higher loads. If you need help selecting a compatible servo or verifying your wiring diagram, contact our engineering team with your project specifications for a free review.
Update Time:2026-07-13