Friday, March 21, 2008

Data logging

I try to data log with Do son chip and Micro SD card.


First I try to make and save data at SD card from potentiometer.



I can save data easily at computer by processing, but it seem not the exactly same data at Arduino.

It looked like a kind of BYTE , HEX problem.




After I saved a file used processing, I couldn't nothing to do with.

I try to save at SD card, but I failed to save.

I used all of sample code at class wiki.


Those are result files


All of text files are meaningless.


http://itp.nyu.edu/physcomp/sensors/Code/4dSystemsByte

from this code.


1. http://itp.nyu.edu/~sk2745/sensor/3.TXT

2. http://itp.nyu.edu/~sk2745/sensor/1.TXT



Arduino
Code.
//-------------------------------
byte fileCounter = 5 ;
byte sensorCounter = 0;
boolean done = false;
void setup(){
pinMode(11,OUTPUT);
Serial.begin(19200);
// have device warm up
delay(1000);
// send two Carraige Returns to AutoSet Baudrate
Serial.print('\r',BYTE);
Serial.print('\r',BYTE);
delay(1000);
Serial.print('q',BYTE);
Serial.print('\r',BYTE);
delay(1000);
setupFile();
delay(1000);
}
void loop(){
if(!done){
if(sensorCounter <>
byte analog = analogRead(0) / 4;
Serial.print("w #1 2"); // send 2 bytes (one is the sensor number,one is the \n for reading later)
Serial.print('\r',BYTE);
delay(1000);
Serial.print(analog,BYTE);
Serial.print('\n',BYTE);
Serial.print('\r',BYTE);
sensorCounter++;
} else {
digitalWrite(11,HIGH);
done = true;
}
}
delay(1000);
}
void setupFile(){
Serial.print("ow A:\\DATA");
Serial.print(fileCounter,DEC);
Serial.print(".TXT");
Serial.print('\r',BYTE); // CR to send message
}
//------------------------------------------------------------------------


from this code.


3. http://itp.nyu.edu/~sk2745/sensor/DATA3.TXT

4. http://itp.nyu.edu/~sk2745/sensor/DATA5.TXT




Problem
1: How to save exactly right serial data to computer and micro SD card

2: How to read data inside micro SD card

3: Is it possible to use Arduino as a serial to usb device?

Sunday, March 2, 2008

Datasheet Report:

Datasheet Report

LHI878 - LHi 878 Standard Dual Element Detector
http://optoelectronics.perkinelmer.com/

Human and animal emitte infraed light which range is 9.4uM.
The LHi 878 can detect 8~14uM infraed light.

The LHi 878 pyroelectric infrared-detector series are the standard dual element design recommended for all variants of motion control. They include a dual element pyro-electric ceramic with FET in source follower connection. The LHi 878 is available as TO-5 housing with standard infrared filter. It provides for high responsivity with excellent common mode performance (match). RF improved options are available.

*view*
D- supply a voltage to 'Drain'
s - get the signal from the 'Source' which require a load resistor which is recommended to 47 kohm
g - supply GND

*how work*
*configuration*


Datasheet:
click the image



Question.
How can I work with this sensor at Arduino?
Do I have to make some citcuit or something?











Sunday, February 24, 2008

Sensors and Time



Sensors & Time - Graphing, visualizing and characterizing sensor behavior.

Two potentiometer and one photo sell sensors.



Arduino Code

int sensorPin1 = 4; // select the input pin for sensor
int sensorPin2 = 5; // select the input pin for other sensor
int sensorPin3 = 0; // select the input pin for other sensor
int ledPin = 13; // select the pin for the LED
int val1 = 0; // variable to store the value coming from the sensor
int val2 = 0; // variable to store the value coming from the sensor
int val3 = 0;

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(sensorPin1, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(sensorPin2, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(sensorPin3, OUTPUT); // declare the ledPin as an OUTPUT

Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {

digitalWrite(ledPin, HIGH); // sets the LED on

val1 = analogRead(sensorPin1); // read the value from the sensor
val2 = analogRead(sensorPin2); // read the value from the sensor
val3 = analogRead(sensorPin3); // read the value from the sensor

Serial.print("A"); //header variable, so we know which sensor value is which
Serial.print(val1, DEC); //send as a ascii encoded number - we'll turn it back into a number at the other end
Serial.print(10, BYTE); //terminating character

Serial.print("B"); //header variable, so we know which sensor value is which
Serial.print(val2, DEC); //send as a ascii encoded number - we'll turn it back into a number at the other end
Serial.print(10, BYTE); //terminating character

Serial.print("C"); //header variable, so we know which sensor value is which
Serial.print(val3, DEC); //send as a ascii encoded number - we'll turn it back into a number at the other end
Serial.print(10, BYTE); //terminating character

delay(10);
}



============================================


Processing Code

import processing.serial.*;

Serial myPort;
PFont myFont;
String buff = "";
int val = 0;
int NEWLINE = 10;
int i = 1;
int valueA, valueB, valueC;

int[] valuesA = new int[10];
int[] valuesB = new int[10];
int[] valuesC = new int[10];

float valNormA, valNormB, valNormC;
int valnormA, valnormB, valnormC;

String bufA="", bufB="", bufC="";
int buf;

int wrote = 0;
int legendary = 0;
int offset = 0;
int offsettext = 25;
int lf = 10;


void setup () {
size(800, 600);

myFont = loadFont("ArialMT-12.vlw");
textFont(myFont,14);
textAlign(LEFT);
smooth();
strokeCap(ROUND);

background(0);
println(Serial.list());
myPort = new Serial(this, Serial.list()[1], 9600);

line(0, 220, width, 220);
line(0, 440, width, 440);

}

void draw()
{
fill(0,5);
noStroke();
rect(0,0,width,height);

while (myPort.available() > 0) {
serialEvent(myPort.read());
}

valNormA = valueA/1023.0;
valNormB = valueB/800.0;
valNormC = valueC/1023.0;

valnormA = (int)valueA;
valnormB = (int)valueB;
valnormC = (int)valueC;

strokeWeight(5);
stroke(255,100);
fill(0,0,255);
ellipse(i, valNormA*220+100, 20, 20);

pushMatrix();
translate(0, 220);
stroke(255,100);
fill(0,255,0);
ellipse(i,valNormB*1000+100, 20,20);
popMatrix();

pushMatrix();
translate(0,440);
stroke(255,100);
fill(255,0,0);
ellipse(i,160/2 - valNormC*160, 20, 20);
popMatrix();

if (i > width) {
i = 0;
pushMatrix();
strokeWeight(2);
fill(0,1);
rect(0,0, width, height);

popMatrix();
}
else {
i++;
}

if (wrote > 30)
{

fill(255);
text(valnormA, i, ( valNormA*220)+80);
pushMatrix();
translate(0, 220);
fill(255);
text(valnormB, i, ( valNormB*1000)+80);
popMatrix();
pushMatrix();
translate(0, 440);
fill(255);
text(valnormC, i, (160/2 - valNormC*160)+60);
popMatrix();
wrote = 0;
}
wrote++;

}

void serialEvent(int serial){
if(serial!=10) {
if (serial=='A') buf = 1;
if (serial=='B') buf = 2;
if (serial=='C') buf = 3;

if (buf==1) {if (serial!='A') bufA += char(serial);}
else if (buf==2) { if (serial!='B') bufB+= char(serial);}
else if (buf==3) { if (serial!='C') bufC+= char(serial);}
} else {
if (buf==1) {valueA = int(bufA); bufA="";}
else if (buf==2) {valueB = int(bufB); bufB="";}
else if (buf==3) {valueC = int(bufC); bufC="";}
}
}

Sunday, February 10, 2008

Sensor walk

Sunghun Kim :: 8 February 2008

1. Ipod touch sensor
2. Elevator Door Sensor - IR
3. subway card reader
4. Grocery Store Doors - IR/Motion detect
5. Bar code reader
6. ATM card reader
7. Bathroom: automatic toilets - IR
8. NYU library entrance's card reader
9. Library book barcode reader
10. Heating system - Thermo-sensor
11. Lights on streets. - Light/timer sensor

Manufacturer Descriptions

precipart.com
- custom motion control products and devices, custom gear & gearbox

sensicast.com
- Ambient Temperature and Humidity, RTD (wireless temperature measuring devices) real-time temperature and humidity monitoring devices

kavlico.com
- Pressure Automotive Position Force Sensors

emxinc.com
- Color sensors : color, color mark, luminescent, brightness level

This blog is for Sensor Workshop at ITP S2008