Time for a little ACDC!

It’s never too late (or too early) to rock! This “headbanging” sensor provides heavy guitar riffs whenever you feel so inclined to rock out. Portable, wireless, lightweight. Now you have no excuse.

Parts:

  • Lilypad Arduino
  • Lilypad Xbee
  • 2 Xbee Radios
  • Xbee Explorer Breakout Board
  • FTDI Breakout Board
  • 9V battery + holder
  • Flex Sensor
  • 100k pulldown resistor
  • Wires

Heavy Metal Circuit

The flex sensor is a small conductive film strip applied length-wise at the base of the neck.  Each time the head is thrust forward (chin moving downward), the flex sensor changes in resistance.  Once it reaches a certain value, Processing triggers a guitar sample for you to rock out to.

Arduino Code

//Flex Sensor Code

//Written by Erin Lewis 2011

int sensorPin = 0;
int sensorValue;
int ledPin = 13;

void setup() {
Serial.begin(9600);
pinMode (sensorPin, OUTPUT);
analogWrite (sensorPin, LOW);
pinMode (sensorPin, INPUT);
}

void loop() {
sensorValue = analogRead(sensorPin);
if(sensorValue > 790) {
Serial.print(“$”);
Serial.println(sensorValue);
delay(100);
}
}

Processing Code

//Heavy Metal Xbee

//Written by Erin Lewis, 2011

import fullscreen.*;
import japplemenubar.*;
import processing.serial.*;
import cc.arduino.*;
import ddf.minim.*;
Arduino arduino;
FullScreen fs;
Serial myPort;
AudioPlayer acdc;
Minim minim;

int sensorPin = 0; //analog pin 0
String serialString;
PImage acdcPic;

void setup() {
size(1024,768);
acdcPic = loadImage(“acdcPic.jpg”);
// frameRate(5);
// fs = new FullScreen(this);
//fs.enter();
minim = new Minim(this);
acdc = minim.loadFile(“acdc2.wav”);
myPort = new Serial(this, Serial.list()[0], 9600);
}

void draw() {
background(acdcPic);
while (myPort.available() > 0) {
acdc.play();
acdc.rewind();
}
}

void stop() {
acdc.close();
minim.stop();
super.stop();
}

void serialEvent(Serial myPort) {
String $;
String serialString = myPort.readStringUntil(‘\n’);
if (serialString != null) {
println(serialString);
String[] numbers = split(serialString, “\t”);
}
}

Leave a Reply

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.