6 Mediocre Ideas
Because the idea fairy hasn’t visited me much lately, I am too afraid to look and find out that all of these ideas are done to death 😛
Because the idea fairy hasn’t visited me much lately, I am too afraid to look and find out that all of these ideas are done to death 😛
Here are the two guides I used 😀
http://blog.blprnt.com/blog/blprnt/open-science-h1n1-processing-and-the-google-spreadsheet-api
http://blog.makezine.com/archive/2010/12/save-sensor-data-to-google-spreadsh.html
Bree, Please hyperlink. thank! Y.
Sooooooooooooooo….
Since I was using a microphone as my input and was sampling every 100 microseconds, then updating to a googledocs spreadsheet every two seconds… one day’s worth of data maxed out 200,000 cells in my sheet. Which led me to taking data for one hour only.
I hooked up my mic as the input to the arduino and took an average every 5 miliseconds, wrote the arduino input to serial in single bytes, then wrote the information from processing to google spreadsheets.
It worked…kind of? I am not sure if the arduino and the processing talked together accurately, and I should rework that. Another thing I should try to do is use the Xbee directly (without arduino), as a few people have suggested.
Anyway, here is the sound scape visualized over an hour.
And the code (there are three main pieces)
Hey guys, I am going insane and could really use help!
I’m using a little omnidirectional mic as my “sensor” and am trying to throw these readings into a spreadsheet.
The arduino printouts show “meaningful” values. As in, I get a value that makes sense; if it’s quiet, it’s one number, and if I make noise, the number goes up.
However, when it gets to processing, I get this pattern of numbers that just repeats, regardless of what goes on and numbers that don’t match Arduino. Is this because of the kinds of packets of info I am getting from Arduino? I’m going CRAZY!
Please help if yall have any ideas!
Hi Bree,
I am just using the Xbees them selves without Arduinos. I recommend you do the same, it is just easier if you are not trying to create a crazy complicated system.
-Configure your Xbees as its shown in the 5th chapter.(API mode)
-I think you might have to enter ATD03 instead of ATD02 because your sensor will not be a digital input.
-When building the circuit use a piezo instead of a temp sensor cause it has a transducer and it will pick up sound as you are trying to do.
-Use the processing sketch given for reading temperature, tweak it so that it will draw what you want to visualize. You can simply use the “temp” value in the sketch
as the input for your visualizer.
-Enjoy the awesomeness of your project!:)
Thanks ill try that!
Here is a super simple casing for the “lights-on/off” sensor system for bathroom occupancy…
After working on the very simple premise of making a photo-resistor-dependent thingamagig, I seem to have killed my Xbee. I have NO idea how it happened, but Xctu can no longer talk to it :(. I am at a loss as to what killed it, but I am suspecting my bad luck lately with these things.
It might, of course, be his fault…
I suppose I probably saw the same things everyone else did at toy fair, but since I was wearing an exhibitor badge, I was totally being bounced at many of the top floor booths. The guy at Matel, for example, came just short of evicting me for looking at toys.
I saw the creepy coma dogs (someone else already posted pictures) and am wondering how far “illusion of life” should go in certain narratives. One guy working for the company said “better than a real pet!” Not sure about that… I can just imagine some kid wondering why the realistic, breathing dog isn’t waking up, becoming increasingly disturbed. Comatose puppies is a strange concept for a toy.
I of course loved the HEX bugs, but who doesn’t? My bf and I were led through the tour and saw all the cool concepts of desk toys they are making. The tour guide pointed out the intellectual property sign on the wall and mentioned that the company had spent $6million or something just to ward off knock-offs. Interesting stuff. I really wanted one.
I loved the really smart Ollo robots. I thought they not only did cool stuff, but in a smart way. The girl at the table was really nice and liked talking about the bots and challenged me to figure out the “elephant”, who was simply just being guided around a square by simple pushing and shoving. Really smart, really cool!
https://makingtoys.net/2011/02/07/i-shall-call-him-meat/
1 -Explain your code
As a team, we decided to make one creature a predator and the other its prey. The code we attempted to write had varying levels of behavior based on the abruptness of changes to the creature’s situations in a way that made it have apparent character.
Since I worked primarily with the “prey” model (I call him “Meat”), I wanted my guy to exhibit the behaviors of a dayturnal prey animal. So, he’s pretty happy when there’s light and begins to panic when darkness falls. If there is abrupt darkness, he screams and the shock kills him. I also wanted to add a “Lazarus function” to revive him with a bright burst of light.
After monitoring “normal”, “bright”, and “dark” values from my photoresistor, I started to structure the logic around “if this … then this”, writing functions for each. Then, I tried testing different pitches and lengths of tones to determine what sounds made the most sense. For example, I have the scream raise in pitch as a steady tone until it is almost unbearable to hear. It is followed by a crunchy “death” sound and silence. When he’s happy, however, he plays a Major 3-note progression, kind of like happy whistling. As his panic rises, the speed of his sounds increases to simulate frantic fear.
The code relies heavily on conditional statements in order for the creature to respond to his situation and the degrees of change in it.
2-What did you do that was innovative, non-obvious, and useful?
I think making a sense of panic from the sounds was a bit non-obvious. One might think he should only get less happy-sounding, but I think if we are going to sell the idea that he is afraid of the dark because he might get eaten, he should have a sense of panic, almost like rapid breathing or heart-beats. Whether or not it is innovative, I am not sure, but I definitely think it is useful in telling the story of “Meat” and his antagonist.
I also think the idea of having two creatures, one predator and one prey, completes a fuller narrative than “Meat” could do by himself. The fact that there is another creature “Eater” stalking him in the dark adds dimension to his character.
This is Meat. He is a bit of a nervous thing and really gets upset when the lights dim. Turn them off too quickly, and he screams. If he freaks out too much, he’s going to pass out and only a quick burst of light can wake him up.
Why is he afraid of the dark? Because there are monsters out there…
How does his little mind work?
With very messy code.
————————————————————————————-
————————————————————————————-
// Dayturnal “meat”
// int vars
int speaker = 9;
int lastlight = 0;
int light;
int mood = 100;
boolean happy = true;
boolean scared = false;
int deathCounter;
boolean dead = false;
void setup() {
// set up pins and serial
pinMode(0, INPUT);
pinMode(9, OUTPUT);
Serial.begin(9600);
}
void loop() {
// check light sensor
light = analogRead(0)*10;
// make sure that value checking changes in light is same as light on first run
// otherwise, it could falsely register a big change in light
if(lastlight == 0) lastlight = light;
// send values to serial
Serial.println(“light: “);
Serial.println(light);
Serial.println(“mood: “);
Serial.println(mood);
Serial.println();
mood = map(light, 0, 1000, 0, 1000);
// run most of the code unless creature is dead
// lazarus function
if(dead){
if(light – lastlight > 200) {
dead = false;
deathCounter = 0;
// preyRelief();
mood = 100;
lastlight = 120;
}
}
if(!dead) {
// happiness follows light level
if (mood >= 80){
happy = true;
}
if (mood < 80){
happy = false;
scared = true;
}
if(light > lastlight) {
mood+=5;
}
else if(light < lastlight) {
mood-=5;
}
// sudden drop in light, OH NO!
if(lastlight – light > 100) {
preyScream();
mood = 1;
scared = true;
}
// sudden burst of light, OH JOY!
if(light – lastlight > 100) {
preyRelief();
mood = 200;
happy = true;
}
// if too little light, creature starts dying
if(light < 50) deathCounter++;
// otherwise, creature is recovering
else deathCounter–;
// if too little light for too long, DEATH!
if(deathCounter > 20) {
preyScream();
death();
dead = true;
}
// play normal noise on each loop
preyNoise();
// use line below instead if you don’t want the flat-line noise
// when creature dies.
if(!dead) preyNoise();
}
// remember last light value to see changes over time
lastlight = light;
}
// standard creature noise, dependent on mood level
void preyNoise() {
if(happy){
int basetone = map(mood, 0, 800, 150, 1000);
int basetempo = map(mood, 0, 800, 20, 600);
//3 notes
tone(speaker, basetone);
delay(basetempo);
noTone(speaker);
delay(basetempo);
tone(speaker, basetone*1.26);
delay(basetempo);
noTone(speaker);
delay(basetempo );
tone(speaker, basetone*1.5);
delay(basetempo);
noTone(speaker);
delay(basetempo);
delay(basetempo*2);
}
else if (scared){
int basetone = map(mood, 0, 800, 150, 1000);
int basetempo = map(mood, 0, 800, 10, 600);
basetempo = basetempo – mood;
//3 notes scared
tone(speaker, basetone);
delay(basetempo);
noTone(speaker);
delay(basetempo / 5);
tone(speaker, basetone);
delay(basetempo);
noTone(speaker);
delay(basetempo / 5);
tone(speaker, basetone*1.6);
delay(basetempo);
noTone(speaker);
delay(basetempo / 5);
delay(basetempo*2);
}
}
// noise when too much light comes abruptly
void preyScream() {
int freq = 2100;
for(int x=0; x < 3000; x++) {
tone(speaker, freq);
delay(2);
if (freq < 2800){
freq++;
}
else {
freq=3000;
}
}
}
// noise when light comes back abruptly.
void preyRelief() {
}
// sound which occurs when creature dies
void death() {
tone(speaker, 200);
delay(40);
}
————————————————————————————–
————————————————————————————–
Well, I will save my more complex code for another day…my brain is sputtering.
I hooked up the arduino to the speaker and ended up making 6 separate sketches for the emotions.
Here’s a picture of the circuit…
the video: http://vimeo.com/19512551
hello – something cheery and salutary
haha – I attempted to make a laughing sound, like a twitter
level UP – sorta inspired by Zelda’s “I got something!” sound
yes/no – sort of went for the ding and buzzer
I’m dying – inspired by the sound toys make when their batteries start to lose juice
bai – a shut down sound
Well, here’s part of my documentation on this emotive bleep project. I am *trying* to write code that has a vocabulary of bleeps with a few “phrases”…
I tried working out logically… that I need an array of phrases, each of which is an array of sequences. Beyond that, I am stuck, and after hours of circling the drain, I was wondering if one of you guys reading might be able to give me a few hints 🙂
———————————————————————————————————————————
//emotive bleeps
//static values
int speakerPin = 9;
int length = 10; // the number of notes
int tempo = 500;
//tone variables
String phrases[] = {“hi”,”bye”,”yes”,”no”,”alert”,”dying”, “hot” };
char notes[] = “qrstuvwxyz”; // a space represents a rest
int beats[] = {1,1,1,1,1,1,1,1,1,1};
//func to play each tone, regardless of sequence
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playPhrase(String phrase){
//get input from keyboard (processing sketch) and interpret that as a “phrase” string
String phrase = ‘bye’;
switch(phrase) {
//each phrase has the same 10 notes, but I am just going to have each phrase have different values for the wavelengths
case’hi’:
char names[] = {‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’ };
int tones[] = { 0, 600, 1800, 1000, 400, 1000, 0, 0, 500, 3000}; //wavelengths
case’bye’:
char names[] = {‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’ };
int tones[] = { 400, 800, 800, 0, 0, 0, 0, 0, 2500, 3000}; //wavelengths
default”:
char names[] = {‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’ };
int tones[] = { 400, 600, 800, 1000, 1200, 1550, 1750, 2000, 2500, 3000}; //wavelengths
break;
}
}
/*
void playNote (char note, int duration){
char names[] = {‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’ };
int tones[] = { 400, 600, 800, 1000, 1200, 1550, 1750, 2000, 2500, 3000}; //wavelengths
}*/
void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
for (int i = 0; i < length; i++) {
if (notes[i] == ‘ ‘) {
delay(beats[i] * tempo); // rest
} else {
playPhrase(notes[i], beats[i] * tempo);
}
// pause between notes
delay(tempo / 2);
}
}
——————————————————————————————————————————————-
I hope this isn’t too late to be helpful, but I’m looking at your code now. There are a few things I noticed right off the bat:
-you shouldn’t use “tone” as a variable name because it’s already reserved by arduino. That was the problem with the demo code we got last week. Name it toneValue or anything else that isn’t “tone”
-in your void loop you make a call to playPhrase(notes[i], beats[i] * tempo), but playPhrase only wants a string. I think this was supposed to be a call to playTone, which takes two ints.
I’m going to look it over a bit and see if I can find anything. Hooray insomnia!
Also, the time zone on this blog is way off. It’s only 1:00 where I live.
thank you kindly!
Looked at it bit more. I’m not really sure what names[] does or exactly how your code works, so I’m not sure how helpful I can be from a distance. It’s worth noting that the arrays you made, names and tones, are only available within the function playPhrase. they are not global variables. You would need to declare them up at the top for them to be accessible to other functions.
Also, the example code we got the other day was pretty funky. It’s actually really easy to use a piezo as long as you now the frequency of the sound you want to make. Arduino as a pretty easy tone function: http://arduino.cc/en/Reference/Tone
You just set the tone to what you want and then delay for as long as you want it to last. After that you can use noTone to silence it. The code I posted uses it that way if it’s helpful.
I’m sure there are plenty of people in the class who are more knowledgable about sound than I am, but I’ll probably be in or around the 10th floor lab tomorrow from 3 to 4 or so. I have a fairly informal meeting with somebody from the games workshop, but I’d be happy to take a look at you code in person if you think it would be helpful.
This is bree Rubin.
My background, academically is a BA in Japanese and French, which had nothing to do with this stuff. I also have some experience with circuit-bending and a wee bit of OF coding.
My interests in this course are making cool things that beep.
Reply