Introduction: Interactive Costume With Leds and Sound Sensor: MG 1.0

These materials and the information contained in this instructable are provided by students enrolled at Software of Places (www.softwareofplaces.com)

Class at PUC-Rio University. The content represented here is the student’s final project for class evaluation purpose published by the student and is solely the responsibility of the page author. Statements made and opinions expressed are strictly those of the author and not of PUC-Rio University.

The aim of this project is to develop a costume to allow a singer/performer to control a LED through sounds. The motivation of this project is to research more about sounds and it's relations with devices such as Galileo, Edison and other similar. Aesthetics experiments with technology promotes a more fluid and close relationship with the technical resources available today.

Step 1: Step 1: Costume and Devices

This project uses

Intel Galileo ($44,99)

Groove Starter Kit ($49,90)

Led BlinkM max ($22,95)

Led Wires, 3 colors, 10M ($11,99 - each)

Plus the materials to make the clothes, about $75.

Step 2: Step 2: Electronic Setup

The project did require great attention to learn about the electronic connections for the Groove with Galileo.

Blink M is connected to I2C port and the Led wires to simple digital ports such as 2, 3 & 4 or 5, 6 & 7. The signal of the sound sensor (mic), at the analog port is quite changeable, depending on the cables, connections and extentions.

Step 3: Step 3: Coding

main.js:

var Cylon = require('cylon');

var sensorObj = require('jsupm_loudness');

var mraa = require('mraa');

//require mraa

// Instantiate a Loudness sensor on analog pin A0, with an analog

// reference voltage of 5.0 var sensor = new sensorObj.Loudness(0, 100.0);

Cylon.robot ({

connections: {

edison:

{ adaptor: 'intel-iot' } },

devices: {

blinkm: { driver: "blinkm" },

ledG: { driver: "led", pin: 5, connection: "edison" },

ledB: { driver: "led", pin: 6, connection: "edison" },

ledR: { driver: "led", pin: 7, connection: "edison" }

},

work: function(my) {

var that = this;

// CODIGO CYLON BLINKM

var corR = 0;

var corG = 0;

var corB = 0;

var qtdBarulho = 0;

var contagem = 0;

var soma = 0;

my.blinkm.stopScript();

my.blinkm.getFirmware(function(err, version) {

console.log(err || "Started BlinkM version " + version); });

my.blinkm.getRGBColor(function(err, data) {

console.log(err || "Starting Color: ", data); });

setInterval(function()

{

contagem = contagem + 1;

if(contagem < 4){

soma = soma + sensor.loudness();

}

if(contagem > 3) {

qtdBarulho = (soma/3);

contagem = 0;

soma = 0;

console.log("Media = " + qtdBarulho);

}

//console.log("Aquiiii esta o valor do barulho " + sensor.loudness());

//console.log("contagem = " + contagem);

}, 100);

every((0.3).seconds(), function() {

corR = corR + 15;

corG = corG + 15;

corB = corB + 15;

/* if(corB > 254) {

corB = 0; }

if(corR > 254) {

corR = 0; }

if(corG > 254) {

corG = 0; }*/

if (qtdBarulho < 50) {

that.ledB.turnOff();

that.ledR.turnOff();

that.ledG.turnOff();

console.log("led desliga");

} else {

that.ledB.turnOn();

that.ledR.turnOn();

that.ledG.turnOn();

console.log("led liga");

}

if(qtdBarulho < 25){

my.blinkm.goToRGB(0,0,0);

that.ledB.turnOff();

that.ledR.turnOff();

that.ledG.turnOff();

} else {

if (qtdBarulho < 35) {

my.blinkm.goToRGB(10,10,10);

} else {

if (qtdBarulho < 50) {

my.blinkm.goToRGB(30,30,30);

} else {

if (qtdBarulho < 70) {

my.blinkm.goToRGB (100,100,100);

} else {

my.blinkm.goToRGB (255,255,255);

}

}

}

}

my.blinkm.getRGBColor(function(err, data) {

console.log(err || "Current Color: ", data);

});

});

} }).start();