2010
04.19

ITP sensor visualization processing sample from fxydesign on Vimeo.

2010
04.12

Nick want me to run a workshop for students about openLog and sensors. I use one photocell and ultrasonic range finder sensor as an example. Since most time people use sensors, either record sensor value constantly, or record whenever a big change happens. These two sensor are perfectly for this application.

Openlog are dataloggers taking serial values, so  I use software library to get a screen monitor as well, super useful for debugging. And for the distance sensor, I write some algorithms to catch the peak value whenver a change happens, it average 100 samples at the beginning, and record changes with timeline encoded. I attached all the codes in the download links.

The I realized google have javascript visualization code available, so I start to play with them. For the photocell, since I print only sensor values line by line in arduino, so I use the sample rate as a timer, time coded in processing to print java like code for google viz – using image line chart.

function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('timeofday', 'Time');
data.addColumn('number', 'Lights of Room');
data.addRows(10);
data.setCell(0,0,[12,25,37]);
data.setCell(0,1,23);
... ...
data.setCell(9,0,[12,25,46]);
data.setCell(9,1,23);
new google.visualization.ImageLineChart(document.getElementById('visualization')).
draw(data, null);
}

Google Visualization API Sample

For the distance sensor, I remember saw a new about a bike project in copenhagen, they have a sensor installed on the bike lane, with a giant LED screen on it, every time one bike passes, the screen show a number increase. So I use this idea to test the sensor. Every time the distance is shorter, I catch the change and print time encoded message into the datalogger, eg (12:53:17 one bike). For viz on the google chart,  I take the time, count the number in every minutes, and print jave like code for google viz – using column chart.

function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('timeofday','Time');
data.addColumn('number', 'Number of Bikes');
data.addRows(42);
data.setCell(0,0,[12,25,0]);
data.setCell(0,1,0);
......
data.setCell(41,0,[12,6,0]);
data.setCell(41,1,0);
new google.visualization.ColumnChart(document.getElementById('visualization_ultrasonic')).
draw(data,
{title:"Bike Lane Analytics",
width:600, height:300}
);
}
google.setOnLoadCallback(drawVisualization);

Google Visualization API Sample

download

ps: to use google viz in your wordpress page, use ‘custom field shortcode‘ plugin.

2010
03.22

Assignment: Visualization the data source in Adobe AI.

Data: 5 different things logged in one week.

tool: I use daytum to log all my infomation.

Here is my visualization:

2010
03.06

Picture 1

OpenLog

WHAT IS THIS:

OpenLog is an open source data logger, available from SparkFun. It takes serial data and write into a microSD card. It can be connected to a microcontroller, such as Arduino.

Feather:

  • small size
  • integrating a MicroSD card writer
  • support MicroSD card  up to 2GB, ONLY FAT16 format
  • Support high sample rate
  • Power usage about 18mA at Maximum rate
  • Take either 3.3V or 5V Power

How to format

HOW TO CONFIG:

Wire your openLog with USBtoSerial Adapter or using Arduino. If you use USBtoSerial adapter, you connect Rx to Tx, Tx to Rx, check this as reference. If you use Arduino, connect your Rx pin on arduino to Rx pin on openLog, Tx to Tx. Here is the diagram how to wire it.(you need to upload a blank code or any code without serial communication).

openLog_Config

you can use any serial program(such as coolterm/cornflakes) to configure it. I use terminal below. Here are the steps you take once you’ve got the serial port open:

  1. type “Control + z to get into the configuration mode”
  2. ….config it…. check commend sets for more details
  3. type “set”
  4. type 1 to get into ‘LOG’ Mode.

if your arduino have some serial communication code running, the terminal will print the data out, you can’t get into the config mode. If you have problem from changing into Log mode, you might need to update the firmware of it. Since it’s a AMTEL chip, same as arduino, you can use avrdude to do it. I will post one tutorial later.)


HOW TO LOG DATA:

OpenLog can log data, but don’t have any analog inputs. It take whatever serial inputs and write it down into the mircoSD card. So you need a microcontroller like arduino to read the sensor data and pass them to openLog using serial. In openLog, you can have more file controls on the SD card side, like log into different file…etc. I’ll take a photocell as an example:

openLog_LOG

You notice from the diagram above, you connect your Rx pin to Tx pin, Tx pin to Rx pin. It’s different from the config mode. To test it out, simply choose an example code from arduino: File->Exmaples->Analog->AnalogInSerial. Then openlog will log your data line by line into your microSD card. The simple way to play with it is changing delays to change the sample rates. Like delay(100) means 10 samples per second. You can also add serial.println to change your data format, like Serial.println(“Sensor1: “)……

HOW TO READ THE LOG DATA:

Use a SD card reader or when you config the openLog, there is command to do it as well.

2010
03.05

Picture 9

uLog

WHAT IS THIS?

uLog is a tiny analog logging device from Sparkfun.  The uLog have an onboard flash memory mated with a ATtiny24. It don’t need a microcontroller, but can only take data on three analog inputs.

Feature:

  • small size
  • have 3 analog inputs
  • on/off switch on board
  • designed for 3-axis accelerometer
  • 16MB data size
  • 50Hz sampling rate
  • about 2 hours logging space
  • battery usage about 4mA per hour

HOW TO LOG:

Let’s use a photo cell as an example:

usLog_battery

Connect to your battery, you will see the red light flashes.  Then connect your sensor to one of the three input pins, use your breadboard to help you wire it up. Then you are ready to go. Turn on the on/off switch on the back to log the data. (Remember, don’t wire any thing on the Tx/Rx when you log your data, any wire on them will cause the Logger into configuration mode). The uLog only have 16MB space for data, it automatically append the new data into the ends and overrides the old one (from the beginning) if the memory full.

HOW TO READ THE LOG:

Use a USBtoSerial adapter to wire your uLog. Need 3.3 voltage one, not 5 voltage.( If you don’t have one, you can use your arduino instead, either pulling out the ATMEL chip or upload a code without any serial communications,check this as reference). Here is how your wire it. (If you use arduino,  Tx<->Tx Rx<->Rx, connect your Tx to Tx, Rx to Rx).

usLog_FTDI

Basically, if you send ‘r’ to your serial port, the uLog will send all the logged data, if you send ‘e’ to your serial port, the uLog will erase the memory.

Based on Tom Igoe’s processing code, I filter the noise data and convert hex into integers.

Run the sketch, type ‘r’ in the opened window to read the data, type ‘e’ to erase the data.


import processing.serial.*;

Serial myPort; // instance of the serial library
String dataString = ""; // string of data for each set of readings
String[] data = {""}; // array to save strings to a file
boolean reading = false; // whether or not you're reading from the logger

String filename = "datalog.txt"; // string to save the file to
int lineCount = 0; // count of the number of lines in the file

void setup() {
// open the serial port:
myPort = new Serial(this, Serial.list()[0], 38400);
// flush the serial buffer:
myPort.clear();
}

void draw() {

}

void serialEvent(Serial myPort) {
// get a byte:
int inByte = myPort.read();
// do something different depending on what the byte is:
switch(inByte) {
case '?': // response prompt
// if you're already reading from the logger,
//save the results to a file:
if (reading) {
saveStrings(filename, data);
// you're done reading:
reading = false;
// print the linecount:
print("lineCount: " + lineCount + "\0\r");
}
// print the prompt:
println(char(inByte));
break;
case '\r': // carriage return at the end of each line:
// make sure you have at least four characters:
if (dataString.length() > 4) {
//filter the data and covert from hex to integer
String[] t = splitTokens(dataString);
String newData = "";
try{
for(int m = 0; m < t.length; m ++){
if(t[m].length() == 4){
int value = unhex(t[m]);
newData = newData + ' ' + value;
}
}
}
catch(Exception e){
break;
}
// add this string to the data array:
data = append(data, newData);
println(newData);
// increment the line count:
lineCount++;
}
// clear the string variable for the next string:
dataString = "";
break;
case '\n': // newline: get rid of them
break;
default: // any other character:
// add character to the string:
dataString += char(inByte);
break;
}
}

void keyReleased() {
if (key == 'r') {
reading = true;
println("Reading from logger...");
// send keystroke to the logger
myPort.write(key);
}

if (key == 'e') {
println("erasing data from logger...");

// you're erasing all the data on the logger
// wait until the LEDS stop flashing before you disconnect it!
// send keystroke to the logger
myPort.write(key);
}

}

2010
02.01

Week One

2010
01.26

Nick on the class showed his photo collection of all capuchino coffee he drinks everyday. After see that and heard the story of Nicholas Feltron’s annual report, I start to understand why people start to fast document their daily life. Like twitter, foursquare, daytum, one good thing of this, it’s trackable, most of the data are stored online, you can always go back to look at those pictures, another good thing of those are statics, by learning your ‘past history’ from your own document, people will know themselves better, they will have better ideas of their future plan/decision. It become one of people’s self motivation. like CAD(computer aided design), I’d call it WAM(web aided motivation). Nike + is a great example of it.

For the first week homework, Nick want us to use our cellphone camera/portable camera to document 10~20 photos to tell a story. I thought it’s a simple homework, however, 3 days already past, I haven’t decided what kinds of photos will best tell a story. I start to brainstorm, re think the concept. Information from a photo will tell a story. I was just looking at my poster wall at home…ideas…ideas…

My idea is every time I take a photo, I use three steps to add more informations of it.

1> find a poster which catches my eyes, use iphone take a photo of it.

2>go to the picture folder, view the photo I took and take a snap shot, so I can add time information to the photo

3>open google map on the phone, and locate my position and take a snap shot

after these three steps, I have one photo of one event I interested, I know where I find the poster, I know when I find it.

2009
04.26

4-in-4 close my eyes for 6 hours

Sometimes I liked to close my eyes and try to see how far I can go, but it really scared me everytime. I think I need to build confident to walk far. So in todays project, I closed my eyes, to learn experience of a blind person. I wrote a dairy in my laptop with ‘voice over’ turned on, listen to iTune music, played LEGO for about 4 hours(really need patience), successful went to bathroom(of course sit to pee, easier!). It’s a fun experience, hope anyone can give it a try. Here is the Dairy I typed with my eyes closed.

4-in-4 Day 4
In today’s project, I decide to close my eyes for 6 hours. I want to let my eyes have winter special break also. And this will be my first time I intend to close my eyes for this long. Since I prepared everything on my table, I don’t feel scared as I expected, maybe I haven’t start to learn how to walk(or meet any failure). I can do very limit thing on my computer, like listen to music from itune or pandora.com, but I don’t know the how to choose one. The voice over function is very helpful, I’m using it to guide me type now. I learned I need to type very carefully, make as less problem as possible, because once I made mistake, I need to listen what I delete,find the right position, and start to type agin. The way you listen to delete words i like to read a word backward. This is also one weird thing Ilearned of typing today. And I just realised the voice over is very smart. When I typed ‘learnd’ instead of ‘learned, the system know it is not right, so when delete from the back, the voice over will read out misspelling d’. Isn’t SMART! Also, if you turn on the’capital’ key, when you type the system will rea out the letter in an excited voice. The next thing I did is playing LEGO. I had a LEGO box of different parts. I have to classify all the parts first by touch. Then, I can figure out what kind of shapes I can build. I decide start with building a car. To make it more fun, I build 3 layers on it. It needs lots ofPATIENCE. I remembered I rebuilded 4 times for the base. Every time I only need to adjust a little bit. I spend about 4 hours on it. Sometimes I dropped parts on the floor, I can know the basic area to find because of the dropping sound; sometimes I can recognize people by nose. I know petra came around by recognizing her perfume. The things different from normal people is I need to use my brain to memorize everything, which is so different from memorizing pictures. Our eyes are so powerful, we rely on it too much. When I start to walk to the bath room, about 20 meters away. I can’t walk straight. I’m alittle scared. I think I knew I won’t get hurt and all my friends are not far away, I can call for help at any time.And I made it.But I waled really careful. Seems like everything slowed down. and feels more lonely and not confidentableTo feel the world as a blind person, II think people who can’t see, needs more tolerence from society.

LEGO Car:

2009
04.26

I saw a video from youtube long time before, a guy made a machine to shoot a peanut into the air. When I discussed with Ben, I remembered this video, also I was impressed by Vikram’s laser shot machine, so I came up the idea to combine these two things together. We start to build with LEGO, but it turns out, lego is too light, not enough energy. So we went to ITP second ER ‘Trash Shelf’, we found everything we thought we could use. And finally, we made this little funny machine. Thanks Ben and all the testers.

2009
04.26

2-in-4 Pipe Organ Toy

This toy is not well desigend yet, after I cut, sand, drill in 5 hours, I realize I forget(/don’t know I need to) to put the ‘Languid’, which to make the air over the hole. Also I can’t find a store to buy small springs, which are used to push the key up. At last, I made a dream(/fake) video to illustrate my little instrument. Here it is: