SmartArt_75

Smart Art with LittleBits

SMART ART – Art that’s more beautiful when you do good.

I try to go the gym at least once every 3 days. If I’ve been to the gym recently, my art has a big beautiful rainbow in the sky! But if I haven’t been there in 3 days… a storm moves over the beach!

SmartArt_73SmartArt_74


With Smart Art, the art can be any subject and be triggered by any trigger!  The storm could roll in when it’s actually raining outside, or it could be a picture of a dog that grins only when the Yankees win. Whatever it is, I hope this post helps make something fun, beautiful and useful!


HOW IT WORKS:

Smart Art uses the power of littleBits Cloud and Arduino modules to know when I’ve been to the gym and how long it’s been since then. Using IFTTT, I set my trigger (or the “IF”) as my smartphone enters the location of my gym, then I set the action (or the “THAN”) as the output of my littleBits cloud module. The Arduino listens for the signal from the cloud module, and starts counting. If too much time has passed, the Arduino turns the Servo motor- making the clouds roll into the sky! Smart Art is also equipped with a button, so I can trigger it manually if I work out somewhere other than my gym, and a long LED that lights up when either trigger is activated.

You can also view this project on the littleBits website, where the littleBits are sold.


MATERIALS:

LittleBits:

To communicate over the internet, the cloud module requires an account with IFTTT.

IFTTT

You’ll also need:

  • Colorful Cardstock
  • Glue Stick
  • Old Picture Frame
  • USB Cable and USB port/power supply
  • Tape
  • Pencil
  • Ruler
  • Scissors/ X-acto knife
  • Stapler

SmartArt_1


 INSTRUCTIONS:

Assemble the circuit:

  • Snap the littleBits together as shown.
  • A twist tie is a nice way to keep the wires in place.

Make the art:

  • Choose a color for the background. (You will need two pieces of this color)
  • Use the back of the frame to trace and cut a piece that will fit in the frame.
  • Draw 2 thin clouds on a white piece of paper.
  • Fold the paper in half, then cut them out to create 2 of each cloud shape.
  • Choose 3 colored papers for the rainbow.
  • Stack the paper in a pile.
  • Cut the pile into a 2 inch strip.
  • Draw a half circle with the center on the bottom edge. (It should be 3.5” wide  x 2” tall)
  • Cut out the half circle, then continue to cut smaller arches 3 more times.
  • Choose another paper to be the water.
  • Cut it to be the same size as the background.
  • Fold it in half the long way, like a hot dog.
    • *It’s best that the water be slightly taller than half the height of the background, that way it will conceal the motor nicely.
  • Cut with a gentle zig zag to make waves.
  • Cut a piece of paper in the shape of a beach.
  • Use this template to print a 4 inch circle. (or measure and cut one yourself)
  • Staple the template to a piece of paper the same color as the background. (Make sure the staple is on the outside of the circle)
  • Cut the circle out of both sheets of paper (don’t throw the template piece away)
  • Measure and find the center of the background piece.
  • Cut a hole large enough for the top of the motor to fit through.
  • Insert the motor
  • Use tape to hold it in place.
  • Measure and find the center of the background colored circle.
  • Cut a small hole in the center
  • Place two pieces of tape on the motor, adhesive side up.
  • Position the hole over the exact center of the motor, then secure the tape in place.
  • The white circle will be used as a template.
  • Fold the circle in half, then half again, then half again, until it looks like a slice of pizza.
  • Open the circle and cut out one of the “slices.”
  • Position the circle over the other one, with the blank “slice” on the left, as shown.
    • This servo motor only turns 145•. That means, when the motor spins, less than half of the circle will be revealed/hidden. This trick lets us know where to place the design elements (clouds, rainbows, or whatever they be) so that the whole scene appears to change. The other cheat is the umbrella on the beach — it can cover the design elements when the motor moves in the other direction. 
  • Use a pencil to trace the edge of the circle on the cloud. Cut along that line. You should have 4 clouds and 4 small cloud pieces.
  • Glue one of each cloud behind the circle, making sure it doesn’t touch the blank slice. (you may need to cut the cloud a bit smaller).
  • Glue the piece that was behind on top of the circle so it completes the cloud.
  • Press the littleBits button.
  • Glue the second set of small cloud pieces in place after the motor spins. The 2 remaining cloud pieces are scrap.
  • Sketch and cut out some lightning bolts. Glue them to one set of clouds.
  • Assemble the rainbow pieces. Use the white template to measure where to trim the rainbow.
  • Trim off the edge, then glue in place near the other set of clouds.
  •  Draw and cut out an umbrella to cover any design elements that need concealing.
  • Decorate!
  • Attach the mounting board to the back of the frame.
  • Repurpose the easel by taping it at an angle that lets the frame stand.

 

Now go to the gym!

SmartArt_75 SmartArt_76 SmartArt_77

 

Arduino Code Below:


            
int cloudPin = 0; // Top left Arduino snap
int buttonPin = A1; // Bottom left Arduino snap

int actionPin = 1; // Top right Arduino snap
int ledPin = 9; // Bottom right Arduino snap

int buttonState; // Is the button pressed or not?
int cloudState; // Is the cloud module triggered or not?
int lastButtonState; // Compare to buttonState to sense a change.
int lastCloudState; // Compare to cloudState to sense a change.

int point = 0; // Get a point / lose your point!
int goalDays = 3; // How many days before you lose your points? 
int daysSince = 0; // How many days since you got a point?

unsigned long oneDay = 86400000; // One day in milliseconds
//unsigned long oneDay = 5000; // 5 seconds (use this to test!)
unsigned long previousTime = 0; // Remember the last time you scored!
unsigned long timer; // How long has it been since your last score?

int led4Feedback; // Led alert when the cloud or button are triggered.
int led4FeedbackTime = 500; // Turn on for 1/2 second. (in milliseconds)
int led4FeedbackTimer; // How long since the led turned on?



void setup() {

  // put your setup code here, to run once:
  Serial.begin(9600);

  pinMode(cloudPin, INPUT); // Trigger from the cloud
  pinMode(buttonPin, INPUT); // Trigger from the button

  pinMode(actionPin, OUTPUT); // Moves the Motor!
  pinMode(ledPin, OUTPUT); // Lights up when Button Pressed

}

void loop() {
  // put your main code here, to run repeatedly: 

  unsigned long currentTime = millis(); // Think of millis(); as "NOW"
  buttonState = digitalRead(buttonPin);
  cloudState = digitalRead(cloudPin);

  if(buttonState != lastButtonState){ // If the button state has changed...
    if (buttonState == HIGH){ // If the button is pressed...
      previousTime = currentTime; // You did it now!
      point = 1; // You get a point!
      daysSince = 0; // You did it today!
      led4Feedback = currentTime; // Start counting now.
      digitalWrite(ledPin, HIGH); // Turn on the LED
    }
  }
  lastButtonState = buttonState; // Set equal so a change can be detected later.

  if(cloudState != lastCloudState){ // If the cloud state has changed...
    if (cloudState == HIGH){
      previousTime = currentTime; // You did it now!
      point = 1; // You get a point!
      daysSince = 0; // You did it today!
      led4Feedback = currentTime; // Start counting now.
      digitalWrite(ledPin, HIGH); // Turn on the LED
    }
  }
  lastCloudState = cloudState; // Set equal so a change can be detected later.


  timer = currentTime - previousTime; // Now minus the last time

  if ( timer >= oneDay ){ // If it's been more than one day, add a day to daysSince
     daysSince ++;  // (Short for "daysSince = daysSince +1" )
     previousTime = currentTime; // Resets the timer (to start counting from 0 to 1 day again)
  }
  
  if (daysSince >= goalDays){ // You didn't make it in time!
   point = 0; // so you lose your point.
  }


  if (point == 1){
    digitalWrite(actionPin, HIGH); // Go you!
  } 
  else{
    digitalWrite(actionPin, LOW); // WAh WAh go do better now...
  }

  led4FeedbackTimer = currentTime - led4Feedback; // Now minus when led4Feedback started counting.

  if (led4FeedbackTimer > led4FeedbackTime){ // If too much time ellapsed...
    digitalWrite(ledPin, LOW); // Turn off the led
  }
}


          
  • Share post