산업 제조
산업용 사물 인터넷 | 산업자재 | 장비 유지 보수 및 수리 | 산업 프로그래밍 |
home  MfgRobots >> 산업 제조 >  >> Manufacturing Technology >> 제조공정

Giant Animatronics Lego Minfig Operation Game

구성품 및 소모품

Arduino UNO
× 2
Adafruit Arduino MP3 실드
× 1
MG90S 기어 마이크로 서보
× 6
스피커:3W, 4옴
× 2
OpenBuilds 볼 베어링 – 688Z 8x16x5
× 12

필요한 도구 및 기계

Lulzbot Taz 5 FDM 프린터
X-Carve CNC

이 프로젝트 정보

이 프로젝트는 4단계로 완료되었습니다. 전자 장치가 포함되지 않은 처음 3단계를 빠르게 다루고 Frank를 운영 게임으로 전환하고 오디오 및 애니마트로닉스를 추가한 4단계에 대해 자세히 설명하겠습니다.

1단계:메가피그 만들기

나는 손을 만드는 것으로 시작했다. 나는 이것이 초기 빌드에서 가장 어려운 부분이 될 것이라고 생각했고 제작에 필요한 나머지 부품의 규모를 정의했습니다. 핸드는 PVC 파이프와 유리 섬유 수지로 제작되어 내부 핸드와 외부 핸드 사이의 공간을 채웠습니다.

헤드 제작은 그 다음이었다. PVC 파이프(헤드의 주요 부분을 위한 대형 파이프 피팅), MDF 및 상단 너브의 빈 공간을 채우기 위해 수지로 만들어집니다.

메가피그의 몸체는 MDF로 만들어졌으며 꽤 직관적인 박스 빌드입니다. PVC 피팅은 부속지와 몸통 사이의 조인트로 사용됩니다.

다리는 MDF와 PVC로 만들어 상단 다리 곡선을 정의합니다.

팔(가장 어려운 부분이 되었음)은 PVC 파이프로 적군 팔뚝과 MDF로 거칠게 다듬었습니다. 플로럴 폼을 공간 충전재로 사용했습니다. Bondo는 상완 모양을 만드는 데 사용되었으며 수많은 샌딩 및 충전 작업을 통해 최종 모양이 완성되었습니다.

팔과 손은 Smoothcast 300으로 성형 및 주조되었습니다.

모든 것은 Monster Hunters Lego 키트를 기반으로 그렸습니다.

2단계:머리카락

이 단계는 과학자들의 머리카락을 제작하는 것으로 구성되었습니다. 띠톱을 사용하여 도구 폼을 털 위스프의 기본 모양으로 자릅니다. 머리카락 조각의 여러 부분을 에폭시로 접착했습니다.

머리카락 전체를 스무스캐스트 300으로 덮어 거품 위에 플라스틱 껍질을 만들었습니다. 그런 다음 사포질하고 채웠습니다.

머리카락 부분 사이의 모든 솔기를 채우기 위해 에폭시 조각을 사용했습니다.

프라이밍과 도색을 했습니다.

3단계:프랭크의 침대

세 번째 단계는 Crazy Scientist와 그의 Monster Lego 키트를 기반으로 Frank의 침대를 만드는 것이었습니다. MDF와 너브용 PVC 파이프로 만든 심플한 박스 빌드입니다.

모서리 디테일은 MDF 디스크를 끼워 넣은 PVC 파이프로 만들었습니다.

모든 것을 사포질하고 프라이밍하고 도색했습니다.

4단계:작전 게임 및 모션

이 프로젝트의 마지막 부분(현재까지)은 Frank를 운영 게임으로 변환하고 Megafigs에 오디오와 모션을 모두 추가하는 것입니다. 일이 어떻게 일어났는지(모든 것이 동시에 작업 중이었음) 순서대로 진행하는 대신 빌드의 각 본체 부분에 대해 자세히 설명하겠습니다.

몸통 :

몸통에는 2개의 롤러 스케이트 베어링을 고정하는 조인트에 3D 인쇄된 브래킷이 추가되었습니다. 팔과 머리의 중심점 역할을 합니다.

Frank의 상체에는 3D 프린팅된 2개의 캔디 접시가 있었고, 위에는 밀링된 알루미늄 립이 깔려 있었고, 새로운 몸통 판으로 덮여 있었습니다. 알루미늄 립은 조작 게임의 스위치 역할을 합니다. MP3 실드에 연결된 집게가 알루미늄에 닿으면 회로가 완성되어 프로그램이 활성화됩니다.

머리 :

두 머리는 스피커를 이동하고 고정하도록 수정되었습니다. 먼저 액슬 역할을 하는 5/16 볼트를 고정하기 위해 3D 인쇄된 브래킷이 목에 추가되었습니다.

구멍이 뚫린 금속은 스피커 그릴의 구멍을 매핑하기 위한 가이드로 사용되었습니다. 나는 이 과정에서 가장 긴장했다. 어떤 실수라도 얼굴에 페인트 칠을 망칠 것입니다. 구멍은 주변 색상과 일치하도록 도색되었습니다.

스피커를 스피커 그릴 뒤에 고정하기 위해 3D 인쇄 브래킷이 만들어졌습니다.

다리 :

새로운 다리는 뼈 모양의 사탕 접시와 함께 두 개의 반으로 3D 인쇄되었습니다. 알루미늄 판은 몸통처럼 밀링되었습니다. 다리를 함께 접착하고, 사포질하고, 본도를 사용하여 매끄럽게 만들고 페인트를 칠했습니다.

무기 :

팔의 원래 마스터는 액슬에 대해 5/16 굵게 표시된 3D 인쇄 브래킷을 허용하도록 수정되었습니다. 그런 다음 다시 성형하고, 주조하고, 청소하고, 도색했습니다.

서보:

서보는 3D 프린팅된 브래킷을 사용하여 설치되었으며 와이어와 5/16 볼트에 부착된 알루미늄 혼을 통해 부속 장치에 연결되었습니다. 팔을 들어올리는 데 도움이 되도록 나중에 스프링이 추가되었습니다.

전자제품 :

모든 전자 장치는 프로토타입 테스트 베드를 만들기 위해 MDF 조각에 장착되었습니다. 이 설정을 통해 나와 Daniel은 프로그래밍, 주간 작업 및 결함을 해결할 수 있었습니다. 모든 것이 잘 작동했습니다.

전자 장치가 작동하는 방식은

1:MP3 실드는 3개의 입력 중 1개를 기다립니다(집게를 알루미늄 플레이트 중 하나에 연결)

2:알루미늄 플레이트가 활성화되면 MP3 실드가 해당 MP3 파일을 재생하고 서보 Arduino에 신호를 보냅니다.

3:서보 arduino가 MP3 쉴드에서 신호를 받으면 서보에 해당하는 코드를 실행합니다.

두 arduino 모두 Frank의 침대 밑면에 장착되었고 모든 것이 다시 배선되었습니다.

Trick or Treaters를 위한 준비 :

모든 것이 환상적으로 작동하며 밤새도록 학대를 당했습니다.

자세한 빌드 로그를 보려면 ... http://www.therpf.com/showthread.php?t=195101을 방문하십시오. 여기에서 제작할 때마다 모든 단계를 자세히 설명했습니다.

<섹션 클래스="섹션 컨테이너 섹션 축소 가능" id="코드">

코드

<울>
  • 서보
  • 음향 효과
  • 서보Arduino
    이 코드는 6개의 서보 모터를 모두 제어하는 ​​Arduino uno에 로드됩니다. 기본적으로 MP3 실드에서 3개의 신호 중 하나를 수신하기를 기다립니다. 신호가 수신되면 서보 Arduino Uno는 해당 서보 동작을 실행합니다.
    /**************************** Targus - 작동 - 서보********************************//****** 참고*******// / 디지털 핀 0과 1은 일반적으로 컴퓨터에서 Arduino를 업로드 및 모니터링할 때 직렬 통신에 사용됩니다. // 디지털 핀 0과 1은 Arduino가 컴퓨터에 연결되지 않은 경우 서보에 사용할 수 있습니다.// 디지털 핀 0인 경우 및 1은 서보에 사용 중입니다. 'Serial'로 시작하는 줄은 주석 처리하십시오. 이 파일에서.// 이 Arduino가 5V 신호를 수신할 것이기 때문에 이 Arduino가 다른 Arduino보다 먼저 켜져 있는지 확인하십시오.// 이 Arduino의 GND 와이어가 다른 Arduino의 GND에 연결되어 있는지 확인하십시오./**** ***** 포함**********/#include /********** 변수**************/서보 서보5;서보 서보6;서보 서보7;서보 서보8;서보 서보9;서보 서보10;서보 서보11;int pin2 =2;int pin3 =3;int pin4 =4;/**************** Arduino 설정***************/void setup() { Serial.begin(9600); // 개발 및 문제 해결을 위해 직렬 통신을 활성화합니다. Serial.println("Targus - Operation - Servos\n"); /******************************************** 서보 연결 및 초기 위치 설정 ** ****************************************/servo5.attach(5); // 디지털 핀 5 서보5.write(90); // 90도로 이동합니다.servo6.attach(6); // 디지털 핀 6 서보6.write(90); 서보7.attach(7); // 디지털 핀 7 서보7.write(90); 서보8.부착(8); // 디지털 8번 핀 서보8.write(90); 서보9.attach(9); // 디지털 9번 핀 서보9.write(80); 서보10.부착(10); // 디지털 핀 10 서보10.write(90); 서보11.부착(11); // 디지털 핀 11 서보11.write(80); /**************************** 디지털 입력 핀 설정 ***************** ******/ // 음향 효과가 있는 Arduino가 서보를 활성화할 시기를 알려줄 수 있도록 입력 핀을 설정합니다. 핀모드(핀2, INPUT_PULLUP); 핀모드(핀3, INPUT_PULLUP); pinMode(pin4, INPUT_PULLUP);}/**************** Arduino Loop****************/void loop() { if (digitalRead(pin2) ==높음) { zap2(); } else if (digitalRead(pin3) ==HIGH) { zap3(); } else if (digitalRead(pin4) ==HIGH) { zap4(); } delay(300);}/********** 함수**************/int moveServo(Servo &servo, int degreeStart, int degreeEnd, unsigned long timeEnd, unsigned long timeStart , float (*easing)(float), unsigned long timeNow) { // 이 함수는 아직 수행해야 할 작업이 있는 경우 숫자 1을 반환합니다. timeEnd +=timeStart; // 종료 시간에 지연 추가 if (timeNow  timeEnd) { // 서보 이동 단계 완료, 아무것도 하지 않음 return 0; } // 여기까지 왔다면 서보를 움직일 준비를 합니다. float percentToMove =float(timeNow - timeStart) / float(timeEnd - timeStart); 퍼센트 이동 =여유(percentToMove); // SG-92R의 경우 각도 범위 0-180을 마이크로초 범위 500-2400에 매핑합니다. http://www.servodatabase.com/servo/towerpro/sg92r degreeStart =map(degreeStart, 0, 180, 500, 2400); 학위종료 =지도(도종료, 0, 180, 500, 2400); 플로트 서보To =0; if (degreeEnd> degreeStart) { // 시계 반대 방향으로 회전합니다. servoTo =((degreeEnd - degreeStart) * percentToMove) + degreeStart; } else { // 시계 방향으로 회전 percentToMove =1 - percentToMove; // 0.8과 같은 값이 0.2가 되도록 퍼센트를 반전시킵니다. servoTo =((degreeStart - degreeEnd) * percentToMove) + degreeEnd; } 서보.writeMicroseconds(servoTo); // Serial.print("매핑 대상:"); Serial.println(servoTo); // Serial.print("도 시작:"); Serial.println(도 시작); // Serial.print("degreeEnd:"); Serial.println(degreeEnd); // Serial.print("timeEnd:"); Serial.println(시간 종료); // 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/과 일치하도록 이름이 변경되었습니다.float easyInBack(float pos) { // 오버슈팅 후 모델링 3차 y =x^3-x*sin(x*pi) return pos * pos * pos - pos * sin(pos * M_PI);}float easyOutBack(float pos) { // 3차 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 easyInOutBack(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 * 위치 - 1)); 반환 0.5 * (1 - (f * f * f - f * sin(f * M_PI))) + 0.5; }}float easyInBounce(float pos) { return 1 - easyOutBounce(1 - pos);}float easyOutBounce(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 { 반환 (54 / 5.0 * 위치 * 위치) - (513 / 25.0 * 위치) + 268 / 25.0; }} float easyInOutBounce(float pos) { if (pos <0.5) { return 0.5 * easyInBounce(pos * 2); } else { 0.5 반환 * easyOutBounce(pos * 2 - 1) + 0.5; }}float easyInCirc(float pos) { // 단위 원의 IV 사분면을 이동한 후 모델링합니다. return 1 - sqrt(1 - (pos * pos));}float easyOutCirc(float pos) { // 단위 원의 이동된 사분면 II를 따라 모델링 circle return sqrt((2 - pos) * pos);}float easyInOutCirc(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 easyInCubic(float pos) { // 3차 y =x^3 return pos * pos * pos;}float easyOutCubic(float pos) { // 3차 y =(x - 1)^3을 따라 모델링됨 + 1 float f =(pos - 1); return f * f * f + 1;}float easyInOutCubic(float pos) { // 조각별 3차 방정식을 따라 모델링 // 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 * 위치) - 2); 반환 0.5 * f * f * f + 1; }}float easyInElastic(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 easyOutElastic(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 easyInOutElastic(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 easyInExpo(float pos) { // 지수 함수 y =2^(10(x - 1)) return (pos ==0.0) ? pos :pow(2, 10 * (pos - 1));}float easyOutExpo(float pos) { // 지수 함수 y =-2^(-10x) + 1 return (pos ==1.0) ? pos :1 - pow(2, -10 * pos);}float easyInOutExpo(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 easyInQuad(float pos) { // 포물선을 따라 모델링됨 y =x^2 return pos * pos;}float easyOutQuad(float pos) { // 포물선을 따라 모델링됨 y =-x^2 + 2x return -(pos * (pos - 2));}float easyInOutQuad(float pos) { // 조각별 이차방정식을 따라 모델링 // 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 { 반환(-2 * 위치 * 위치) + (4 * 위치) - 1; }}float easyInQuart(float pos) { // 4차 x^4 return pos * pos * pos * pos;}float easyOutQuart(float pos) { // 4차 y =1 - (x - 1) 이후 모델링 ^4 float f =(pos - 1); return f * f * f * (1 - pos) + 1;}float easyInOutQuart(float pos) { // 조각별 4차 식을 따라 모델링됨 // 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 easyInQuint(float pos) { // 5차 y =x^5 return pos * pos * pos * pos * pos;}float easyOutQuint(float pos) { // 5차 y =(x - 1)^5 + 1 float f =(pos - 1); return f * f * f * f * f + 1;}float easyInOutQuint(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 * 위치) - 2); 반환 0.5 * f * f * f * f * f + 1; }}float easyInSine(float pos) { // 사인파의 1/4 주기를 따라 모델링됨 return sin((pos - 1) * M_PI_2) + 1;}float easyOutSine(float pos) { // 사인의 1/4 주기를 따라 모델링 웨이브(다른 위상) return sin(pos * M_PI_2);}float easyInOutSine(float pos) { // 반 사인파 return 0.5 * (1 - cos(pos * M_PI));}/****** ********* 함수:Zap****************//****** Zap 2*******/void zap2() { Serial.println("ZAP 2가 호출되었습니다!"); //Bone unsigned long timeStart =millis(); 인트 할 일; do { unsigned long timeNow =millis() - timeStart; 할 일 =0; // M 레그 킥 //todo +=moveServo(servo5, 90, 50, 100, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보5를 90도에서 180도로 이동 // todo +=moveServo(servo5, 50, 90, 500, 500, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보5를 180도에서 90도 이동 // M 머리 좌우 todo +=moveServo(servo7, 90, 110, 500,0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보7을 90도에서 180도 이동 todo +=moveServo(servo7, 110, 70, 500, 500, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보7을 180도에서 90도 이동 todo +=moveServo(servo7, 70, 110, 500, 1000, easyInOutCubic, timeNow); 할 일 +=moveServo(servo7, 110, 70, 500, 1500, easyInOutCubic, timeNow); 할 일 +=moveServo(servo7, 70, 110, 500, 2000, easyInOutCubic, timeNow); 할 일 +=moveServo(servo7, 110, 70, 500, 2500, easyInOutCubic, timeNow); 할 일 +=moveServo(servo7, 70, 90, 500, 3000, easyInOutCubic, timeNow); // M 왼쪽 팔 위아래 todo +=moveServo(servo8, 90, 170, 1000, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도로 이동합니다. todo +=moveServo(servo8, 170, 90, 1000, 4000, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도 이동 // M 오른팔 위아래로 todo +=moveServo(servo6, 90, 130, 1000, 1500, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도로 이동합니다. todo +=moveServo(servo6, 130, 90, 1000, 5000, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동 // S 머리 좌우 todo +=moveServo(servo10, 90, 40, 1000, 500, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보7을 90도에서 180도 이동 todo +=moveServo(servo10, 40, 105, 1000, 2000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보7을 180도에서 90도 이동 todo +=moveServo(servo10, 105, 90, 1000, 6000, easyInOutCubic, timeNow); // S 왼팔 위아래 todo +=moveServo(servo11, 80, 160, 1000, 2000, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도 이동 todo +=moveServo(servo11, 160, 80, 1000, 5000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동 // S 오른팔 위아래 todo +=moveServo(servo9, 80, 20, 1000, 1000, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도 이동 todo +=moveServo(servo9, 20, 80, 1000, 2000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동합니다. delay(20); } while (todo> 0);}/****** Zap 3*******/void zap3() { Serial.println("ZAP 3이 호출되었습니다!"); 서명되지 않은 긴 timeStart =millis(); 인트 할 일; do { unsigned long timeNow =millis() - timeStart; 할 일 =0; // M 머리 좌우로 할 일 +=moveServo(servo7, 90, 130, 1000, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보7을 90도에서 180도 이동 todo +=moveServo(servo7, 130, 90, 1000, 5000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보7을 180도에서 90도로 이동 // M 왼쪽 팔을 위아래로 이동 todo +=moveServo(servo8, 90, 170, 1000, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도로 이동합니다. todo +=moveServo(servo8, 170, 90, 1000, 4000, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도 이동 // M 오른팔 위아래로 todo +=moveServo(servo6, 90, 130, 1000, 1500, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도로 이동합니다. todo +=moveServo(servo6, 130, 90, 1000, 5000, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동 // S 머리 좌우 todo +=moveServo(servo10, 90, 40, 1000, 500, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보7을 90도에서 180도 이동 todo +=moveServo(servo10, 40, 105, 1000, 2000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보7을 180도에서 90도 이동 todo +=moveServo(servo10, 105, 90, 1000, 6000, easyInOutCubic, timeNow); // S 왼팔 위아래 todo +=moveServo(servo11, 80, 160, 1000, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도 이동 todo +=moveServo(servo11, 160, 80, 1000, 5000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동 // S 오른팔 위아래 todo +=moveServo(servo9, 80, 20, 1000, 1000, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도 이동 todo +=moveServo(servo9, 20, 80, 1000, 6000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동합니다. delay(10); } while (todo> 0);}/****** Zap 4*******/void zap4() { Serial.println("ZAP 4가 호출되었습니다!"); 서명되지 않은 긴 timeStart =millis(); 인트 할 일; do { unsigned long timeNow =millis() - timeStart; 할 일 =0; // M 머리 좌우로 할 일 +=moveServo(servo7, 90, 130, 1000, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보7을 90도에서 180도 이동 todo +=moveServo(servo7, 130, 90, 1000, 5000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보7을 180도에서 90도로 이동 // M 왼쪽 팔을 위아래로 이동 todo +=moveServo(servo8, 90, 170, 1000, 0, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도로 이동합니다. todo +=moveServo(servo8, 170, 90, 1000, 4000, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도 이동 // M 오른팔 위아래로 todo +=moveServo(servo6, 90, 130, 1000, 1500, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도로 이동합니다. todo +=moveServo(servo6, 130, 90, 1000, 5000, easyOutBounce, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동 // S 머리 좌우 todo +=moveServo(servo10, 90, 40, 1000, 500, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보7을 90도에서 180도 이동 todo +=moveServo(servo10, 40, 105, 1000, 2000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보7을 180도에서 90도 이동 todo +=moveServo(servo10, 105, 90, 1000, 6000, easyInOutCubic, timeNow); // S 왼팔 위아래 todo +=moveServo(servo11, 80, 160, 1000, 2000, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도 이동 todo +=moveServo(servo11, 160, 80, 1000, 5000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동 // S 오른팔 위아래 todo +=moveServo(servo9, 80, 20, 1000, 1000, easyInOutCubic, timeNow); // 0초 지연 후 1초 동안 서보8을 90도에서 180도 이동 todo +=moveServo(servo9, 20, 80, 1000, 2000, easyInOutCubic, timeNow); // 1초 지연 후 1초 동안 서보8을 180도에서 90도로 이동합니다. 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. Arduino Pong 게임 - OLED 디스플레이
    3. Arduino 게임 컨트롤러
    4. 자동 레고 슈터
    5. Arduino 터치 브레이크아웃 게임
    6. 오디오 주파수 감지기
    7. Arduino Tamagotchi 클론 - 디지털 애완동물
    8. 무선 조명 스위치 조작기
    9. Tech-TicTacToe
    10. 모션 센서 물총