Introduction: Drawing Arm That's Controlled by Sound - Arduino School Project

This is my very first time working with Arduino, and working with something like this ever, so sorry if I made any mistakes! I got this idea when I thought about my hobbies, which are drawing and music. So I tried to combine the two into this! A self-drawing arm that's affected by sound.

Step 1: Step 1: Materials

- Arduino Uno

- Breadboard

- Sound detector (Sparkfun sen-12642)

- 2 (mini) Servo's

- Tie wraps / zip ties

- Some wood and paper

- something you can draw/write with

Step 2: Step 2: Setup

I first plugged in the Servo's and then the sound detector. The Sparkfun sen-12642 sound detector has 3 outputs, I only used the "envelope" output.

Servo 1 = pin ~9

Servo 2 = pin ~10

Sound detector = pin A0

The red lines(5v) are connected to the positive side on the breadboard, and the black lines(ground) are connected to the negative side.

Step 3: Step 3: Non-electronics

Make sure the servo's are steady and in the right place. I used tie wraps to steady them. After that I used tie wraps to tie the (replaceable) upper parts of the servo to the wooden arms. After that you can connect the wooden arm parts to the servo's. Connect all the wires to the Arduino and breadboard.

After that I soldered the wires to the sound detector.

Step 4: Step 4: Code

I'm in no way near being good at coding, but I tried my best and the internet helped a lot :)

#include <servo.h>
Servo myservo1; Servo myservo2; int pos = 0; int PIN_ANALOG_IN = A0;

void setup()
{ Serial.begin(9600);

// Display status Serial.println("Initialized"); myservo1.attach(9); myservo2.attach(10); }

void loop() { int value;

// Check the envelope input value = analogRead(PIN_ANALOG_IN);

// Envelope value affects the servo's Serial.println(value); if(value <= 5) { myservo1.write(random(40, 50)); myservo2.write(random(40, 55)); } else if( (value > 5) && ( value <= 10)) { myservo1.write(random(35, 55)); myservo2.write(random(35, 60)); } else if((value > 10) && (value <=20)) { myservo1.write(random(30, 60)); myservo2.write(random(30, 65)); } else if((value > 20) && (value <=30)) { myservo1.write(random(25, 65)); myservo2.write(random(25, 70)); } else if((value > 30) && (value <=60)) { myservo1.write(random(20, 70 )); myservo2.write(random(20, 80)); } else if((value > 60)) { myservo1.write(random(0, 90)); myservo2.write(random(0, 90)); }

delay(180); }