Susan

From XinCheJian
Jump to navigation Jump to search
     
Project Susan

Release status: experimental [box doku]

IMG-20121128-WA0008.jpg
Description Project Susan is a combination of highpass filters that are designed to light up based on the tone of Susans voice using 3 high pass filters
Author(s)  Paul Adams
Last Version  alpha


The sound reactive head Susan board.jpg

  • eagle file available here: Project Susan
  • the eagle schematics read attiny13, but ignore this, i used the attiny85 but didn't have the part in eagle

Components

  • 1 electret microphone (take from an old computer microphone)
  • 1 ATtiny85
  • 1 lm358p op-amp
  • RGB LED
  • resistors: 2x 220Ω 1x 330Ω 1x 10m Ω 1x 100k Ω 1x 1k Ω 1x 1m Ω, 1x 0.5M Ω 1x 21k Ω
  • ceramic capacitors: 1x 105 (for decoupling), 3x 222p
  • electrolytic capacitor: 1x 4.7uf 1x 2.2uF
  • someones head

code

  • most of the processing is done offchip, just needed a processor for the pwm and a little bit more filtering, attiny13 would have been good if you could get the PWM library on its 1k flash
  • tiny_core for attiny85 @ 1Mhz internal oscillator
  • you need to disable the reset pin since we need it (avrfuses on a mac)
unsigned int r,g,b = 0;

unsigned int sensorPin1 = 0; //PB5
unsigned int sensorPin2 = 3; //PB3
unsigned int sensorPin3 = 1; //PB2

unsigned int outred = PB4;
unsigned int outgreen = PB0;
unsigned int outblue = PB1;

unsigned int levels = 100;



void setup() {
  pinMode(outred, OUTPUT);
  pinMode(outgreen, OUTPUT);
  pinMode(outblue, OUTPUT);
  analogReference(0);
}



void loop() {

  red(analogRead(sensorPin1));
  green(analogRead(sensorPin2));
  blue(analogRead(sensorPin3));
  delay(30);

}

void red(int value) {

  if (value > 120) {
    r = levels;
  }

  if (r > 0) {
    r--;
  }
  analogWrite(outred, map(r, 0, levels, 0, 255) );
}

void green(int value) {

  if (value > 120) {
    g = levels;
  }

  if (g > 0) {
    g--;
  }

 analogWrite(outgreen, map(g, 0, levels, 0, 255) );

}

void blue(int value) {

  if (value > 20) {
    b = levels;
  }

  if (b > 0) {
    b--;
  }
  analogWrite(outblue, map(b, 0, levels, 0, 255) );

}