Arduino listening to the internet via wiFly

Text Files

In response to some questions today, here are some examples dealing with Reading/Writing text files

$1 gesture input

I haven’t tried this yet, but could be interesting

simple gesture input Processing

Usman Haque lecture video

Here’s a link to Usman Haque’s keynote at the Smart Geometry Conference in 2011.  He is the creator of Pachube and gives an interesting overview of its uses:

LINK

More Project 3 Links

In Project 3 we will be looking at how to use Wireless protocols & Data Services to extend your space beyond its physical walls.  Below are a few of the potential setups

Data Links

 

 

Basic Threshold Switch from a Mic

The Electret speaker breakout board from Sparkfun has been super popular in class so far.

https://www.sparkfun.com/products/9964

The thing is that when you finally get it wired up, it outputs what appear to be random number pulses. In waves. These are the amplitude wave of the sounds near the microphone, not an error. They can themselves be used for many things, but will not tell you if, for example, someone is talking TO the critter, just the background levels. Terrible! We need a threshold to tell us when someone’s surpassed the normal background volume instead.

Much like “face recognition,” “hearing” speech is tough. This is simple. This creates a threshold switch from a microphone. It will tell you when the sound levels nearby change to a wider range than “normal.” It requires some calibration, and some simple math. If you are outputting to a nearby speaker, it may not work very well; it will hear the speaker, as well as yourself. Better math would fix that issue. This is a simpler switch than that.

electret breakout wiring
To wire it, hook 5v to a 10k pulldown resistor, ground to ground, and information to A1* as in the diagram. The datasheet says the thing needs 1.5v in, and most sources say a 5k will do you, but a 5k gives you a big fat wave with numbers between 200 and 400 – it looks super random. The 10K will compress your business like no nevermind.

*NB: I prefer A1 to A0 because A0 sometimes acts weird, and code occasionally interprets a “0” as a null value. This is important with analog inputs.

Once hooked up, here is your code:

/*

Electret Mic Threshold Reader
Alex Leitch
@aeleitch
http://www.alexleitch.com

Oct 31 2012

Notes:
http://www.alexleitch.com/?p=83
Appropriate for All Ages, 2006, uses a much-simplified version of this circuit.
That one ran on a similar mic circuit, picked up for $3 in a spare halloween “spooky robots” pile.
This is better because you can calibrate it, that was better because you didn’t have to. Also, it cost $3, not $30.

*/

const int pinSpeaker = 3;

int valMic;
int valMicRange;
int valMicLast;

int iHearYou; //set threshold for “being talked to”

void setup() {
Serial.begin(9600);
}

void loop() {

valMic = analogRead(pinMic); // every loop read the mic

valMicRange = abs(valMic – valMicLast);
// take an absolute value of current and last value of amplitude wave for threshold

Serial.println(valMicRange);
// Find out what the absolute value of difference is – this will make a pretty visualizer out of your thresholds

if (valMicRange > iHearYou) { //do something if threshold is passed
}

else { // if not being talked to, what to do?
}

valMicLast=valMic; // hang onto that mic reading

}

Here is where the exhortation to do Amazing Things with this information comes in! But no. I am not going to lie to you: working with sound is tough and the sort of thing [redacted judgemental comment] (hi there, GearSlutz) work with. Sound is a wave, which is to say a four-dimensional transform, waves are a challenge if what you really want are robots. Sound becomes useful as a switch when, using thresholds maybe, you can transform it from a wave to a point, or at least a baseline, which is what this circuit does. Audio obsession knows no upward bounds. That message board is maybe the best review board for people who are really into analog inputs, though, and I think you may find something of use there.

Appropos of nothing, The Simpsons. Happy Hallowe’en.

OpenSource Kinect Projects

In addition to Kate’s links, here are some opensource projects you should have a look at. Please add more as you discover them.

New Project, New Downloads

Hi Everyone,

We will officially be kicking off the second project on Thursday night, but I wanted to pass along some relevant links for software/tools we’ll be using this week.  The main things we will be covering Thursday are:  Kinect, Max/Msp, and the principals of intersoftware communications.

The first part of the class will simply deal with getting lots of software, drivers, and libraries installed so its important that you have at least downloaded everything.

1. Max/Msp :  LINK

Max/Msp is a graphic programming language, For now just run the 30 day demo of the software, Later we will also look at the free version Pure Data, but for now just install max.

2. OSC and Arduino Externals for Max.  Just download these and we’ll go through where to place them.

OSC:  LINK

Arduino:  LINK

3. Kinect Drivers.  Tomorrow we will be using the SimpleOpenNI library for processing to experiment with the Kinect.

OSX Drivers:  LINK

Win32: LINK

Win64: LINK

You can also find details on how to install the drivers here: LINK

4. SimpleOpenNI Library for Processing:  LINK

5. OSCP5 Library for Processing:  LINK

6. The latest version of Firmata:  LINK

I will also be sending out a set of example files, but this seems like enough for now.

7.***Files we will be using today:  LINK

 

 

Also, for those of you who have never seen Max before, here’s a little taste: