Things used in this project

Hardware components:
Swel30ysinrlyiqmmnfr
Arduino MKRZero
×1
Medium breadboard
×1
Jumper Wires
×1
Diode
×1
Mosfet N-Channel
×1
ICS43432 I2S digital microphone
×1
micro servo motor+ DC motor
×1
0.1 uF ceramic capacitor
×1
100 uF electrolitic capacitor
×1
2.2Kohm resistor
×1
Rubber band
×1
Software apps and online services:
Ide web
Arduino IDE
Ide web
Arduino Web Editor
Hand tools and fabrication machines:
Lasercutter
Laser cutter (generic)

Custom parts and enclosures

LaserCutterTemplates
Templates for the box.
I6neCvVZL9MBbADnderV.rar

Schematics

Circuit Diagram
Fevtlljfzypwrliv8wul

Code

MKRZero_MakeItRainMachineC/C++
/*
  Make-it-Rain Machine

  Create a small machine that throws paper (notes) when clapping.
  This sketch uses the new ArduinoSound library to communicate
  with the I2S microphone. The microphone is used to detect
  the clappings.

  This example code is in the public domain.

  Parts required:
  1 Mkrzero board (or compatible)
  1 ICS43432 I2S Digital MicrophoneS
  1 Standard servo motor
  1 DC motor
  2 N-channel mosfet transistors
  2 2kohm pull up resistors
  1 0.1uF capacitor
  1 100uF capacitor

  Link for the laser cut parts in the project hub
  tutorial page.

  created by
  E.Lopez <e.lopez@arduino.cc>
  T.Pham  <t.pham@arduino.cc>
  1 Dec 2016
*/

#include <ArduinoSound.h>
#include <Servo.h>

AmplitudeAnalyzer amplitudeAnalyzer;

const int amplitudeDeltaThreshold = 100000000;
const int ledPin = LED_BUILTIN;
//pin for the DC motor
const int dcMotor = 7;
Servo myservo;
int lastAmplitude = 0;

/**********
   SETUP
 *********/
void setup() {
  Serial.begin(9600);

  myservo.attach(6);

  pinMode(ledPin, OUTPUT);
  pinMode(dcMotor, OUTPUT);

  analogWrite(dcMotor, 0);
  myservo.write(5);

  if (!AudioInI2S.begin(44100, 32)) {
    Serial.println("Failed to initialize I2S input!");
    while (1); // do nothing
  }

  // configure the I2S input as the input for the amplitude analyzer
  if (!amplitudeAnalyzer.input(AudioInI2S)) {
    Serial.println("Failed to set amplitude analyzer input!");
    while (1); // do nothing
  }
}

/**********
   LOOP
 *********/
void loop() {
  if (amplitudeAnalyzer.available()) {
    int amplitude = amplitudeAnalyzer.read();
    int delta = amplitude - lastAmplitude;

    //check for clappings
    if (delta > amplitudeDeltaThreshold) {
      Serial.println("clap detected");

      digitalWrite(ledPin, !digitalRead(ledPin));

      //turn on DC motor at a reduced speed.
      analogWrite(dcMotor, 125);
      delay(250);
      //Activate servo tu push the paper up.
      myservo.write(95);

      delay(1000);

      //Turn off the motor and reposition servo
      analogWrite(dcMotor, 0);
      myservo.write(6);
    }

    lastAmplitude = amplitude;
  }
}

Credits

Replications

Did you replicate this project? Share it!

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Robotics LED Strip
Intermediate
  • 107
  • 3

Full instructions

Use an LED strip with a custom Arduino Nano controller to control a strip of WS812 LEDs.

16x2 LCD backpack with enclosure for the Onion Omega
Intermediate
  • 546
  • 7

Work in progress

This is a 3D printable backpack module using ATmega328 that includes an enclosure for all the components. It allows the LCD to be online.

Arduino Bluetooth Interfacing
Intermediate
  • 1,362
  • 17

Full instructions

Bluetooth LED - A simple tutorial on Bluetooth basics.

Spideruino
Intermediate
  • 3,241
  • 25

A Lego arachnid controlled by your smartphone.

Arduino Traffic light controller
Intermediate
  • 657
  • 10

Protip

Green yellow red LED controller using arduino

Arduino alarm system
Intermediate
  • 826
  • 12

Protip

A simple alarm system using arduino

ProjectsCommunitiesContestsLiveJobsBetaFree StoreBlogAdd projectSign up / Login
Respect project