Electret Mic Breakout Board Hookup Guide
Fin the Electret Blimp
I came across this project on Instructables while researching Soft Robotics and fell in love with the simplicity and the affect it has with those who connect with it. Pritika Nilaratna developed this socially awkward autonomous blimp to interact and vie for your attention. I made one and will be sharing how to create your own adorable electronic dirigible. I made this project using her platform but created the code based on the servo code used in the SparkFun Inventor's Kit, so, if you have the SIK, you are pretty much ready to make your own sound reactive floating thingy. Please share your projects with an Attribution-ShareAlike 3.0 Unported License.
Parts Needed for Blimp:
You will also need hot glue, clear packing tape, helium (found a tank at a party supply store) and a soldering iron to put this together.
Hardware
The hardware is pretty simple. The wires connecting the battery to the switch, the switch to the Pro Mini, and the Electret Mic to the Pro Mini should be as short as possible. The wires from the servos to the Pro Mini need to be about a foot long. Using wire wrapping wire makes getting multiple connections in one spot much easier, and it's lighter. I taped the battery to the back of the Pro Mini and taped the Electret Mic to the front. Eventually, I will make a little top hat to hold all the electronics and go to tea with Fin in his fancy new hat.
I recommend prototyping this on a bread board first and figuring out which motor is left and which is right. Dry fitting everything first will also help you use the right amount wire so you don't short yourself.
Software
Use the code below to program Fin.
language:c
//Fin the Electret Blimp is the original creation of
//Pritika Nilaratna
//Ollie is Licensed under the Attribution-ShareAlike 3.0 Unported License
//Please share your projects under the same license!
//Code Developed from Sparkfun SIK
//Hardware and Design adopted from Ollie
#include <Servo.h> // Servo Library
Servo servoL; //Left Servo Control Object
Servo servoR; //Right Servo control Object
//Sound variables
const int sampleWindow = 250; // Sample window width in mS (250 mS = 4Hz)
unsigned int sound;
void setup()
{
servoL.attach(5); // attaches the left servo on pin 5
servoR.attach(6); // attached the right servo on pin 6
Serial.begin(9600); // open the serial port at 9600 bps:
}
void loop()
{
int position=0;
servoL.write(0); //Set the position of Left fin
servoR.write(0); //set the position of Right fin
//set up sound detection
unsigned long start= millis(); // Start of sample window
unsigned int peakToPeak = 0; // peak-to-peak level
unsigned int signalMax = 0;
unsigned int signalMin = 1024;
// collect data for 250 miliseconds
while (millis() - start < sampleWindow)
{
sound = analogRead(0);
if (sound < 1024) //This is the max of the 10-bit ADC so this loop will include all readings
{
if (sound > signalMax)
{
signalMax = sound; // save just the max levels
}
else if (sound < signalMin)
{
signalMin = sound; // save just the min levels
}
}
}
peakToPeak = signalMax - signalMin; // max - min = peak-peak amplitude
double volts = (peakToPeak * 3.3) / 1024; // convert to volts
Serial.print("Volts:");
Serial.print("\t");
Serial.println(volts);
if (volts >=1.0)
{
//To make your Blimp seem more excited copy and paste
// the "Up Motion" and "Down Motions" as many
//Time as you'd like. Right now his fins will flap
//4 times.
Serial.println("HEY!! HELLO!!"); //Should have named it NAVI
for (position =0; position <= 75; position +=5)//Up Motion
{
servoL.write(position); //move Left Fin to next position
servoR.write(position); //move Right Fin to next position
delay(20);
}
for (position = 75; position>=0; position -=5)//Down Motion
{
servoL.write(position); //move Left Fin to Next position
servoR.write(position); // move Right Fin to Next position
delay(20);
}
for (position =0; position <= 75; position +=5)//Up motion
{
servoL.write(position); //move Left Fin to next position
servoR.write(position); //move Right Fin to next position
delay(20);
}
for (position = 75; position>=0; position -=5) // Down Motion
{
servoL.write(position); //move Left Fin to Next position
servoR.write(position); // move Right Fin to Next position
delay(20);
}
delay(800); // This delay helps the elecret mic recover from hearing
//the sound of the Servo motors.
}
}
//end. Change it up and show us if you've made one and how you modified it!
Construction
Make the Wings
Create the form for the shape of the wings using the 16 gauge jewelry wire. It can be any shape you'd like as long as you make two of them using the same amount of wire. Remember, the weight needs to be balanced on each side of the balloon so it doesn't fall to one side (Unless that's what you're going for). Place your newly formed wire shapes onto the maylar emergency blanket, and glue it down. Make sure sure to cover the top on bottom of the wire forms so it looks pretty. For this, I used Weldwood Contact Cement, but I'm sure just about any glue will do. Trim up the edges, and leave a little wire hanging out at the bottom tip of the wing so you have something to attach tso the servo.
Make the Servo Enclosures
The SparkFun spools of Hookup wire, when emptied, make excellent light weight housing for the tiny servos. The lips of the servos just barely catch the edges of the center of the spool, and that's where I hot glued it in place. There are also holes in the spools, a perfect location to feed the wires from the servo motors through. Wrap this up in some of the maylar emergency blanket, and use as little tape as you can to secure it. You can repeat the same process using little paper or plastic cups. To attach the wings to the servos, I used the horns that came with the servos and hot glued the excess wire to the servo attachments. When you start testing, keep a marker handy so you can mark which one is left and which one is right.
Attach Wings
With the balloon deflated and flat on a surface, locate the center-middle and secure the servo enclosure there with a little clear packing tape. Make sure it is flat and taught, you don't want to rip the balloon when you inflate it. Here is where you want to make sure you cut yourself enough wire. I budgeted 18" of wire, which ended up too long. The electronics shouldn't hang more than 2" at the bottom when both wings are attached. I think 12" of wire should do the trick.
Tape down the other wing on the other side in same place. Do a test run (have someone help - it's a two person job) to make sure the left and right fins are working properly.
Inflate!
Once you have the wings secured, fill the balloon with helium, and slide the switch to power the Pro Mini from the battery.
Play!
I used the same method as in the Hook-Up Guide and the Windbag Alert for finding "volts". I used the code from the SparkFun Inventor's Kit: Experiment 8: Driving a Servo Motor and modified it for this project. Pritika's servo code for the motor functions is incredible and has a bit more finesse. Her code also uses a different Library for the Servo motor functions. If you user her code you will need to make just a couple modifications. First, download and open the SoftwareServo.h Libary file. Replace "#include <WProgram.h>" with "#include <Arduino.h>", and then make sure the library is in your Arduino file path. If you would like to see more of Pritika's work, you can find the original Ollie and Other Works. Ollie is registered under the Creative Commons Attribution-ShareAlike 3.0 Unported License so share your projects under the same.