Ba dum tss!

Made by Nik Kim

Skills DEV II IoT experiment that enhances your inner ba dum tss.

Created: November 7th, 2023

0

Intention

Using sensors, inputs, and LED, I wanted to make a small IoT device that enhances my inner ba dum tss, especially listening to rhythmic music alone in my room.

0

Context

Sensors that sense my finger tapping, a potentiometer that adjusts the intensity of LED light, and three LED lights that express my inner joy toward outside. The force sensor will sense the intensity of my tapping and this will affect the number of LED lights that are lit.

0

Process

  1. Connecting LED
  2. Wiring up a potentiometer 
  3. Install a force sensor
  4. Finally, combine three elements by writing a code
  5. Adjust force sensing conditional value by checking the value displayed on the Particle console.

0

Product

Ba dum tss!

0
0
0
/*
* Skills Dev 2
* 11.07.2023
* @author: Nik Kim
*/

// A forceResistor
int force = A4;

// A Potentiometer pin
int pot = A1;

// Three LED pins
int red = D6;
int yellow = D5;
int green = D4;

// Create a variable to hold the analogue input
int potReading;
int forceReading;
int ledBrightness;

void setup() {
    // Set up the LED for output
    pinMode(red, OUTPUT);
    pinMode(yellow, OUTPUT);
    pinMode(green, OUTPUT);
    
    // Create a cloud variable of type integer
    // called 'light' mapped to photoCellReading
    Particle.variable("Your finger power is:", &forceReading, INT);
    }

void loop() {
    // Use analogRead to read the pot value
    potReading = analogRead(pot);    
    // Use analogRead to read the force value
    forceReading = analogRead(force);
    
    // Map this value into the PWM range (0-255)
    // and store as the led brightness
    ledBrightness = map(potReading, 0, 4095, 0, 255);
    
    // Based on the force
    // change numbers of LED to light up
    if (forceReading >= 1000 and forceReading < 2000) {
        analogWrite(green, ledBrightness);
    } else if (forceReading >= 2000 and forceReading < 3000) {
        analogWrite(green, ledBrightness);
        analogWrite(yellow, ledBrightness);
    } else if (forceReading >= 3000 and forceReading < 4000) {
        analogWrite(green, ledBrightness);
        analogWrite(yellow, ledBrightness);
        analogWrite(red, ledBrightness);
    }

    delay(100);
    
    digitalWrite(green, LOW);
    digitalWrite(yellow, LOW);
    digitalWrite(red, LOW);
}
Click to Expand
x
Share this Project

Courses

48-675 Designing for the Internet of Things

· 11 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

Skills DEV II IoT experiment that enhances your inner ba dum tss.