サーボモーターを動かしてみる(高トルク製品)

 DIY 記事  ー 実験

概要

 小さなサーボモーターは Arduino の内部電源だけで駆動させることができますが、大きなサーボモーターを動かす場合は大電流が必要になるので、別の電力源を用意する必要があります。
 2つの電源を用意して、サーボモーターの駆動実験をしたので、簡単に記事にまとめてみます。
 ( ↓ 配線は、この記事をもとに行いました。)

使ったパーツ

・9V電池
・電池スナップ
・DCプラグ(無い場合はArduino直結も可)
・単3電池 4本
・電池BOX(単3×4本用)
・Arduino( uno ・ nano ・ mega など )
・サーボモーター 2個
・ユニバーサル基板
・ピンヘッダ 4ピン×4個(長いものをニッパーで切って使う)
・ピンヘッダ 1ピン×1個
・ジャンパーワイヤー オスメス 3本
・リード線 10cm 程度

作業写真

↑ パーツを集める。(※写真は記事で使った部品とは少し違う)

↑ はんだ付けを行う。

↑ コネクタ類を差し込んでいく。

↑ こんな感じに。(ピンを4個付けたので、サーボモーター4個まで接続できる。)

↑ Arduinoの 5番・6番・GNDピンにジャンパワイヤを差し込む。
(「~マーク」の付いているピンはサーボモーターが使える。)

↑ 配線完了

プログラムを作成して書き込む

↓ このようなプログラムを作成して書き込みました。

#include <Servo.h>

Servo myservo1;

Servo myservo2;

void setup() {

  myservo1.attach(5);

  myservo2.attach(6);

}

void loop() {

  myservo1.write(90);

  delay(1000);

  myservo2.write(90);

  delay(1000);

  myservo1.write(0);

  delay(1000);

  myservo2.write(0);

  delay(1000);

}

動作確認

サーボモーターが交互に動けば成功です!


Warning: Undefined array key "today_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 63

Warning: Undefined array key "yesterday_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 64

Warning: Undefined array key "month_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 65

Warning: Undefined array key "year_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 66

Warning: Undefined array key "total_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 67

Warning: Undefined array key "views_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 68

Warning: Undefined array key "totalviews_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 69

Warning: Undefined array key "online_view" in /home/xs128603/diy-kousaku.com/public_html/wp-content/plugins/xt-visitor-counter/xt-visitor-counter-widgets.php on line 70
タイトルとURLをコピーしました