sensor workshop

Manufactural Letter.class1

Sensor Walk.class2

 

Class 5. Data Logging

 

1. photocell -> Arduino -> Processing -> server (php ->.txt)

I trade a sensor with So-Young. This time I used a photocell sensor which have value from 0 to 1023. But I guess it rarely has 0 value. Arduino code is from Jamie’s.

datalog

 

2. create a logger.php file in BBedit, and datalog.txt file. php code is also from Jamie’s.

 

 

3. send a serial to the processing. Make sure that change some code.

// send the HTTP GET request:
  // These net two lines form a standard Request-URI used to request a resource after a
  // TCP Client is created (above)
  // The particular resource that we're requesting is a php script, which is passed the
  // variable 'tempValue'.

  client.write("GET /~ja771/sensorworkshop/datalogger/logger.php?tempValue=" + sensorValue + " HTTP/1.1n");
  client.write("HOST: itp.nyu.edunn");
  netSendInProgress = true;

 


—> ~yjc272/sensorWorkshop/datalog.txt as I created in my ftp server.

 

4. The final data logging consequences.

datalog

 

 

 

5. Question and problem

I wanted to do ‘PHP to MySQL’, but couldn’t really finish it since my lack of knowledge about database programming .

 

Class 4. Data sheet study

MC14468 : Ionization Smoke Detector IC with Interconnect

I choose smoke detective sensor for data sheet analyze and final project. The MC14468, when used with an ionization chamber and a small number of external components, will detect smoke. When smoke is sensed, an alarm is sounded via an external piezoelectric transducer and internal drivers. This circuit is designed to operate in smoke detector systems that comply with UL217 and UL268 specifications.

MC14468 Features

  • Ionization Type with On–Chip FET Input Comparator
  • Piezoelectric Horn Driver
  • Guard Outputs on Both Sides of Detect Input
  • Input–Production Diodes on the Detect Input
  • Low–Battery Trip Point, Internally Set, can be Altered Via External Resistor
  • Detect Threshold, Internally Set, can be Altered Via External Resistor
  • Pulse Testing for Low Battery Uses LED for Battery Loading
  • Comparator Output for Detect
  • Internal Reverse Battery Protection
  • Strobe Output for External Trim Resistors
  • I/O Pin Allows Up to 40 Units to be Connected for Common Signaling
  • Power–On Reset Prevents False Alarms on Battery Change

 

data sheet : MC14468

Sensor device data : DL200

 

Additional System(?) ‘UL217, UL268′, which apply with MC145012

UL 217 : Single and Multiple Station Smoke Alarms

1.1 These requirements cover electrically operated single and multiple station smoke alarms intended for open area protection in indoor locations of residential units in accordance with the National Fire Alarm Code, NFPA 72, smoke alarms intended for use in recreational vehicles in accordance with the Standard for Recreational Vehicles, NFPA 501C, and portable smoke alarms used as “travel” alarms. 1.2 A single station smoke alarm, as defined by these requirements, is a self-contained fire alarm device that consists of an assembly of electrical components including a smoke chamber, alarm sounding appliance, and provision for connection to a power supply source, either by splice leads or a cord and plug arrangement or containing integral batteries. Possible accessories include a supplemental heat detector, terminals for connection to a remote audible signaling appliance or accessory, and an integral transmitter to energize a remote audible signaling appliance.

1.3 Multiple station units are single station smoke alarms that are either interconnected for common alarm annunciation or connected to remote thermostats.

1.4 These requirements, where applicable, also cover all remote accessories that are to be connected to or are intended to be used with a single or multiple station smoke alarm. See 33.2.1.

1.5 This standard does not cover the following:

a) Smoke detectors of the non-self-contained type that are intended for connection to a household or industrial system control unit. These are included in the Standard for Smoke Detectors for Fire Protective Signaling Systems, UL 268.

b) Mechanically operated single and multiple station fire alarm devices that are specified in the Standard for Single and Multiple Station Heat Detectors, UL 539.

c) Heat detectors [except for the requirements in the Fire Test (Heat Detector), Section 73] incorporated as part of a single station smoke alarm assembly whose requirements are covered in the Standard for Heat Detectors for Fire Protective Signaling Systems, UL 521.

UL 268 : Smoke Detector For Fire Alarm Signaling System

1 Scope

1.1 These requirements cover smoke detectors intended to be employed in indoor locations in accordance with the National Fire Alarm Code, NFPA 72. These requirements also cover mechanical guards used to provide physical protection to installed smoke detectors.

1.2 A smoke detector, as covered by these requirements, consists of an assembly of electrical components coupled with a sensing means inside of a chamber, or by separate components, to detect smoke. The detector includes provision for the connection to a source of power, signaling, and remote control circuits. A heat detector, or audible signaling appliance, or both, are not prohibited from being incorporated as part of the smoke detector assembly.

1.3 These requirements cover the following types of detectors:

a) Detectors intended for open area protection and for connection to a compatible power supply or control unit for operation as part of a fire alarm system.

b) Detectors intended solely for control of releasing devices such as electromagnetic door holders, fire dampers or smoke dampers.

c) Detectors intended for both the applications described in (a) and (b) above.

1.4 This standard does not cover the following:

a) Control units to which the detectors are intended to be connected that are covered by the Standard for Control Units for Fire-Protective Signaling Systems, UL 864.

b) Self-contained single and multiple station smoke detectors, not intended for connection to a system control unit, that are covered by the Standard for Single and Multiple Station Smoke Alarms, UL 217.

c) A heat detector incorporated as a part of a smoke detector assembly, and covered by the Standard for Heat Detectors for Fire Protective Signaling Systems, UL 521; except for the requirements of the Fire Test (Heat Detector).

d) Fire tests for smoke detectors integral with combination door closers and holders that are covered by the Standard for Door Closers-Holders, With or Without Integral Smoke Detectors, UL 228.

e) Commercial-residential detectors not intended for connection to a system control unit that are covered by the Standard for Smoke Detector Monitors and Accessories for Individual Living Units of Multifamily Residences and Hotel/Motel Rooms, UL 1730.

1.5 These requirements also cover all remote accessories that are intended to be connected to a smoke detector.

1.6 A product that contains features, characteristics, components, materials, or systems new or different from those covered by the requirements in this standard, and that involves a risk of fire, electric shock, or injury to persons shall be evaluated using the appropriate additional component and end-product requirements as determined essential to maintain the intended level of safety as originally anticipated by the intent of this standard. A product whose features, characteristics, components, materials, or systems conflict with specific provisions of this standard cannot be judged to comply with this standard. Where identified as appropriate, revision of requirements shall be proposed and adopted in conformance with the methods employed for development, revision, and implementation of this standard.

 

Class 3. Sensors & Time : Potentiometer

pot4 pot5

The original potentiometer is a type of bridge circuit for measuring voltages by comparison between a small fraction of the voltage which could be precisely measured, then balancing the two circuits to get null current flow which could be precisely measured. The word itself derives from the phrase “voltage potential,” and “potential” was used to refer to “strength.” The original pot

entiometers are divided into four main classes: the constant resistance potentiometer, the constant current potentiometer, the microvolt potentiometer and the thermocouple potentiometer.

potentiometer

In modern usage, a potentiometer is a potential divider, a three terminal resistor where the position of the sliding connection is user adjustable via

a knob or slider. Potentiometers are sometimes provided with one or more switches mounted on the same shaft. For instance, when attached to a volume control, the knob can also function as an on/off switch at the lowest volume.

Ordinary potentiometers are rarely used to control anything of significant power (even lighting) directly due to resistive losses, but they are frequently used to adjust the level of analog signals (e.g. volume controls on audio equipment) and as control inputs for electronic circuits (e.g. a typical domestic light dimmer uses a potentiometer to set the point in the cycle at which the triac turns on). Potentiometers used to control high power are normally called rheostats.

pot 6

Last week, we went over the types of Sensors, A Taxonomy of sensors, Resistive and capacitive sensors, Piezoelectric sensors, etc. Linearity and non-linearity: Characterizing sensors through simple graphical methods is the purpose of this week assingment.

*Graphics of Potentiometer : green ball represents the raw value from pot. gray ball stands for the weighted average value of pot. The graph goes gradually red, showing the past record so that you can compare the change of the value. Also it goes bigger or smaller as the values does.

data1

data3

-Generated in processing
<<Arduino Code>>

// Sending two pieces of data, deliminated by a header – “A”, “B”, at the beginning -
// and a line break at the end.

// based on stuff from Melvin Ochsmann and Tom Igoe.
// reworked a bit for Sensor Workshop class by Jamie Allen, 2007

int sensorPin1 = 4; // select the input pin for sensor
//int sensorPin2 = 5; // 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 lastVal;

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

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

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

val2 = (1*val1 + 9*lastVal)/10; //almost the same as the above but using integer math
lastVal = val2;

Serial.print(“B”); //h3ader ariable, 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

delay(10);
}

=======================================//

<<Processing Code>>

/*
psychadelic dataviewer with FAKE hysteresis
for two values based on Tom Igoe’s & Melvin Ochsmann’s work by Jamie Allen 2007
visually refurbished by Younji Choi 2007 Feb

This program takes raw bytes from the serial port that are seperated by headers
“A”, “B”, etc. at 9600 baud and graphs them.

Note that the data protocol in this case is not very efficient. We’re taking in
a byte for each character in the incoming number (i.e.: worst case, we’re actually
reading in “A,X,X,X,X,_,B,X,X,X,X,_” or TWELVE BYTES, 12 x 8 = 96 bits. The
‘information content of this data is actually 2 x 10 bits = 20 bits (the ADC results
themselves, at 10 bits each). We’re therefore adding an overhead of 76 bits in our
protocol! There are better ways to approach this, but this method is good because
it allows us to ‘see’ the incoming data in an inteligible way in the Arduino serial
monitor or other terminal programs.

The reason this is ‘fake’ hysteresis is that the data ‘trails’ in this example
are being generated by the graphics context. The data is not being used in the
creation of what appears to be a data history.

Arduino code for sending this data in the first place from the board is
commented in below the Processing code

*/

import processing.serial.*;

Serial myPort; // The serial port
PFont myFont, font; // The display font:

// initial variables:

String buff = “”;
int val = 0;
int NEWLINE = 10;
int i = 1; // counter
int valueA, valueB; // the converted data from serial port

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

float valNormA, valNormB; // normalized values of A and B

String bufA=””, bufB=””; // buffers in which to store ascii data as it comes in
//String inString;
boolean buf;

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

void setup () {
size(800, 500); // window size
frameRate(60);

myFont = loadFont(“BankGothic-Medium-18.vlw”);
textFont(myFont, 16);
textAlign(CENTER);
// textMode(SCREEN);
fill(#E9FF5B, 200);
smooth();

// set inital background:
background(#000000);
strokeCap(ROUND);
ellipseMode(CENTER);
strokeWeight(3);

// 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);
//myPort.bufferUntil(lf);
}

void draw()
{

fill(204,102,0,1);
//fill(0,1);
rect(0,0, width, height);

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

valNormA = valueA/1023.0; //this is a ‘normalized’ sensor value 0.0 – 1.0
valNormB = valueB/1023.0;

stroke(#555FFF,200);
fill(#55F555);
variableEllipse(i, height – valNormA*height, 0, 0); // plain rendering of data

stroke(#FF55FF,70);
fill(#333333);
variableEllipse(i, height – valNormB*height, 0, 0);

// at the edge of the screen, go back to the beginning:
if (i > width) {
i = 0;
background(#000000);
fill(0,1);
rect(0,0, width, height);
}
else {
i++;
}

//only display the value once every 25 readings
//just to keep things clean
if (wrote > 50)
{
fill(#FFFFFF);
textFont(myFont, 16);
text(valNormA, i, (height – valNormA*height)-30);
textFont(myFont, 16);
text(valNormB, i, (height – valNormB*height)-45);
wrote = 0;
println(“valNormA=”+valNormA);
println(“valNormB=”+valNormB);
}
wrote++;

font = loadFont(“BankGothic-Light-15.vlw”);
textFont(font,12);
textAlign(LEFT);
fill(0, 102, 153);
text(“above green ball stands for the raw value”, 20,450);
text(“below gray ball stands for the weighted moving Average value”, 20,470);
}

//Serial parsing stuff to get the raw values from
//the serial event
void serialEvent(int serial){
if(serial!=10) {
if (serial==’A’) buf = true;
if (serial==’B’) buf = false;
if (buf){ if (serial!=’A’) bufA += char(serial);
}else{
if (serial!=’B’) bufB+= char(serial);
}
} else {
if (buf){ valueA = int(bufA); bufA=””;
} else { valueB = int(bufB); bufB=””;
}
}
// println(valueA);
// print(valueB);
}

void variableEllipse(int x, float y, int px, int py)
{
float speed = abs(y-py)/10;
// stroke(speed);
ellipse(x, y, 50-speed, 50-speed);
println(speed);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s