Nathan Roth's Blog

August 16, 2009

Doorbell Project

Filed under: Sociable Objects — admin @ 5:14 pm

After much work trouble shooting the original assignment I finally figured out that my radios were programmed as two routers. It was quite a simple mistake but had me stumped for some time. After setting up the circuits everything seemed to work just fine:

XBee Doorbell Project/ Hello World from Nathan Roth on Vimeo.

August 13, 2009

Imagined Sociable Objects

Filed under: Sociable Objects — admin @ 6:11 pm

For my imagined Sociable Objects project I described a set of interactive objects placed in the urban space.  A light switch on a stop sign might start a water pump connected to a fire hydrant.  Plug some device into a road sign and see an interaction down the street.  My imagined sociable objects involve playful (and sometimes absurd) experiences within the urban environment.

im_sociable_objects

Here is a link to the slide show:

http://docs.google.com/present/view?id=dfs3k5rf_12d85zdhhp&autoStart=true

Temperature Sensor Network Assignment

Filed under: Sociable Objects — admin @ 5:47 pm

As a class we embarked on the journey of setting up a temperature network around ITP.  We split up the responsibilities so that we could get the whole network setup in time.  Jonathan, Roy, and myself setup the network and tested it before class. Testing the network was kind of annoying as we had to run to each room and unplug the devices.  Eventually we got everything working smoothly.  Here are some pics from the network:

itp_sensor_network

more documentation on our project website:

http://sites.google.com/site/thermonetwork/

Go Long, Funny-Cry-Happy, & Urban Surprise Assignment

Filed under: Sociable Objects — admin @ 4:04 pm

Barbara, Roy, and Myself decided to work on the card assignment together.  After the lecture about finding signal strength on Zigbees we were inspired in trying to create ‘love kites’.  We thought the kites could sense each other’s proximity by checking the signal strength for a rough idea on how close they were.  This assignment was a great exercise in time management.  We had an extremely short time frame to get anything done.   We quickly found that our efforts were wasted on figuring out the mechanics of mounting all the components to the kite.  Our primliminary tests on signal strength were misleading.  Ultimately we were unable to get the thing working well enough for even prototype standards.  In the end the main lesson we learned was that our heads were up in the sky when the ground work and basic logistics is what we really needed to focus on.

Sensor/ Actuator Project:

Filed under: Sociable Objects — admin @ 3:47 pm

We decided that we would go with the bathroom visualization project.  The sensor group would install something in the bathrooms to sense when a toilet was flushed.  On the actuator end a fountain would ’spritz’ some water for a few seconds to represent the flush.  I helped install the QT sensors in the bathrooms and we quickly found that they were way too sensitive.  Running the wire around metal proved to be a problem so we wrapped the wire in tape and made sure to run it as far from the metal as possible.  This seemed to work ok but there was still the possibility that one could flush the toilet without triggering the sensor.  Here are some pics that Roy took of the hook up:

http://www.flickr.com/photos/roy_vanegas/3817897350/

http://www.flickr.com/photos/roy_vanegas/3817905060/

Here is the video of the project:

Sensor/Actuator Project on YouTube

August 12, 2009

Sociable Objects Final: Sand Pendulum

Filed under: Sociable Objects — admin @ 4:40 pm

Michael, Jonathan, and myself decided that we wanted to do something with visualizing presence withing particular rooms at ITP.  We decided on building a pendulum like contraption that would dispense either red, green, or blue sand according to input recieved from different rooms around the floor.  Building the contraption to properly dispense the sand proveded to be one of the trickiest parts of the project and so we set out on developing the device first.  Our solution involved rotating discs with a servo in such a manner that holes would line up under soda bottles filled with sand.  With a little bit of tweaking we got things runing smoothy.  Photocells (and one microphone) acted as input sending a character of either ‘r’, ‘g’, ‘b’ .  Here is the code of the actutator bit of the project:

char red = ‘r’;
char green = ‘g’;
char blue = ‘b’;
char def = ‘d’;

int servoPin = 2;     // Control pin for servo motor
int minPulse = 500;   // Minimum servo position
int maxPulse = 2500;  // Maximum servo position
int pulse = 0;        // Amount to pulse the servo

long lastPulse = 0;    // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses

char analog_read;
char inChar;
//char analogValueG = ‘A’;  // the value returned from the analog sensor
int analogPin = 0;    // the analog pin that the sensor’s on
int analogValueB = 0;
int analogValueR = 0;
int analogValueG = 0;
int analogValueD =0;
void setup() {
pinMode(servoPin, OUTPUT);  // Set servo pin as an output pin
pulse = minPulse;           // Set the motor position value to the minimum
Serial.begin(9600);

}

void loop() {
analogValueG = 437;
analogValueB = 0;
analogValueR = 881;
analogValueD = 200;
pulse = map(analogValueR,0,1023,minPulse,maxPulse);    // convert the analog value
analog_read = inChar;
if (Serial.available()) {

inChar = Serial.read();

Serial.flush();
}
else
{
//inChar=’d';
}

//Serial.println(inChar);

//Serial.println(analog_read);
if (analog_read == red) {

pulse = map(analogValueR,0,1023,minPulse,maxPulse);
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last pulse

}
// to a range between minPulse
}                                                      // and maxPulse.
if (analog_read == green) {

pulse = map(analogValueG,0,1023,minPulse,maxPulse);
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last pulse

}
}

if (analog_read == def) {

pulse = map(analogValueD,0,1023,minPulse,maxPulse);
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last pulse
}

}

if (analog_read == blue) {

pulse = map(analogValueB,0,1023,minPulse,maxPulse);
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last pulse
}
}
/*delay(200);

pulse = map(analogValueD,0,1023,minPulse,maxPulse);
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last
*/

//}

//delay(20);
/*
pulse = map(analogValueD,0,1023,minPulse,maxPulse);
// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last
*/

// }

//Serial.flush();
}

/*

// pulse the servo again if rhe refresh time (20 ms) have passed:
if (millis() – lastPulse >= refreshTime) {
digitalWrite(servoPin, HIGH);   // Turn the motor on
delayMicroseconds(pulse);       // Length of the pulse sets the motor position
digitalWrite(servoPin, LOW);    // Turn the motor off
lastPulse = millis();           // save the time of the last pulse
}
}
*/

August 5, 2009

Of Origins: the Fibonacci Syllabic Generator V-2.0

Filed under: Digital Writing In Python — admin @ 12:12 am

For my Digital Writing in Python final I decided to expand upon my Fibonacci Syllabic Generator program.  After running the program a few times I realized that I neglected some very simple things.  The output would often spit out garbage characters like ‘(‘ or ‘:’ or ‘;’ etc….  This made things look messy so I constructed a regular expression to catch some of the common characters that were messy:
###########################################################################
#   Remove random chars (: ; ‘ ” , )) #
###########################################################################
def text_cleaner(line):
x = line
p = re.findall(r”[,':)(;.\"]“,x)
for i in p:
x = x.replace(i,”)
return x

Once That was fixed I moved on to the task of making the program take dynamic input.  In its first iteration I used a line to write the sequence from 1-13 with a huge ugly string of concatenated strings.  In the new version I can define how far I want the sequence to continue its generation.  This was achieved as follows:

#################################################################################
# Line of code that Takes a Fibonacci Line  and Outputs the entire Syllable line#
#################################################################################
def line_generator(x):
p = fibonacci_generator(x)
q = syl_num(p)
return q

###########################################################################
# Fibonacci  Number Generator Function #
##########################################################################
def fibonacci_generator(x):
if x == 0:
return 0
elif x == 1:
return 1
else:
return fibonacci_generator(x-1) + fibonacci_generator(x-2)

#################################################################################
# Function that takes sequence line number and generates correct syllable lines #
#################################################################################

def syl_num(x):
if x == 1:
return random.choice(one_syllable)
else:
mod = x%2
t = x/2
one_syl_string = ‘ ‘
two_syl_string = syll_print(t)
spacer = ‘ ‘
if mod == 1:
one_syl_string = random.choice(one_syllable)
return str(one_syl_string) + str(spacer) + str(two_syl_string)

#################################################################################
# Function That constructs a string according to a number of syllables on input #
#################################################################################

def syll_print(x):
os_string = random.choice(two_syllable)
s_string = random.choice(two_syllable)
spacer = ‘ ‘
while (x > 1):
os_string = random.choice(two_syllable)
s_string = str(os_string) + str(spacer) + str(s_string)
x +=-1
return s_string

#################################################################################
#Final Sequence Generator Counting UP#
#################################################################################
def fb_sq_up(x):
lines = list()
while x > 0:
lines.append(str(line_generator(x)))
x +=-1
t = x
lines.reverse()
for i in lines:
i =i.strip()
i = i.center(100,’+')
print i

#################################################################################
#Final Sequence Generator Counting Down#
#################################################################################
def fb_sq_down(x):
lines = list()
while x > 0:
lines.append(str(line_generator(x)))
x +=-1
t = x
for i in lines:
i =i.strip()
i = i.center(100,’+')
print i

As you can see I centered the lines with ‘+’ s to make the text more visually interesting.  Runing the algorithm from up to 6 and down from 6 yields output that looks like this:

Genesis Creation Narrative:

example_1

example_2

Here is the Output from The Apache Creation Narrative:

example_3

Here is output from the Samoan Creation Narrative:

example_4

July 22, 2009

Creation Narratives and the Fibonacci Syllabic Generator

Filed under: Digital Writing In Python — admin @ 12:15 pm

The poetic form for my  Python script  is the Fibonacci Sequence starting at 1 and continuing to 13 (1,1,2,3,5,8,13).  The script imports a text and seperates each word into a unique set.  This set is then divided into subsets according to number of syllables within each word.  Each line of the poem is then created by randomly from appropriate sets so that each line progresses through the Fibonacci Sequence.

Here are some general rules to finding syllables within a word

1. To find the number of syllables:
—count the vowels in the word,
—subtract any silent vowels, (like the silent “e” at the end of a word or the second vowel when two vowels a together in a syllable)
—subtract one vowel from every diphthong, (diphthongs only count as one vowel sound.)

Here is the code broken up into functions:

import random
import re
import sys

###########################################################################
#  Function that counts the number of vowels in a word  #
########################################################################
def vowel_counter(x):
counter = 0
for i in x.lower():
if i in “aeiou”:
counter +=1
else:
return counter

###########################################################################
# finds all double vowels and counts them  #
######################################################################

def double_vowel_counter(q):
p = re.findall(r”[aeiou]{2,}”, q)
num =0
for i in p:
num +=1
return num

###########################################################################
#  Check if word ends in ‘e’  #
#######################################################################

def e_ending(q):
if q[-1]==’e':
return 1
else:
return 0

###########################################################################
#  Syllable Checking Function  #
########################################################################

def syllable(word):
syllabull = vowel_counter(word)-double_vowel_counter(word)-e_ending(word)
return syllabull

###########################################################################
#   Put all Words from a text in a unique Text  #
###########################################################################
def word_set(import_text):
unique_words = set()
for line in open(import_text):
line = line.strip()
words = line.split(” “)
for word in words:
unique_words.add(word)
return unique_words

word_set(”genesis.txt”)

###########################################################################
#   Seperate all words into syllable sets  #
###########################################################################

one_syllable = list()
two_syllable = list()
three_syllable = list()
four_syllable = list()
all_words = word_set(’genesis.txt’)

###########################################################################
# Make Sure to take out the ‘ ‘ of the set #
##########################################################################
all_words.pop()�

for i in all_words:
syllable = vowel_counter(i)-double_vowel_counter(i)-e_ending(i)
if syllable == 1:
one_syllable.append(i)
if syllable ==2:
two_syllable.append(i)
if syllable == 3:
three_syllable.append(i)
if syllable == 4:
four_syllable.append(i)

###########################################################################
# Sequence Generator #
##########################################################################

print random.choice(one_syllable) +’\n’+ random.choice(one_syllable) +’\n’+ random.choice(two_syllable) +’\n’+ random.choice(two_syllable) + ‘ ‘ + random.choice(one_syllable) +’\n’ + random.choice(two_syllable) + ‘ ‘ + random.choice(two_syllable)  + ‘ ‘ + random.choice(one_syllable) +’\n’ + random.choice(three_syllable) + ‘ ‘ + random.choice(two_syllable)  + ‘ ‘ + random.choice(one_syllable) + ‘ ‘ + random.choice(two_syllable) +’\n’+ random.choice(three_syllable) + ‘ ‘ + random.choice(two_syllable)  + ‘ ‘ + random.choice(one_syllable) + ‘ ‘ + random.choice(two_syllable) + ‘ ‘ + random.choice(two_syllable) + ‘ ‘ + random.choice(two_syllable)  + ‘ ‘ + random.choice(one_syllable)

Here are some examples of output:

From Genesis

1) day
1)fish
2) creepeth
3) bearing fruit
5)morning female So
8) replenish female great waters,
13) firmament, called subdue seasons, fruitful, without green

Samoan:

1)born,
1)”Let
2)heaven,
3)seabird me.”
5)cannot place. strong
8)united heaven small I’i
13) visitor, Slippery whole leaping footstool. vine; is,

July 13, 2009

Regular Garbage Expressions

Filed under: Digital Writing In Python — admin @ 10:54 am

For this exercise in regular expressions I decided it would be fun to play with some of my favorite garbage words.  Words like ‘ugh’ or ‘meh’ or ‘blah’ carry a certain expressive quality when uttered.  Within a text they seem quite out of place and seem to push the text into a ridiculous stumbling of the language.

Here is the code:

import re
import sys
import random

expres = ['ugh', 'meh', 'woo', 'blah', 'eck', 'tsk']

for line in sys.stdin:
line = line.strip()
range = random.randrange(0,5)
line = re.sub(r’\b\w\w\w\b’, expres[range], line)
print line

Here is an example of what it generated out of Jane Austin’s Pride and Prejudice

PRIDE meh PREJUDICE

By Jane Austen

Chapter 1

It is a truth universally acknowledged, that a single meh in possession
of a good fortune, must be in want of a wife.

However little known woo feelings or views of such a woo woo be on woo
first entering a neighbourhood, this truth is so well fixed in blah minds
of eck surrounding families, that he is considered eck rightful property
of some woo or other of their daughters.

“My dear Mr. Bennet,” said eck lady to eck eck eck, “have eck heard that
Netherfield Park is eck at last?”

Mr. Bennet replied that he blah blah.

“ugh it is,” returned ugh; “ugh ugh. Long ugh just been here, ugh ugh
told me blah about it.”

Mr. Bennet made no answer.

“Do ugh ugh want to know ugh ugh taken it?” cried ugh wife impatiently.

“_You_ want to tell me, woo I have no objection to hearing it.”

This eck invitation enough.

“woo, my dear, woo must know, woo. Long says that Netherfield is taken

Here is another example from this_is_just.txt:

This is just to blah

I have eaten
meh plums
that were in
eck icebox

woo which
meh were probably
saving
blah breakfast

Forgive me
they were delicious
so sweet
ugh so cold

The Killer in You.txt

Filed under: Digital Writing In Python — admin @ 10:44 am

For My first assignment in Digital Writing in Python I thought it would be interesting to write a script that would take a Wikipedia article as standard input and munge it through  simple replacement.  For input I took the Wikipedia article on Charles Manson and the replacement occurs within the line at all occurances of ‘Charles’ and ‘Manson’.

The tendancy towards violence within language is an extremely intersting idea.  Language in its essence is a violent practice.  It demands that we divide, dismantle, and deconstruct the natural flow of the world into truncated parts.  When we use language to represent something, we are in effect commiting some level of violence to the individual, the singularity, of that which is described.

Re-reading the Manson biographical text in its mashed up form provides an interesting exploration of the violence in representation and the violence within language.  The text itself is disturbing as it plots historical points of the life of a killer.  Replacing Manson’s name with your own (or that of a friend) generates a biography that is indeed quite perturbing.  The text bends the language of violence (and the violent practice of language) and positions you directly within it.

Here is the script:

import sys

for line in sys.stdin:
#  line = line.strip()
line = line.replace(’Manson’, ‘Last_Name’)
line = line.replace(’Charles’, ‘First_Name’)
line = line.replace(’line[22]‘,’line[23]‘)
x = len(line)/2
y =len(line) -1
line = line.replace(line[x], line[y])
print line

Example munged text:

At the t
me the Fam
ly began to form, Lopez was an unemployed ex-conv
ct, who had spent half h
s l
fe
n correct
onal
nst
tut
ons for a var
ety of offenses. In the per
od before the murders, he was a d
stant fr
nge member of the Los Angeles mus
c
ndustry, ch
efly v
a a chance assoc
at
on w
th Beach Boy Denn
s W
lson. After Lopez was charged w
th the cr
mes, record
ngs of songs wr
tten and performed by h
m were released commerc
ally. Art
sts
nclud
ng Guns N’ Roses and Mar

Powered by WordPress