Monday, January 30, 2006

Sensors and Time




Using Flex Sensor
Code Reference from Tom Igoe

'****************************************************************
' Define ADCIN parameters
DEFINE ADC_BITS 10 ' Set number of bits in result
DEFINE ADC_CLOCK 3 ' Set clock source (3=rc)
DEFINE ADC_SAMPLEUS 20 ' Set sampling time in uS

PeakValue var word
SensorValue var word
LastSensorValue var word
Threshold var word
Noise var word

' serial pins and data reate:
tx var portc.6
rx var portc.7
n9600 con 16468

Threshold = 50 ' set your own value based on your sensors
PeakValue = 0 ' initialize peakValue
noise = 5 ' set a noise value based on your particular sensor

' Set PORTA to all input
TRISA = %11111111
' Set up ADCON1
ADCON1 = %10000010

Main:
' read sensor on pin RA0:
ADCin 0, sensorValue
serout2 tx, n9600, [sensorValue]
'original line was useful when sending data to HyperTerminal.
'original line: serout2 tx, n9600, ["peak reading", DEC peakValue, 13,10]
pause 100
Goto main

Processing code reference

import processing.serial.*;

Serial myPort; // The serial port

// initial variables:
int i = 1; // counter
int inByte = -1; // data from serial port

void setup () {
size(400, 300); // window size

// List all the available serial ports
println(Serial.list());
// I know that the third port in the serial list on my mac
// is always my Keyspan adaptor, so I open Serial.list()[2].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600);

// set inital background:
background(0);
}
void draw () {
if (myPort.available() > 0) {
inByte = myPort.read();
serialEvent();
}
}

void serialEvent () {
// draw the line:
stroke(0,255,0);
line(i, height, i, height - inByte);
// at the edge of the screen, go back to the beginning:
if (i >= width) {
i = 0;
background(0);
}
else {
i++;
}
}

Monday, January 23, 2006

Sensors in daily life

I'm having trouble figuring out which is sensor and which is switch. What's the border line?

My Roomba, a vacuum cleaner. It certainly has sensors which I don't know what it is exactly.
Remote controls for Roomba, TV, DVD, and a Cable set.-IR...What's IR?
Elevator door, button.
My Mac
My refridge, oven, fire alarm.
At ITP, there's bunch. Cameras...
Treadmill...Speed, heartbeat conter, distance counter...
Cap
Restroom-tap. Motion sensor
etc.

Class Link

My name is Sol Huh

I'm first year ITPier, loving and caring person.
My background is in Fine Art major and Multi media minor.
I participated in the winer show 2005 with my interactive screen using accelerometer.
I wasn't really great at Pcomp last semester though I loved to be creative and productive.
My interests were very much into art stuff such as painting, installation, and video art.
I thought myself was pretty handy which I totally lost the concept of being handy in ITP.
I hope that this class helps me using and learning various types of sensors.
To be honest, I'm bit afraid of physics.
If I can catch up the class until the end of semester, that would represent how much I struggled against my lack of fundamental knowledge.
I am certain that would happen.