工業製造
産業用モノのインターネット | 工業材料 | 機器のメンテナンスと修理 | 産業プログラミング |
home  MfgRobots >> 工業製造 >  >> Manufacturing Technology >> 製造プロセス

ジャイアントアニマトロニクスレゴミンフィグオペレーションゲーム

コンポーネントと消耗品

>
Arduino UNO
× 2
Adafruit ArduinoMP3シールド
× 1
MG90Sギアマイクロサーボ
× 6
スピーカー:3W、4オーム
× 2
OpenBuildsボールベアリング– 688Z 8x16x5
× 12

必要なツールとマシン

Lulzbot Taz 5FDMプリンター
X-Carve CNC

このプロジェクトについて

このプロジェクトは4段階で完了しました。最初の3つのステージ(電子機器を含まない)について簡単に説明し、フランクをオペレーションゲームに変換し、オーディオとアニマトロニクスを追加した4つのステージについて詳しく説明します。

ステージ1:メガフィグの構築

私は手を作ることから始めました。これが最初のビルドの最も難しい部分であると考え、製造する必要のある残りのパーツのスケールを定義しました。手はPVCパイプとグラスファイバー樹脂で作られており、内側と外側の手の隙間を埋めています。

<図>

次はヘッド製作でした。それは、PVCパイプ(ヘッドの主要部分に適合する大きなパイプ)、MDF、および樹脂でできており、上部のこぶの隙間を埋めます。

<図>

メガフィグのボディはMDFと非常に単純なボックスビルドから作られました。 PVC継手は、付属肢と胴体の間のジョイントとして使用されます

<図>

脚はMDFとPVCでできており、上部の脚の曲線を定義します。

<図>

腕(最終的に最も硬い部分)は、前腕のPVCパイプと、上腕のMDFで荒削りされました。スペースフィラーとしてフローラルフォームを使用しました。上腕の形を作るのにBondoが使われ、たくさんの紙やすりで磨いて詰めることで最終的な形になりました。

<図>

<図>

<図>

<図>

腕と手はSmoothcast300で成形され、鋳造されました。

<図>

すべてがモンスターハンターレゴキットに基づいて描かれました。

<図>

フェーズ2:髪

このフェーズは、科学者の髪の毛を作ることで構成されていました。ツーリングフォームは、バンドソーを使用してヘアウィスプの基本的な形状にカットされました。ヘアピースのさまざまな部分がエポキシで接着されました。

<図>

ヘアピース全体をSmoothcast300で覆い、フォームの上にプラスチックシェルを作成しました。その後、研磨して充填しました。

<図>

<図>

エポキシスカルプトを使用して、髪のセクション間のすべての継ぎ目を埋めました。

<図>

<図>

下塗りと塗装が行われました。

<図>

フェーズ3:フランクのベッド

第三段階は、クレイジーサイエンティストと彼のモンスターレゴキットに基づいたフランクのベッドの建設でした。これは、ナブ用のMDFおよびPVCパイプから作られたシンプルなボックスビルドです。

<図>

コーナーの詳細は、MDFのディスクを挟んだPVCパイプで作成されました。

<図>

すべてが研磨され、下塗りされ、塗装されました。

<図>

フェーズ4:オペレーションゲームとモーション

このプロジェクトの最後の部分(これまで)は、フランクをオペレーションゲームに変換し、オーディオとモーションの両方をメガフィグに追加することです。物事がどのように起こったかを時系列で並べるのではなく、ビルドの各ボディ部分について詳しく説明します(すべてが同時に作業されていました)。

胴体:

胴体には、2つのローラースケートベアリングを保持するジョイントに3Dプリントされたブラケットが追加されていました。これらは腕と頭のピボットポイントとして機能します。

<図>

フランクの上半身には、3D印刷され、粉砕されたアルミニウムの唇がトッピングされ、新しい胴体プレートで覆われた2つのキャンディー皿がありました。アルミリップは操作ゲームのスイッチとして機能します。トング(MP3シールドに配線されている)がアルミニウムに触れると、回路が完成し、プログラムがアクティブになります。

<図>

<図>

<図>

<図>

頭:

両方のヘッドは、スピーカーを動かして保持するように変更されました。最初に、車軸として機能する5/16ボルトを保持するために、3Dプリントブラケットがネックに追加されました。

<図>

<図>

スピーカーグリルの穴を計画するためのガイドとして、穴あき金属を使用しました。私はこのプロセスについて最も緊張していました。どんな間違いでも私の顔のペイントの仕事を台無しにするでしょう。穴は周囲の色に合わせて塗装されています。

<図>

<図>

<図>

<図>

スピーカーをスピークグリルの後ろに保持するために、3Dプリントブラケットが作成されました。

<図>

<図>

脚:

新しい脚は、骨の形をしたキャンディー皿と同様に、2つの半分に3Dプリントされました。アルミ板は胴体のようにフライス盤で削られました。脚は一緒に接着され、研磨され、ボンドで滑らかにされ、塗装されました。

<図>

<図>

<図>

<図>

武器:

アームの元のマスターは、車軸の5/16の太字を保持する3Dプリントブラケットを受け入れるように変更されました。その後、再成形、鋳造、クリーンアップ、塗装を行いました。

<図>

<図>

<図>

<図>

サーボ:

サーボは3D印刷されたブラケットを使用して取り付けられ、ワイヤーと5/16ボルトに取り付けられたアルミニウムホーンを介して付属物に接続されました。後で腕を持ち上げるのを助けるためにバネが追加されました。

<図>

<図>

<図>

エレクトロニクス:

すべての電子機器をMDFに取り付けて、プロトタイプのテストベッドを作成しました。この設定により、私とダニエルはプログラミング、tweekのものを理解し、グリッチを解決することができました。すべてがうまくいきました。

電子機器の仕組みは

1:MP3シールドは3つの入力のうちの1つ(アルミニウム板の1つへのトング)を待機します

2:アルミニウムプレートがアクティブになると、MP3シールドは対応するMP3ファイルを再生し、サーボArduinoに信号を送信します。

3:サーボarduinoがMP3シールドから信号を受信すると、サーボに対応するコードを実行します。

両方のarduinoがフランクのベッドの下側に取り付けられ、すべてが再配線されました。

<図>

トリックオアトリーターの準備ができました:

すべてが素晴らしく機能し、一晩中虐待に耐えました。

<図>

<図>

<図>

ビルドログの詳細については、... http://www.therpf.com/showthread.php?t =195101にアクセスしてください。そこで、作成時にすべてのステップを詳しく説明しました。

コード

  • サーボ
  • 効果音
サーボ Arduino
このコードは、6つのサーボモーターすべてを制御するArduinounoにロードされます。基本的には、MP3シールドから3つの信号のいずれかを受信するのを待ちます。信号を受信すると、サーボArduinoUnoが対応するサーボ動作を実行します。
 / **************************** Targus-操作-サーボ***************************** // ******メモ******* // /デジタルピン0と1は通常、コンピューターからArduinoをアップロードおよび監視する際のシリアル通信に使用されます。//デジタルピン0と1は、Arduinoがコンピューターに接続されていない場合、サーボに使用できます。//デジタルピン0の場合および1はサーボに使用されており、「シリアル」で始まる行をコメントアウトします。 //このArduinoは5V信号を受信するため、他のArduinoの前にこのArduinoの電源がオンになっていることを確認してください。//このArduinoのGNDワイヤが他のArduinoのGNDに接続されていることを確認してください。/**** *****インクルード********** /#include  / **********変数*********** / Servoservo5;サーボサーボ6;サーボサーボ7;サーボサーボ8;サーボサーボ9;サーボサーボ10;サーボサーボ11; intピン2 =2; intピン3 =3; intピン4 =4; / ************** ** Arduino Setup *************** / void setup(){Serial.begin(9600); //開発とトラブルシューティングのためにシリアル通信を有効にしますSerial.println( "Targus --Operation --Servos \ n"); / *****************************************サーボを接続し、初期位置を設定します** **************************************** /servo5.attach(5); //デジタルピン5servo5.write(90); // 90度に移動servo6.attach(6); //デジタルピン6servo6.write(90); Servo7.attach(7); //デジタルピン7servo7.write(90); Servo8.attach(8); //デジタルピン8servo8.write(90); Servo9.attach(9); //デジタルピン9servo9.write(80); Servo10.attach(10); //デジタルピン10servo10.write(90); Servo11.attach(11); //デジタルピン11servo11.write(80); / *************************デジタル入力ピンのセットアップ******************** ****** ///効果音付きのArduinoがいつサーボをアクティブにするかを教えてくれるように入力ピンを設定します。 pinMode(pin2、INPUT_PULLUP); pinMode(pin3、INPUT_PULLUP); pinMode(pin4、INPUT_PULLUP);} / ************* Arduino Loop ************** / void loop(){if(digitalRead(pin2) ==HIGH){zap2(); } else if(digitalRead(pin3)==HIGH){zap3(); } else if(digitalRead(pin4)==HIGH){zap4(); } delay(300);} / **********関数*********** / int moveServo(Servo&servo、intdegreeStart、intdegreeEnd、unsigned long timeEnd、unsigned long timeStart 、float(* easing)(float)、unsigned long timeNow){//実行する作業がまだある場合、この関数は数値1を返しますtimeEnd + =timeStart; //終了時間に遅延を追加しますif(timeNow  timeEnd){//サーボ移動フェーズが完了しました。何もしませんが0を返します。 } //ここまで進んだら、サーボフロートを移動する準備をします。percentToMove=float(timeNow --timeStart)/ float(timeEnd --timeStart);パーセントToMove =easing(percentToMove); // SG-92Rの場合、次数の範囲を0〜180からマイクロ秒の範囲500〜2400にマップしますhttp://www.servodatabase.com/servo/towerpro/sg92rdegreeStart =map(degreeStart、0、180、500、2400); degreeEnd =map(degreeEnd、0、180、500、2400); floatservoTo =0; if(degreeEnd> degreeStart){//反時計回りに回転servoTo =((degreeEnd-degreeStart)* percentToMove)+ degreeStart; } else {//時計回りに回転percentToMove =1-percentToMove; //パーセントを逆にして、0.8のような値が0.2になるようにしますservoTo =((degreeStart-degreeEnd)* percentToMove)+ degreeEnd; } servo.writeMicroseconds(servoTo); // Serial.print( "マップ先:"); Serial.println(servoTo); // Serial.print( "degreeStart:"); Serial.println(degreeStart); // Serial.print( "degreeEnd:"); Serial.println(degreeEnd); // Serial.print( "timeEnd:"); Serial.println(timeEnd); // Serial.print( "timeStart:"); Serial.println(timeStart); // Serial.print( "timeNow:"); Serial.println(timeNow); // Serial.print( "percentToMove:"); Serial.println(percentToMove); // Serial.print( "servoTo:"); Serial.println(servoTo); // Serial.print( "\ n"); return 1;} / ******************関数:イージング******************* ///イージング関数https://github.com/warrenm/AHEasing/blob/master/AHEasing/easing.cからhttp://easings.net/に一致するように名前が変更され、プレビューが簡単になりました。floateaseInBack(float pos){//オーバーシュート後にモデル化キュービックy =x ^ 3-x * sin(x * pi)return pos * pos * pos --pos * sin(pos * M_PI);} float easeOutBack(float pos){//オーバーシュートしたキュービックy =1-( (1-x)^ 3-(1-x)* sin((1-x)* pi))float f =(1-pos); return 1-(f * f * f --f * sin(f * M_PI));} float easeInOutBack(float pos){//区分的オーバーシュート3次関数をモデルにしています:// y =(1/2)*(( 2x)^ 3-(2x)* sin(2 * x * pi)); [0、0.5)// y =(1/2)*(1-((1-x)^ 3-(1-x)* sin((1-x)* pi))+ 1); [0.5、1] if(pos <0.5){float f =2 * pos; 0.5 *(f * f * f --f * sin(f * M_PI));を返します。 } else {float f =(1-(2 * pos --1)); 0.5 *(1-(f * f * f --f * sin(f * M_PI)))+ 0.5を返します。 }} float easeInBounce(float pos){return 1 --easeOutBounce(1- pos);} float easeOutBounce(float pos){if(pos <4 / 11.0){return(121 * pos * pos)/ 16.0; } else if(pos <8 / 11.0){return(363 / 40.0 * pos * pos)-(99 / 10.0 * pos)+ 17 / 5.0; } else if(pos <9 / 10.0){return(4356 / 361.0 * pos * pos)-(35442 / 1805.0 * pos)+ 16061 / 1805.0; } else {return(54 / 5.0 * pos * pos)-(513 / 25.0 * pos)+ 268 / 25.0; }} float easeInOutBounce(float pos){if(pos <0.5){return 0.5 * easeInBounce(pos * 2); } else {return 0.5 * easeOutBounce(pos * 2 --1)+ 0.5; }} float easeInCirc(float pos){//単位円のシフトされた象限IVをモデルにしたreturn 1 --sqrt(1-(pos * pos));} float easeOutCirc(float pos){//ユニットのシフトされた象限IIをモデルにしたcircle return sqrt((2-pos)* pos);} float easeInOutCirc(float pos){//ピースワイズ循環関数をモデルにした// y =(1/2)(1-sqrt(1-4x ^ 2)); [0、0.5)// y =(1/2)(sqrt(-(2x-3)*(2x-1))+ 1); [0.5、1] if(pos <0.5){return 0.5 *(1-sqrt(1-4 *(pos * pos))); } else {return 0.5 *(sqrt(-((2 * pos)-3)*((2 * pos)-1))+ 1); }} float easeInCubic(float pos){//立方体y =x ^ 3をモデルにしたreturnpos * pos * pos;} float easeOutCubic(float pos){//立方体y =(x --1)^ 3をモデルにした+1フロートf =(pos --1); return f * f * f + 1;} float easeInOutCubic(float pos){//区分的立方体をモデルにした// y =(1/2)((2x)^ 3); [0、0.5)// y =(1/2)((2x-2)^ 3 + 2); [0.5、1] if(pos <0.5){return 4 * pos * pos * pos; } else {float f =((2 * pos)-2); 0.5 * f * f * f +1を返します。 }} float easeInElastic(float pos){//減衰正弦波をモデルにしたy =sin(13pi / 2 * x)* pow(2、10 *(x --1))return sin(13 * M_PI_2 * pos)* pow(2、10 *(pos --1));} float easeOutElastic(float pos){//減衰正弦波をモデルにしたy =sin(-13pi / 2 *(x + 1))* pow(2、- 10x)+ 1 return sin(-13 * M_PI_2 *(pos + 1))* pow(2、-10 * pos)+ 1;} float easeInOutElastic(float pos){//部分的に指数関数的に減衰した正弦波をモデルにした:// y =(1/2)* sin(13pi / 2 *(2 * x))* pow(2、10 *((2 * x)-1)); [0,0.5)// y =(1/2)*(sin(-13pi / 2 *((2x-1)+1))* pow(2、-10(2 * x-1))+ 2 ); [0.5、1] if(pos <0.5){return 0.5 * sin(13 * M_PI_2 *(2 * pos))* pow(2、10 *((2 * pos)-1)); } else {return 0.5 *(sin(-13 * M_PI_2 *((2 * pos-1)+ 1))* pow(2、-10 *(2 * pos-1))+ 2); }} float easeInExpo(float pos){//指数関数y =2 ^(10(x --1))をモデルにしたreturn(pos ==0.0)? pos:pow(2、10 *(pos --1));} float easeOutExpo(float pos){//指数関数y =-2 ^(-10x)+ 1 return(pos ==1.0)をモデルにしていますか? pos:1 --pow(2、-10 * pos);} float easeInOutExpo(float pos){//区分的指数に基づいてモデル化// y =(1/2)2 ^(10(2x --1)); [0,0.5)// y =-(1/2)* 2 ^(-10(2x --1)))+ 1; [0.5,1] if(pos ==0.0 || pos ==1.0)return pos; if(pos <0.5){return 0.5 * pow(2、(20 * pos)-10); } else {return -0.5 * pow(2、(-20 * pos)+ 10)+ 1; }} float linear(float pos){return pos;} float easeInQuad(float pos){//放物線に基づいてモデル化y =x ^ 2 return pos * pos;} float easeOutQuad(float pos){//放物線に基づいてモデル化y =-x ^ 2 + 2x return-(pos *(pos --2));} float easeInOutQuad(float pos){//ピースワイズ2次をモデル化// y =(1/2)((2x)^ 2 ); [0、0.5)// y =-(1/2)((2x-1)*(2x-3)-1); [0.5、1] if(pos <0.5){return 2 * pos * pos; } else {return(-2 * pos * pos)+(4 * pos)-1; }} float easeInQuart(float pos){//四次方程式に基づいてモデル化x ^ 4 return pos * pos * pos * pos;} float easeOutQuart(float pos){//四次方程式に基づいてモデル化y =1-(x --1) ^ 4 float f =(pos --1); return f * f * f *(1-pos)+ 1;} float easeInOutQuart(float pos){//区分的四次関数をモデルにした// y =(1/2)((2x)^ 4); [0、0.5)// y =-(1/2)((2x-2)^ 4-2); [0.5、1] if(pos <0.5){return 8 * pos * pos * pos * pos; } else {float f =(pos --1); -8 * f * f * f * f +1を返します。 }} float easeInQuint(float pos){// 5次y =x ^ 5をモデルにしたreturnpos * pos * pos * pos * pos;} float easeOutQuint(float pos){// 5次y =(x- 1)^ 5 + 1 float f =(pos-1); return f * f * f * f * f + 1;} float easeInOutQuint(float pos){//区分的5次関数をモデルにした// y =(1/2)((2x)^ 5); [0、0.5)// y =(1/2)((2x-2)^ 5 + 2); [0.5、1] if(pos <0.5){return 16 * pos * pos * pos * pos * pos; } else {float f =((2 * pos)-2); 0.5 * f * f * f * f * f +1を返します。 }} float easeInSine(float pos){//正弦波の1/4サイクルをモデル化return sin((pos --1)* M_PI_2)+ 1;} float easeOutSine(float pos){//正弦波の1/4サイクルをモデル化wave(異なる位相)return sin(pos * M_PI_2);} float easeInOutSine(float pos){//半正弦波をモデルにしたreturn 0.5 *(1-cos(pos * M_PI));} / ****** *********関数:Zap **************** // ****** Zap 2 ******* / void zap2() {Serial.println( "ZAP 2が呼び出されました!"); // Bone unsigned long timeStart =millis(); int todo; do {unsigned long timeNow =millis()-timeStart; todo =0; // Mレッグキック// todo + =moveServo(servo5、90、50、100、0、easeInOutCubic、timeNow); // 0秒の遅延後にservo5を90度から180度に1秒間移動します// todo + =moveServo(servo5、50、90、500、500、easeOutBounce、timeNow); //サーボ5を180度から90度に1秒間移動し、1秒遅れます// M頭を左右に動かしますtodo + =moveServo(servo7、90、110、500,0、easeInOutCubic、timeNow); //サーボ7を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo7、110、70、500、500、easeInOutCubic、timeNow); //サーボ7を180度から90度に1秒間移動します。todo+ =moveServo(servo7、70、110、500、1000、easeInOutCubic、timeNow); todo + =moveServo(servo7、110、70、500、1500、easeInOutCubic、timeNow); todo + =moveServo(servo7、70、110、500、2000、easeInOutCubic、timeNow); todo + =moveServo(servo7、110、70、500、2500、easeInOutCubic、timeNow); todo + =moveServo(servo7、70、90、500、3000、easeInOutCubic、timeNow); // M左腕を上下にtodo + =moveServo(servo8、90、170、1000、0、easeInOutCubic、timeNow); //サーボ8を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo8、170、90、1000、4000、easeOutBounce、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます// M右腕を上下に動かしますtodo + =moveServo(servo6、90、130、1000、1500、easeInOutCubic、timeNow); // 0秒の遅延の後、servo8を90度から180度に1秒間移動しますtodo + =moveServo(servo6、130、90、1000、5000、easeOutBounce、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます// S頭を左右に動かしますtodo + =moveServo(servo10、90、40、1000、500、easeInOutCubic、timeNow); //サーボ7を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo10、40、105、1000、2000、easeInOutCubic、timeNow); //サーボ7を180度から90度に1秒間移動します。todo+ =moveServo(servo10、105、90、1000、6000、easeInOutCubic、timeNow); //左腕を上下に動かします+ =moveServo(servo11、80、160、1000、2000、easeInOutCubic、timeNow); //サーボ8を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo11、160、80、1000、5000、easeInOutCubic、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます//右腕を上下に動かしますtodo + =moveServo(servo9、80、20、1000、1000、easeInOutCubic、timeNow); // 0秒の遅延の後、servo8を90度から180度に1秒間移動しますtodo + =moveServo(servo9、20、80、1000、2000、easeInOutCubic、timeNow); // 1秒の遅延delay(20)の後、servo8を180度から90度に1秒間移動します。 } while(todo> 0);} / ****** Zap 3 ******* / void zap3(){Serial.println( "ZAP 3 called!"); unsigned long timeStart =millis(); int todo; do {unsigned long timeNow =millis()-timeStart; todo =0; // M頭を左右にtodo + =moveServo(servo7、90、130、1000、0、easeInOutCubic、timeNow); // 0秒の遅延の後、servo7を90度から180度に1秒間移動しますtodo + =moveServo(servo7、130、90、1000、5000、easeInOutCubic、timeNow); //サーボ7を180度から90度に1秒間移動し、1秒遅れます// M左腕を上下に動かしますtodo + =moveServo(servo8、90、170、1000、0、easeInOutCubic、timeNow); //サーボ8を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo8、170、90、1000、4000、easeOutBounce、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます// M右腕を上下に動かしますtodo + =moveServo(servo6、90、130、1000、1500、easeInOutCubic、timeNow); // 0秒の遅延の後、servo8を90度から180度に1秒間移動しますtodo + =moveServo(servo6、130、90、1000、5000、easeOutBounce、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます// S頭を左右に動かしますtodo + =moveServo(servo10、90、40、1000、500、easeInOutCubic、timeNow); //サーボ7を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo10、40、105、1000、2000、easeInOutCubic、timeNow); //サーボ7を180度から90度に1秒間移動します。todo+ =moveServo(servo10、105、90、1000、6000、easeInOutCubic、timeNow); //左腕を上下に移動するtodo + =moveServo(servo11、80、160、1000、0、easeInOutCubic、timeNow); //サーボ8を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo11、160、80、1000、5000、easeInOutCubic、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます//右腕を上下に動かしますtodo + =moveServo(servo9、80、20、1000、1000、easeInOutCubic、timeNow); // 0秒の遅延の後、servo8を90度から180度に1秒間移動しますtodo + =moveServo(servo9、20、80、1000、6000、easeInOutCubic、timeNow); // 1秒の遅延delay(10)の後、servo8を180度から90度に1秒間移動します。 } while(todo> 0);} / ****** Zap 4 ******* / void zap4(){Serial.println( "ZAP 4 called!"); unsigned long timeStart =millis(); int todo; do {unsigned long timeNow =millis()-timeStart; todo =0; // M頭を左右にtodo + =moveServo(servo7、90、130、1000、0、easeInOutCubic、timeNow); // 0秒の遅延の後、servo7を90度から180度に1秒間移動しますtodo + =moveServo(servo7、130、90、1000、5000、easeInOutCubic、timeNow); //サーボ7を180度から90度に1秒間移動し、1秒遅れます// M左腕を上下に動かしますtodo + =moveServo(servo8、90、170、1000、0、easeInOutCubic、timeNow); //サーボ8を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo8、170、90、1000、4000、easeOutBounce、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます// M右腕を上下に動かしますtodo + =moveServo(servo6、90、130、1000、1500、easeInOutCubic、timeNow); // 0秒の遅延の後、servo8を90度から180度に1秒間移動しますtodo + =moveServo(servo6、130、90、1000、5000、easeOutBounce、timeNow); //サーボ8を180度から90度に1秒間移動し、1秒遅れます// S頭を左右に動かしますtodo + =moveServo(servo10、90、40、1000、500、easeInOutCubic、timeNow); //サーボ7を90度から180度に0秒の遅延後に1秒間移動しますtodo + =moveServo(servo10、40、105、1000、2000、easeInOutCubic、timeNow); //サーボ7を180度から90度に1秒間移動します。todo+ =moveServo(servo10、105、90、1000、6000、easeInOutCubic、timeNow); //左腕を上下に動かします+ =moveServo(servo11、80、160、1000、2000、easeInOutCubic、timeNow); // 0秒の遅延の後、servo8を90度から180度に1秒間移動しますtodo + =moveServo(servo11、160、80、1000、5000、easeInOutCubic、timeNow); // move servo8 from 180 to 90 degrees for 1 second after a 1 second delay // S right arm up and down todo +=moveServo(servo9, 80, 20, 1000, 1000, easeInOutCubic, timeNow); // move servo8 from 90 to 180 degrees for 1 second after a 0 second delay todo +=moveServo(servo9, 20, 80, 1000, 2000, easeInOutCubic, timeNow); // move servo8 from 180 to 90 degrees for 1 second after a 1 second delay delay(10); } while (todo> 0);}
Sound EffectsArduino
This code is loaded onto the Arduino Uno with the MP3 shield mounted to it. Basically it receives a signal from one of three switches, plays the corresponding audio file and send a signal the Arduino Uno controlling the servos. Two buttons can also be mounted to it to control volume.
/*********************************** Targus - Operation - Sound Effects************************************//****** Notes*******/// Digital Pins 0 and 1 are normally used for serial commucation when uploading and monitoring an Arduino from a computer.// Digital Pins 3, 4, 6, 7, 11, 12, and 13 are used by the Adafruit Music Maker Shield.// This Arduino should be powered on after the servos Arduino since this Arduino will be sending 5V signals.// Make sure a GND wire on this Arduino is connected to GND on the other Arduino./********* Includes**********/#include #include #include /********** Variables***********/int relayPin5 =5;int relayPin8 =8;int relayPin9 =9;int pinVolDown =14; // aka Analog In 0int pinVolUp =15; // aka Analog In 1int volume =50; // this is the default volume which can be changed later by the volDown() and volUp() functions/******************************************************************** Adafruit Music Maker Shield - https://www.adafruit.com/product/1788*********************************************************************/// Adafruit Music Maker Shield Pins#define SHIELD_RESET -1 // VS1053 reset pin (unused!)#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin. See http://arduino.cc/en/Reference/attachInterrupt for more info.#define CARDCS 4 // Card chip select pin#define SHIELD_DCS 6 // VS1053 Data/command select pin (output)#define SHIELD_CS 7 // VS1053 chip select pin (output)// the most important thing on the line below is the variable 'musicPlayer' which we will use to play music laterAdafruit_VS1053_FilePlayer musicPlayer =Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);/************** Arduino Setup***************/void setup() { Serial.begin(9600); // enable serial communication for development and troubleshooting Serial.println("Targus - Operation - Sound Effects\n"); if (! musicPlayer.begin()) { // initialise the music player Serial.println(F("Couldn't find VS1053, do you have the right pins defined?")); while (1); // loop forever since we could not connect to the Adafruit Music Maker Shield } SD.begin(CARDCS); // initialise the SD card // Set volumes for the left and right channels. musicPlayer.setVolume(volume,volume); // 0-255 with 0 being crazy loud // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background audio playing musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int // Specify which GPIO pins to use for input. musicPlayer.GPIO_pinMode(2, OUTPUT); // switch for ... musicPlayer.GPIO_pinMode(3, OUTPUT); // switch for ... musicPlayer.GPIO_pinMode(4, OUTPUT); // switch for ... // Specify which digital pins we will use for volume control pinMode(pinVolDown, INPUT_PULLUP); pinMode(pinVolUp, INPUT_PULLUP); // Specify which digital pins we will use to communicate with the other Arduino (aka the Arduino with all the servos). pinMode(relayPin5, OUTPUT); pinMode(relayPin8, OUTPUT); pinMode(relayPin9, OUTPUT);}/************* Arduino Loop**************/void loop() { int gpio2 =musicPlayer.GPIO_digitalRead(2); int gpio3 =musicPlayer.GPIO_digitalRead(3); int gpio4 =musicPlayer.GPIO_digitalRead(4); int ioDown =digitalRead(pinVolDown); // volume down int ioUp =digitalRead(pinVolUp); // volume up// Serial.println(ioDown);// Serial.println(ioUp);// Serial.println(gpio2); if (gpio2 ==1) { Serial.println("GPIO 2 triggered.\n"); zap2(); } else if (gpio3 ==1) { Serial.println("GPIO 3 triggered.\n"); zap3(); } else if (gpio4 ==1) { Serial.println("GPIO 4 triggered.\n"); zap4(); } else if (ioDown ==LOW) { Serial.println("Analog 0 triggered.\n"); volDown(); } else if (ioUp ==LOW) { Serial.println("Analog 1 triggered.\n"); volUp(); } delay(2); // this delay may need to be reduced or removed depending on how responsive hitting the tongs to the side of a container feels}/********** Functions***********/void audioPlay(String file) { Serial.println("Playing " + file); musicPlayer.startPlayingFile(file.c_str()); delay(500); // wait half a second before returning so the audio can get going}void audioStop(String file) { musicPlayer.stopPlaying(); Serial.println("Done playing " + file);}void activate(int pin) { digitalWrite(pin, HIGH); delay(300); // delay as long as needed for the other Arduino to notice an event digitalWrite(pin, LOW);}void volDown() { volume =volume + 1; if (volume> 255) { volume =255; } // Set volumes for the left and right channels. musicPlayer.setVolume(volume,volume); // 0-255 with 0 being crazy loud Serial.print("Volume set to "); Serial.println(volume);}void volUp() { volume =volume - 1; if (volume <0) { volume =0; } // Set volumes for the left and right channels. musicPlayer.setVolume(volume,volume); // 0-255 with 0 being crazy loud Serial.print("Volume set to "); Serial.println(volume);}/*************** Functions:Zap****************/ /****** Zap 2 *******/ void zap2() { // Audio and Servo(s) triggered by GPIO 2 String file ="02.mp3"; // this file should exist on the SD card /*********** Play Audio ************/ audioPlay(file); /************************************* Tell other Arduino to Animate Servos **************************************/ activate(relayPin5); delay(6000); // Customize delay to match end of servo movements, go by feel vs. accurate math since this Arduino's clock may not sync with the other Arduino. /*********** Stop Audio ************/ audioStop(file); } /****** Zap 3 *******/ void zap3() { // Audio and Servo(s) triggered by GPIO 3 String file ="03.mp3"; // this file should exist on the SD card /*********** Play Audio ************/ audioPlay(file); /************************************* Tell other Arduino to Animate Servos **************************************/ activate(relayPin8); delay(6000); // Customize delay to match end of servo movements, go by feel vs. accurate math since this Arduino's clock may not sync with the other Arduino. /*********** Stop Audio ************/ audioStop(file); } /****** Zap 4 *******/ void zap4() { // Audio and Servo(s) triggered by GPIO 4 String file ="04.mp3"; // this file should exist on the SD card /*********** Play Audio ************/ audioPlay(file); /************************************* Tell other Arduino to Animate Servos **************************************/ activate(relayPin9); delay(6000); // Customize delay to match end of servo movements, go by feel vs. accurate math since this Arduino's clock may not sync with the other Arduino. /*********** Stop Audio ************/ audioStop(file); } 

カスタムパーツとエンクロージャー

3D grown Parts
CAD file on thingiverse.com

回路図

Connect GPIO 2, 3, 4 of the MP3 shield to the aluminum Plates.
Connect 3v of the MP3 shield to the tongs.
Connect pins 5, 8, 9 of the MP3 shiled to pins 2, 3, 4 of the servo Arduino.
Connect pins 6, 7, 8, 9, 10, 11 of the servo Arduino to the servos.
Wire the positive and negative of the servos to a 5v plug.
Wire the graounds of both the servo Arduino and the MP3 shield to the 5v plug.
Wire up both speaker inputs. These are the scaled and dimensioned drawings I used to construct the megafigs.

製造プロセス

  1. Arduinoを使用してモニターをAmbilightにする
  2. ArduinoPongゲーム-OLEDディスプレイ
  3. Arduinoゲームコントローラー
  4. 自動レゴシューター
  5. Arduinoタッチブレイクアウトゲーム
  6. 可聴周波数検出器
  7. Arduinoたまごっちクローン-デジタルペット
  8. ワイヤレスライトスイッチマニピュレーター
  9. Tech-TicTacToe
  10. モーションセンサー水鉄砲
  11. Arduinoカウントダウンタイマー