Tagged: jason kim Toggle Comment Threads | Keyboard Shortcuts

  • Unknown's avatar

    Jun Sik (Jason) Kim 8:21 am on December 16, 2011 Permalink | Reply
    Tags: driving wheel ver 2, , jason kim, 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 …)

     
  • Unknown's avatar

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

    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

     
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