Alex Glow
Published

Animated LED "Tattoo"

A temporary, programmable "tattoo" that can respond to its physical orientation, or play animations.

IntermediateFull instructions provided1 hour2,676

Things used in this project

Hardware components

LightBlue Bean
Punch Through LightBlue Bean
×1
Circuit Stickers (STEM) Starter Kit
Chibitronics Circuit Stickers (STEM) Starter Kit
×1

Story

Read more

Schematics

LightBlue Bean tattoo schematic

This is how it is put together, as a cleaner diagram.

Tattoo schematic

This is how I sewed the circuit together physically.

Code

ledtat.ino

C/C++
Simple animation for three LEDs.
/* 
  This sketch reads the acceleration from the Bean's on-board 
  accelerometer and displays it on the Bean's LED.
    
  This example code is in the public domain.
*/

static int d5 = 5;
static int d3 = 3;
static int d1 = 1;

void setup() {
  // Optional: Use Bean.setAccelerationRange() to set the sensitivity 
  // to something other than the default of ±2g.
    pinMode(d5, OUTPUT);
    pinMode(d3, OUTPUT);
    pinMode(d1, OUTPUT);
    Bean.setLed(0, 0, 0);
}

// the loop routine runs over and over again forever:
void loop() {
    
   digitalWrite(d5, HIGH);
   Bean.sleep(150);
   digitalWrite(d5, LOW);
    
    digitalWrite(d3, HIGH);
   Bean.sleep(150);
   digitalWrite(d3, LOW);
    
    digitalWrite(d1, HIGH);
   Bean.sleep(250);
   digitalWrite(d1, LOW);
   Bean.sleep(500);

}

accelerometer-tattoo.ino

C/C++
Reads the orientation (X, Y, and Z axes) and lights up one LED for each axis.
/* 
  This sketch reads the acceleration from the Bean's on-board 
  accelerometer and displays it on the Bean's LED.
    
  This example code is in the public domain.
*/

static int d1 = 1;
static int d3 = 3;
static int d5 = 5;

void setup() {
  // Optional: Use Bean.setAccelerationRange() to set the sensitivity 
  // to something other than the default of ±2g.
    pinMode(d1, OUTPUT);
    pinMode(d3, OUTPUT);
    pinMode(d5, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
   // Get the current acceleration with range of ±2g, 
   // and a conversion of 3.91×10-3 g/unit or 0.03834(m/s^2)/units. 
   AccelerationReading accel = Bean.getAcceleration();

   // Update LED color
   uint16_t r = (abs(accel.xAxis)) / 4;
   uint16_t g = (abs(accel.yAxis)) / 4;
   uint16_t b = (abs(accel.zAxis)) / 4;
   // Bean.setLed((uint8_t)r,(uint8_t)g,(uint8_t)b);
    Bean.setLed(0,0,0);
    
    if (abs(accel.xAxis) >= 200) {
   digitalWrite(d5, HIGH);
        }
    else { digitalWrite(d5, LOW); }
    
    if (abs(accel.yAxis) >= 200) {
   digitalWrite(d3, HIGH);
        }
    else { digitalWrite(d3, LOW); }
    
    if (abs(accel.zAxis) >= 200) {
   digitalWrite(d1, HIGH);
        }
    else { digitalWrite(d1, LOW); }
    
    
        
   Bean.sleep(50);

}

Credits

Alex Glow

Alex Glow

142 projects • 1459 followers
The Hackster team's resident Hardware Nerd. I like robots, music, EEG, wearables, and languages. FIRST Robotics kid.

Comments

Add projectSign up / Login