Updates from Jun Sik (Jason) Kim Toggle Comment Threads | Keyboard Shortcuts

  • Jun Sik (Jason) Kim 8:47 am on December 16, 2011 Permalink | Reply  

    Moduled the multipurpose lamp 

    Moduled is a multipurpose lamp for people who are in need of different functions, forms, and colors of lighting. It is composed of trapezoidal modules. The white module is where Luxeon high intensity LEDs, heat sinks, BlinkM RGB LEDs, on/off switch, battery pack, rare earth neodymium magnets, Arduino, 3 potentiometers (one to control white LED brightness, one to control hue of RGB LEDs, and one to control brightness of RGB LEDs) are. The white module is the main part that provides the light according to the user’s desires. The black trapezoidal modules also contain rare earth magnets to stick to the white module. The black modules are supplementary to the white module so that different forms of lamps (standing lamp, desk lamp, night lamp, etc.) can be created. Now, with moduled, people can take apart or build lamps out of simple trapezoidal figures and create whatever color and brightness of light they need.

    The code below uses blinkM’s .h file that can be downloaded here

    
    #include "Wire.h"
    #include "BlinkM_funcs.h"
    const int blinkm_addr = 0;
    const int hue_pot_pin = 0; //pin0
    const int bri_pot_pin = 1; //pin1
    int lightControl = 2; //pin2
    int lightVal = 0;
    int ledPin[] = {
     3,6,9,10,11};
    
    void setup()
    {
     Serial.begin(19200);
     BlinkM_beginWithPower();
     BlinkM_stopScript(blinkm_addr); // turn off startup script
     Serial.println("BlinkMKnobHue ready");
     for(int i = 0; i < 5; i++){
     pinMode(ledPin[i], OUTPUT);
     }
    }
    
    void loop()
    {
     int hue_val = analogRead(hue_pot_pin) / 4;
     int bri_val = analogRead(bri_pot_pin) / 4;
     Serial.println(hue_val);
     BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val);
     delay(20);
     whiteLight();
    }
    
    void whiteLight(){
     lightVal = analogRead(lightControl);
     int ledVal = map(lightVal, 0, 1023, 0, 255);
     for(int i = 0; i < 5; i++){
     analogWrite(ledPin[i], ledVal);
     int hue_val = analogRead(hue_pot_pin) / 4;
     int bri_val = analogRead(bri_pot_pin) / 4;
     BlinkM_fadeToHSB( blinkm_addr, hue_val, 255, bri_val);
     delay(20);
     }
    }
    
     
  • Jun Sik (Jason) Kim 8:21 am on December 16, 2011 Permalink | Reply
    Tags: driving wheel ver 2, , , jun sik kim   

    Driving wheel version 2 


    This project uses arduino, LOL shield, and two inputs (tilt sensors). Using its shape, it can be tilted in different directions that triggers different animations. In this case, if the cover is upright, the animation seems as if you are driving a car straightforward. If you grab the steering wheel handle and turn it left, an arrow animation going left can be seen. If you turn the handle right, the arrow animation goes towards the right. If flipped upside down, the arrow is headed up which indicates the autodrive mode.

    In version 2, I inserted a potentiometer and 2 super bright white LEDs into the analog pins of the LoL Shield. The left LED is turned on if tilted left and the right LED is turned off if tilted right. When upside down, the LEDs blink to signal auto drive. The potentiometer controls the delay of the animation therefore can represent the acceleration of driving a car.

    (More …)

     
  • Jun Sik (Jason) Kim 8:19 am on December 6, 2011 Permalink | Reply
    Tags:   

    Pulsey the Pulse Sensor Lamp Robot 

    Pulsey the Pulse Lamp Robot is a robot that detects a human’s pulse and reacts by producing light from RGB LEDs accordingly. It uses two blink M RGB leds as its eyes. It uses the servo motor to represent the robots heart-shaped hair. Both the servo motor and the RGB leds react to the human pulse detected from the pulse sensor. Once a pulse is detected, the RGB LEDs fade to a shade of green (much like the green of the pulse sensor). The servo turns once a pulse is detected.
    There are also two potentiometers. One is used to control the HSV of the eye LEDS when it does not detect a pulse. It can be rotated to make the eyes into diverse colors. The other potentiometer is used to adjust the brightness of the eyes therefore giving much more of the color palette. If the brightness is totally reduced, the robot will not light up its eye LEDs unless a pulse is detected.

    
    #include "Wire.h"
    #include "BlinkM_funcs.h"
    
    //Servo Motor
    #include <Servo.h>
    Servo myServo;
    int noTurn = 90;
    int rightTurn = 95;
    int leftTurn = 70;
    
    //Blink M
    int sensorPin = 0;
    int ledPin = 13;
    int sensorValue = 0;
    int blinkm_addr = 0;
    int redVal = 0;
    int grnVal = 0;
    int bluVal = 0;
    // VARIABLES
    unsigned long time;
    unsigned long lastTime;
    int Sensor;
    int lastSensor;
    int Peak;
    int Trough;
    int beats[10];
    int beatCounter = 0;
    int QuantifiedSelf;
    int drop;
    
    int fadeRate = 10;
    int Fade = 0;
    
    boolean falling = false;
    int PulseSensor = 0;
    
    void setup()
    {
     myServo.attach(2);
     myServo.write(noTurn);
     pinMode(ledPin, OUTPUT);
     BlinkM_beginWithPower();
     BlinkM_stopScript(blinkm_addr);
     Serial.println("BlinkMSensor0 ready");
     Serial.begin(115200);
     lastTime = millis();
    }
    void loop()
    {
     Sensor = analogRead(PulseSensor);
     Serial.print("s");
     Serial.println(Sensor);
    
    if (falling == false){
     if (Sensor < lastSensor-1){
     falling = true;
     Serial.print("P");
     Serial.println(Peak);
     myServo.write(rightTurn);
     normalPulse();
    
    }
     else if(Sensor > lastSensor){
     Peak = Sensor;
     lastSensor = Sensor;
     }
     }
     if (falling == true){
     if (Sensor > lastSensor){
     falling = false;
     Serial.print("T");
     Serial.println(Trough);
     drop = Peak - Trough;
     Peak = 0;
     if (drop > 4 && drop <60){
     timeBeat();
     Serial.print("d");
     Serial.println(drop);
     myServo.write(leftTurn);
     greenPulse();
     }
     }
     else if (Sensor < lastSensor){
     Trough = Sensor;
     lastSensor = Sensor;
     }
     }
     delay(100);
    }
    
    void timeBeat(){
     time = millis();
     beats[beatCounter] = time - lastTime;
     lastTime = time;
     beatCounter ++;
     if (beatCounter == 10){
     QuantifiedSelf = getBPM();
     Serial.print("q");
     Serial.println(QuantifiedSelf);
     beatCounter = 0;
     }
    }
    
    int getBPM(){
     int dummy;
     int mean;
     boolean done = false;
    
     while(done != true){
     done = true;
     for (int j=0; j<9; j++){
     if (beats[j] > beats[j + 1]){
     dummy = beats[j + 1];
     beats [j+1] = beats[j] ;
     beats[j] = dummy;
     done = false;
     }
     }
     }
     for(int k=1; k<9; k++){
     mean += beats[k];
     }
     mean /=8;
     mean = 60000/mean;
     return mean;
    }
    
    void normalPulse(){
     sensorValue = analogRead(sensorPin);
     Serial.println(sensorValue);
     grnVal = sensorValue/4;
     BlinkM_setFadeSpeed( blinkm_addr, 50);
     BlinkM_fadeToRGB( blinkm_addr, 255, 255, 255);
     delay(100);
    }
    void greenPulse(){
     sensorValue = analogRead(sensorPin);
     Serial.println(sensorValue);
     grnVal = sensorValue/4;
     BlinkM_setFadeSpeed( blinkm_addr, 50);
     BlinkM_fadeToRGB( blinkm_addr, 0, grnVal, 20);
     delay(100);
    }
    
    void redPulse(){
     sensorValue = analogRead(sensorPin);
     Serial.println(sensorValue);
     grnVal = sensorValue/4;
     BlinkM_setFadeSpeed( blinkm_addr, 50);
     BlinkM_fadeToRGB( blinkm_addr, grnVal, 0, 0);
     delay(100);
    }
    
    

    There is also the BlinkM_funcs.h file that needs to be in the same folder.
    This can be downloaded here

     
  • Jun Sik (Jason) Kim 5:49 am on November 24, 2011 Permalink | Reply  

    Driving wheel 

    This project uses arduino, LOL shield, and two inputs (tilt sensors). Using its shape, it can be tilted in different directions that triggers different animations. In this case, if the cover is upright, the animation seems as if you are driving a car straightforward. If you grab the steering wheel handle and turn it left, an arrow animation going left can be seen. If you turn the handle right, the arrow animation goes towards the right. If flipped upside down, the arrow is headed up which indicates the autodrive mode.

    #include <Charliplexing.h>
    #include "Charliplexing.h"
    #include "Font.h"
    #include "WProgram.h"
    
    byte line = 0;
    char buffer[10];
    int value;
    
    int tiltPin = A5;
    int tiltPin2 = A4;
    
    int tiltState = 0;
    int tiltState2 = 0;
    
    #define SCREEN_WIDTH 13
    #define SCROLL_DELAY 80
    #define REPEAT_DELAY 500
    int textLength, totalPixels;
    char text[]="HI";
    
    void setup()
    {
     LedSign::Init(); //Initializes the screen
     getLength(text, &textLength, &totalPixels);
     pinMode(tiltPin, OUTPUT);
     pinMode(tiltPin2, OUTPUT);
    }
    
    void loop()
    {
     tiltState = digitalRead(tiltPin);
     tiltState2 = digitalRead(tiltPin2);
     if(tiltState == HIGH && tiltState2 == HIGH){
     leftArrow();
     }
     else if(tiltState == HIGH){
     rightArrow();
     }
     else if(tiltState2 == HIGH){
     rightArrow();
     }
     else{
     roadDrive();
     }
    }
    
    void DisplayBitMap(int lineint)
    {
     for (byte led=0; led<14; ++led) {
     if (lineint & (1<<led)) {
     LedSign::Set(led, line, 1);
     }
     else {
     LedSign::Set(led, line, 0);
     }
     }
    
    line++;
     if(line >= 9) line = 0;
    }
    
    void rightArrow(){
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(192);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(1008);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(2040);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(4092);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
    }
    
    void leftArrow(){
     delay(100);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     DisplayBitMap(0);
     delay(100);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     DisplayBitMap(192);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     DisplayBitMap(1008);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     DisplayBitMap(2040);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(4092);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(480);
     delay(100);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(0);
    }
    
    void roadDrive(){
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(720);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(720);
     DisplayBitMap(720);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(720);
     DisplayBitMap(720);
     DisplayBitMap(1224);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(720);
     DisplayBitMap(720);
     DisplayBitMap(1224);
     DisplayBitMap(1224);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(720);
     DisplayBitMap(1224);
     DisplayBitMap(1224);
     DisplayBitMap(2244);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1224);
     DisplayBitMap(1224);
     DisplayBitMap(2244);
     DisplayBitMap(2244);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1224);
     DisplayBitMap(2244);
     DisplayBitMap(2244);
     DisplayBitMap(4578);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2244);
     DisplayBitMap(2244);
     DisplayBitMap(4578);
     DisplayBitMap(4578);
     DisplayBitMap(8193);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2244);
     DisplayBitMap(4578);
     DisplayBitMap(4578);
     DisplayBitMap(9201);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4578);
     DisplayBitMap(4578);
     DisplayBitMap(9201);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4578);
     DisplayBitMap(9201);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(9201);
     delay(100);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(1032);
     DisplayBitMap(1032);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(4098);
     DisplayBitMap(4098);
     DisplayBitMap(8193);
    }
    
    void writeText(){
     int x=0;
     for(int j=SCREEN_WIDTH; j>-totalPixels-SCREEN_WIDTH; j--) {
     x=j;
     LedSign::Clear();
     for(int i=0; i<textLength; i++) {
     x += Font::Draw(text[i],x,0);
     if (x>=SCREEN_WIDTH)
     break;
     }
     delay(SCROLL_DELAY);
     }
     delay(REPEAT_DELAY);
    }
    
    void checkTilt(){
     if(tiltState == HIGH){
     rightArrow();
     }
     else if(tiltState2 == HIGH){
     leftArrow();
     }
    }
    
    void getLength(char* charArray, int* lengthPtr, int* pixelPtr) {
     int charCount = 0, pixelCount = 0;
     char * charPtr = charArray;
     while (*charPtr != '\0' && *charPtr != '\n') {
     charPtr++;
     charCount++;
     pixelCount += Font::Draw(*charPtr,-SCREEN_WIDTH,0);
     }
     *pixelPtr = pixelCount;
     *lengthPtr = charCount;
    }
    
     
  • Jun Sik (Jason) Kim 1:49 am on November 21, 2011 Permalink | Reply  

    Pulse Sensor Presentation 

    By Jason Kim, Rachel Law, and Freddie Andrade

    1)Pulse Sensor Description Presentation

    PulseSensorPresentation

    2)Pulse Sensor Working with LED & working with LOL Shield

    LED Arduino Code and Processing Code (from http://www.pulsesensor.com)

    LOL Shield Arduino Code

    
    #include <Charliplexing.h> //Imports the library, which needs to be
    
    byte line = 0; //Row counter
    char buffer[10];
    int value;
    
    // VARIABLES
    unsigned long time; // Holds current time for pulse rate calculation
    unsigned long lastTime; // Used for calculating time between beats
    int Sensor; // Holds current analog Sensor Reading
    int lastSensor; // Used to find waveform direction
    int Peak; // Holds value of peak in waveform
    int Trough; // Holds value of trough in waveform
    int beats[10]; // Array to collect time between beats for calculating BPM
    int beatCounter = 0; // Used to hold position in beats array
    int QuantifiedSelf; // Used to hold the heart rate value (BPM)
    int drop; // Holds the amplitude of waveform
    
    int fadeRate = 10; // when arduino finds a heartbeat, it will fade an LED on pin 11 (PWM)
    int Fade = 0; // Fade variable will set PWM
    
    boolean falling = false; // used to keep track of waveform direction
    
    // PINS
    int LED = 13; // pin 13 LED blinks on each pulse
    int dimLED = 11; // LED on pin 11 fades with each pulse
    int PulseSensor = 5; // Pulse Sensor purple wire connected to analog pin 5
    
    void setup()
    {
     LedSign::Init();
    
    // pinMode(LED, OUTPUT); // set the LED pins as outputs
    // pinMode(dimLED, OUTPUT);
     Serial.begin(115200); // start the hardware serial block and set the baud rate
     lastTime = millis(); // initialize lastTime variable
    }
    void loop()
    {
     Sensor = analogRead(PulseSensor); // take a reading
     Serial.print("s"); // send raw analog data to Processing sketch (or other)
     Serial.println(Sensor); // 's' = Raw Sensor Data
    // USE WITH LED ON PIN 11 FOR FADE EFFECT
    // Fade -= fadeRate; // Fade variable set to 255 when heart beat is found
    // Fade = constrain(Fade,0,255); // these lines fade the LED
    // analogWrite(dimLED,Fade);
    
    // KEEP TRACK OF THE DIRECTION OF THE WAVEFORM
     if (falling == false){ // if the sensor values are rising
     if (Sensor < lastSensor-1){ // if current reading is less than last reading - noise
     falling = true; // a peak has been reached
     Serial.print("P"); // send peak value to Processing scketch (or other)
     Serial.println(Peak); // 'P' = Peak in waveform
    // digitalWrite(LED,LOW); // turn off pin 13 LED
    // myHeart();
     smallHeart();
     }else if(Sensor > lastSensor){ // otherwise, if current reading is bigger, values are still rising
     Peak = Sensor; // record the next potential peak
     lastSensor = Sensor; // keep track of rising signal
     }
     }
     if (falling == true){ // if the sensor values are falling
     if (Sensor > lastSensor){ // if current reading is bigger than last reading
     falling = false; // a trough has been reached
     Serial.print("T"); // send trough value to Processing sketch (or other)
     Serial.println(Trough); // 'T' = Trough in waveform
     drop = Peak - Trough; // difference = signal amplitude
     Peak = 0; // setting Peak to 0 here helps get rid of noise
    // THIS IF STATEMENT IS HOW THE HEARTBEAT IS FOUND IN PULSE SENSOR WAVEFORM
     if (drop > 4 && drop <60){ // ignore noise in signal. adjust as needed
     timeBeat(); // go work out the BPM
     Serial.print("d"); // send the amplitude to Processing Sketch (or other)
     Serial.println(drop); // 'd' = amplitude of waveform
    // digitalWrite(LED,HIGH); // start pin 13 LED blink
     bigHeart();
    // Fade = 255; // set fading LED to high brightness
    
     }
     }else if (Sensor < lastSensor){ // otherwise, if current reading is smaller weʻre still falling
     Trough = Sensor; // record the next potential trough
     lastSensor = Sensor; // keep track of falling signal
     }
     }
     delay(150);
     //SLOW DOWN!!!!!!!! (LOL SHIELD)
     // break for 20mS. Processing frame-rate = 100.
    
    }// END VOID LOOP
    
    
    void timeBeat(){
     time = millis(); // take note of the current time
     beats[beatCounter] = time - lastTime; // record miliseconds since the last pulse in beats array
     lastTime = time; // stay up to date!
     beatCounter ++; // move array pointer to next position in array
     if (beatCounter == 10){ // if we've taken 10 readings, it's time to derive heart rate
     QuantifiedSelf = getBPM(); // go derive the heart rate
     Serial.print("q"); // send the heart rate to Processing sketch (or other)
     Serial.println(QuantifiedSelf); // 'q' = heart rate
     beatCounter = 0;
     }
    }// END OF timeBeat FUNCTION
    
    
    // This function will return a value for heart rate (Beats Per Minute)
    int getBPM(){
     int dummy; // used in sorting
     int mean; // used in averaging
     boolean done = false; // clear sorting flag
    // this simple sorting routine will arrange values in the beat array from lowest to highest
     while(done != true){
     done = true;
     for (int j=0; j<9; j++){ // simple swap sorts numbers from lowest to highest
     if (beats[j] > beats[j + 1]){ // sorting numbers here
     dummy = beats[j + 1];
     beats [j+1] = beats[j] ;
     beats[j] = dummy;
     done = false;
     }
     }
     }
    // this FOR loop selects the longer beat time values to avoid incorrect heart rate readings
     for(int k=1; k<9; k++){ // exclude lowest and highest values from averaging
     mean += beats[k]; // add beat times together
     }
     mean /=8; // averaging
     mean = 60000/mean; // devide 60 seconds by average pulse length
     return mean; // return beats per minute
    }// END OF getBPM function
    
    
    void smallHeart()
    {
    // delay(2000);
     DisplayBitMap(0);
     DisplayBitMap(0);
     DisplayBitMap(288);
     DisplayBitMap(720);
     DisplayBitMap(528);
     DisplayBitMap(528);
     DisplayBitMap(288);
     DisplayBitMap(192);
     DisplayBitMap(0);
    }
    
    void bigHeart()
    {
    // delay(100);
     DisplayBitMap(0);
     DisplayBitMap(816);
     DisplayBitMap(1224);
     DisplayBitMap(2052);
     DisplayBitMap(2052);
     DisplayBitMap(1032);
     DisplayBitMap(528);
     DisplayBitMap(288);
     DisplayBitMap(192);
    }
    
    void DisplayBitMap(int lineint)
    {
     //int data[9] = {95, 247, 123, 511, 255, 1, 5, 31, 15};
    
     //for(line = 0; line < 9; line++) {
     for (byte led=0; led<14; ++led) {
     if (lineint & (1<<led)) {
     LedSign::Set(led, line, 1);
     } else {
     LedSign::Set(led, line, 0);
     }
     }
    
     line++;
     if(line >= 9) line = 0;
    }
    
    
     
  • Jun Sik (Jason) Kim 6:38 am on November 9, 2011 Permalink | Reply  

    Jason Kim Midterm: Stupid Pumpkin 

    1) Project Name: Stupid Pumpkin

    The concept of the Stupid Pumpkin is relatively straightforward. It’s a pumpkin that looks stupid and a pumpkin that people would want to hit. Using two tilt sensors, I could detect if the pumpkin was hit from the left or from the right. If hit from the right side, the servo motor turns in a clockwise direction (counter clockwise if hit from left) and the Stupid Pumpkin makes a sad face and starts to cry. The LEDs representing the mouth of the pumpkin are controlled by a shift register. The eyes of the pumpkin are RGB LEDs that change color every time the pumpkin is hit. Near the nose (fading superbright blue LED) of the pumpkin is also a photocell that detects if the pumpkin’s nose is covered or if the lights are turned off. If the nose is covered or lights are turned off, the Stupid Pumpkin starts to cry as it is lonely and frightened. The inside of the pumpkin are all wires and circuit boards and uses no bread boards. Circuit boards are screwed on the inside wall of the pumpkin. The Arduino is powered by a 9V battery pack.

    2) A photo of the electronics and final project

    3) A short video demonstrating it

    4) The Arduino code

    <pre>//Midterm Pumpkin Jason Kim
    
    //Photocell
    int photocellPin = A3;
    int photocellReading;
    
    //Servo Motor
    #include <Servo.h>
    Servo myServo;
    int noTurn = 90;
    
    //Shift Register 75HC595
    int SER_Pin = 11;   //pin 14 on the 75HC595 bluewire
    int RCLK_Pin = 8;  //pin 12 on the 75HC595 greenwire
    int SRCLK_Pin = 12; //pin 11 on the 75HC595 yellowwire
    #define number_of_74hc595s 1
    #define numOfRegisterPins number_of_74hc595s * 8
    
    //Pumpkin eyes
    const int redPin = A0;
    const int greenPin = A1;
    const int bluePin = A2;
    const boolean invert = true;
    
    int color = 0;
    int R, G ,B;
    
    //Pumpkin tear eyes
    int eyePin[] = {
      6,3};
    
    int eyePin2[] = {
      9,10};
    
    int brightness2 = 0;
    int brightness3 = 0;
    
    //Pumpkin nose
    int brightness = 0;
    int fadeAmount = 5;
    int nosePin = 5;
    
    //Pumpkin hit (tilt sensor)
    int tiltPin[] = {
      7,4};
    int tiltState = 0;
    int tiltState2 = 0;
    
    //test led
    int testPin = 13;
    
    boolean registers[numOfRegisterPins];
    
    void setup(){
      Serial.begin(9600);
      myServo.attach(2);
      myServo.write(noTurn);
      pinMode(SER_Pin, OUTPUT);
      pinMode(RCLK_Pin, OUTPUT);
      pinMode(SRCLK_Pin, OUTPUT);
      pinMode(nosePin, OUTPUT);
      for(int i = 0; i<2; i++){
        pinMode(tiltPin[i], INPUT);
      }
      for(int j = 0; j<2; j++){
        pinMode(eyePin[j],OUTPUT);
      }
      for(int k = 0; k<2; k++){
        pinMode(eyePin2[k],OUTPUT);
      }
      clearRegisters();
      writeRegisters();
    }       
    
    //set all register pins to LOW
    void clearRegisters(){
      for(int i = numOfRegisterPins - 1; i >=  0; i--){
        registers[i] = LOW;
      }
    }
    void writeRegisters(){
      digitalWrite(RCLK_Pin, LOW);
      for(int i = numOfRegisterPins - 1; i >=  0; i--){
        digitalWrite(SRCLK_Pin, LOW);
        int val = registers[i];
        digitalWrite(SER_Pin, val);
        digitalWrite(SRCLK_Pin, HIGH);
      }
      digitalWrite(RCLK_Pin, HIGH);
    }
    
    void setRegisterPin(int index, int value){
      registers[index] = value;
    }
    
    void loop(){
      tiltState = digitalRead(tiltPin[0]);
      tiltState2 = digitalRead(tiltPin[1]);
      photocellReading = analogRead(photocellPin);
      photocellReading = 1023 - photocellReading;
      if (photocellReading > 500 && photocellReading < 600){
        myTear();
      }
      Serial.print("Photocell reading = ");
      Serial.println(photocellReading);
      //Pumpkin Eyes
      myEye();
      //Pumpkin Nose
      myNose();
      //Pumpkin Hit
      myHit();
      //Pumpkin Mouth
      myHappy();
      writeRegisters();
      if(tiltState == HIGH){
        myServo.write(111);
        mySad();
        myEyeHit();
        writeRegisters();
        myTear();
        delay(500);
        myServo.write(noTurn);
      }
      if(tiltState2 == HIGH){
        myServo.write(71);
        mySad();
        myEyeHit();
        writeRegisters();
        myTear();
        delay(500);
        myServo.write(noTurn);
      }
    }
    void myHappy(){
      setRegisterPin(0, HIGH);
      setRegisterPin(3, HIGH);
      setRegisterPin(5, HIGH);
      setRegisterPin(6, HIGH);
      setRegisterPin(1, LOW);
      setRegisterPin(2, LOW);
      setRegisterPin(4, LOW);
      setRegisterPin(7, LOW);
    }
    void mySad(){
      setRegisterPin(1, HIGH);
      setRegisterPin(2, HIGH);
      setRegisterPin(4, HIGH);
      setRegisterPin(7, HIGH);
      setRegisterPin(0, LOW);
      setRegisterPin(3, LOW);
      setRegisterPin(5, LOW);
      setRegisterPin(6, LOW);
    }
    void myNose(){
      analogWrite(nosePin, brightness);
      brightness = brightness + fadeAmount;
      if (brightness == 0 || brightness == 255){
        fadeAmount = -fadeAmount;
      }
      delay(30);
    }
    void myHit(){
      if(tiltState == HIGH){
        digitalWrite(testPin, HIGH);
      }
      else if(tiltState2 == HIGH){
        digitalWrite(testPin, HIGH);
      }
      else{
        digitalWrite(testPin, LOW);
      }
    }
    void myTear(){
      for(int i =0; i < 2; i++){
        //one LED fade
        for(int brightness2 = 0; brightness2 <= 255; brightness2 +=5){
          analogWrite(eyePin[i], brightness2);
          //      analogWrite(eyePin2[i],brightness2);
          delay(10);
        }
        for(int brightness2 = 255; brightness2 >= 0; brightness2 -=5){
          analogWrite(eyePin[i],brightness2);
          //      analogWrite(eyePin2[i],brightness2);
          delay(10);
        }
      }
    }
    void myLeftTear(){
      for(int i = 0; i < 2; i++){
        //one LED fade
        for(int brightness3 = 0; brightness3 <= 255; brightness3 +=5){
          //      analogWrite(eyePin[i],brightness2);
          analogWrite(eyePin2[i],brightness3);
          delay(10);
        }
        for(int brightness3 = 255; brightness3 >= 0; brightness3 -=5){
          //      analogWrite(eyePin[i],brightness2);
          analogWrite(eyePin2[i],brightness3);
          delay(10);
        }
      }
    }
    void myEye(){
      int brightnessEye = 255;
      hueToRGB(color, brightnessEye);
      analogWrite(redPin, R);
      analogWrite(greenPin, G);
      analogWrite(bluePin, B);
      if(color > 255){
        color = 0;
      }
      delay(10);
    }
    void myEyeHit(){
      int brightness = 100;
      hueToRGB(color, brightness);
      analogWrite(redPin, R);
      analogWrite(greenPin, G);
      analogWrite(bluePin, B);
      color+=60;
      if(color > 255){
        color = 0;
      }
      delay(10);
    }
    void hueToRGB( int hue, int brightness){
      unsigned int scaledHue = (hue * 6);
      unsigned int segment = scaledHue / 256; //segment 0 to 5 round the color wheel
      unsigned int segmentOffset = scaledHue - (segment * 256); //position within segment
      unsigned int complement = 0;
      unsigned int prev = (brightness * ( 255 - segmentOffset)) / 256;
      unsigned int next = (brightness * segmentOffset) / 256;
      if(invert){
        brightness = 255-brightness;
        complement = 255;
        prev = 255-prev;
        next = 255-next;
      }
      switch(segment ){
      case 0: //red
        R = brightness;
        G = next;
        B = complement;
        break;
      case 1: //yellow
        R = prev;
        G = brightness;
        B = complement;
        break;
      case 2: //green
        R = complement;
        G = brightness;
        B = next;
        break;
      case 3: //cyan
        R = complement;
        G = prev;
        B = brightness;
        break;
      case 4: //blue
        R = next;
        G = complement;
        B = brightness;
        break;
      case 5: //magenta
      default:
        R = brightness;
        G = complement;
        B = prev;
        break;
      }
    }
    
     
  • Jun Sik (Jason) Kim 4:21 pm on October 28, 2011 Permalink | Reply  

    Stupid Pumpkin 

    1) Project title: Stupid Pumpkin

    2) 2-3 Sentences explaining concept.

    My project is entitled Stupid Pumpkin because it is a pumpkin that people want to hit. It uses numerous LEDs using a shift register and uses blink, fade, multicolored, etc. to show its stupidness. It also has a motor that also turns according to the direction the pumpkin is hit to represent the pumpkin “seeing stars” after he gets hit. I’ve also used LEDs to show the pumpkin crying after he is it. Potentiometers are used so that people can change the pumpkin’s eye color.

    3) 2-3 Sentences on most challenging and most interesting parts of your experimentations.

    It was the first time I was using a shift register and a servo motor. I knew I wanted to use a lot of LEDs but my Arduino could only support so many output pins therefore I used the shift register to connect 8 LEDs to represent the mouth. Understanding the concept of the shift register was quite challenging. Another challenging part was working with the servo motor’s angles. I wanted to control the amount and the angle the servo motor turns and I had to work with a code that detected which numbers represented the turning of the servo motor. What is fun about my project is the servo motor turning according to which side the pumpkin is hit and that the pumpkin cries and makes a sad smiley face when it is it.

     
  • Jun Sik (Jason) Kim 11:08 pm on October 7, 2011 Permalink | Reply  

    Pulse Sensor Group 

    Jun Sik (Jason) Kim

    Rachel Law

    Freddie Andrade

    Amanda Wong

    http://www.pulsesensor.com is the official site for the Pulse Sensor.

    From there, we are going to read:

    1. The startup of the Pulse Sensor on google docs.

    2. Schematics & guidelines to the Pulse Sensor.

    3. And ofcourse the code.

    There are also information regarding the open hardware here.

    It’s going to be real fun learning about the Pulse Sensor!

    This is the video we are going to look at while studying the Pulse Sensor.

    http://www.kickstarter.com/projects/1342192419/pulse-sensor-an-open-source-heart-rate-sensor-that

    Thanks!

     

     

     

     

     

     

     

     
  • Jun Sik (Jason) Kim 6:47 pm on September 20, 2011 Permalink | Reply  

    Maker Faire Experience 

    The product that got me most excited inside the Arduino tent was a product entitled “Keyglove by Jeff Rowberg. This is because during my industrial design studying days, I remembered a concept mobile phone that used fingers to represent keys. What intrigued me the most was the possibility of Keyglove’s further development. Although people are used to QWERTY-based keyboards, it doesn’t necessarily mean it HAS to be the most comfortable. Because the wearable computing market is becoming very popular I believe the Keyglove will impact the world of gaming, design, art, music, etc. I’d love to see a further developed Keyglove where if I made a certain shape with my hand while putting on Keyglove, a 3D CAD software would automatically create the shape I’m making with my hands.

    As I entered the indoor section of the Maker Faire, the work that first caught my eyes was the “Lumarca” designed by Matt Parker. Using a projection, Lumarca used a volumetric display to show viewers a three dimensional image in motion. When I first looked at it in the dark, I initially thought that it involved high technology. But once I asked the artist on the mechanism of Lumarca, I realized it was just a calculated projection in motion towards strings attached to boards. When I researched for Lumarca on the internet, I also realized the creators incorporated Kinect into Lumarca. They created a 3d projection portraying the exact movement of somebody moving infront of the Kinect. What’s so interesting is that the Lumarca need not require a 3d glass in order for people to see 3d.

    Because I have an industrial design background, every time I passed by a 3d printer, I just wanted to buy it. Just last year, I had paid $2000 to create a fine mockup of one of my product designs in Korea. Seeing that a 3d printer now only costs about $1600 shocks me. There were 3D printers that worked by addition while there were 3D printers that worked by subtraction. Because I’ve already seen many printers that work by subtracting from the raw material, I was more interested on those printers that worked by addition. An example would be the “Ultimaker: the fast, affordable, large build volume, open source 3D printing” made by the Ultimaker. Just like its name, it was indeed a fast, affordable, open source 3d printer. It would accept almost any type of CAD file and would print in such detail that I couldn’t believe it. It created what seemed to me like a billion layers of shape in order to achieve the detail of the final product. It was very fun to see.

    I really enjoyed the Maker Faire!

     

     

     
  • Jun Sik (Jason) Kim 4:17 pm on September 16, 2011 Permalink | Reply  

    Jun Sik (Jason) Kim Introduction 

    Background / Why I’m here

    I’m really looking forward to attending Physical Computing 1 and playing around with Arduino. I have a background in industrial design. Until now, I’ve been designing products as an undergrad and participated in projects that collaborated with Samsung, LG, Motorola, etc. in Korea. But there was only so much I could do because I did not have a clear notion towards the engineering part of design. I wanted to study how products worked and what limitations they had. As I studied industrial design, I also became more and more interested in communications and medias of communication. I really wanted to create a new means of communication and take it to the next level between user and device. I believe it critical to increase the role of interactivity in products for the future. I worked for three months in Korea in a design consulting firm that solved problems using design methodologies before coming to MFADT. Because I want to create a new platform for communication, I want to learn the basics of physical computing so that I can later on incorporate it into my thesis. I believe all designers should understand at least the basics of coding and physical computing as these serve as the basics necessary to create products these days. With the open source community ever increasing, coding and physical computing can only get more fun. I’m eager to see what I can learn!

    Favorite Toy

    My favorite childhood toy – although it is very tempting to say that it is the Lego — is called Granzort. It comes from a Japanese cartoon called Granzort. I used to love this cartoon and figure toy when I was in elementary school. While trying to look for pictures of Granzort in the internet, my heart started to flutter again! I love this toy!

     

     

    It is basically a toy that reshapes itself once a person enters the body of the robot (in the cartoon). The robot then kills of the bad robot – just like any other cartoon. But what was so special about this robot was that people would actually enter the robot through a beam of light and the movement of the person would parallel the movement of the robot. The robot moved exactly the same way the controller moved.

    The whole transformation of the robot and the relationship between controller and robot made my jaws drop with fascination at a young age. I will never forget this toy. I would bring it with me everywhere I went. I would always reshape the toy and imagine myself being inside the toy controlling the robot.

    Here is a Youtube link of the cartoon.

    http://www.youtube.com/watch?v=nqJSf4t8JkY

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel