Project showcase
What to Wear? Twitter Button

What to Wear? Twitter Button © GPL3+

Push a button to receive a message on Twitter for what to wear that day.

  • 3,488 views
  • 0 comments
  • 6 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)

Apps and online services

Ide web
Arduino IDE
Enthought Canopy Python IDE

About this project

Have you ever woken up one morning and just asked yourself: "What is there to wear today?" Now you can let you computer choose for you, saving you time and effort/headaches. With the push of a button you will be notified in your Twitter feed on what to wear that day. All you have to do is have a folder with your clothing images in it!

To get your Twitter feed to update you will need to create a developer Twitter account, and then create a new app. After you do that you will need to get the API and oauth keys and paste them into the Python code. After that you are done! Feel free to make it look better by moving it into an enclosure.

Here's a video on how to do the hardware:

Code

Python CodePython
from twython import Twython
import os
import random
import serial

pathToImages = "images/"
app_key = "secret"
app_secret = "secret"
oauth_token = "secret"
oauth_token_secret = "secret"
twitter = Twython(app_key,app_secret,oauth_token,oauth_token_secret)
ser = serial.Serial("COM8",baudrate=9600)

def getImage():
        #Takes the folder where your images are as the input
    images = os.listdir(pathToImages)
    image_open = open(pathToImages + str(images[random.randint(1,(len(images)) -1)]), 'rb')
    print "I chose: " + str(image_open)
    image_ids = twitter.upload_media(media=image_open)
    twitter.update_status(status='You should wear this today: ',media_ids=image_ids['media_id'])

while 1:
    if ser.read() == "h":
        getImage()
Arduino CodeC/C++
const int buttonPin = 5;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    //tell Python it went high
    Serial.print("h");
    // turn LED on:
    digitalWrite(ledPin, HIGH);
    delay(500);
    digitalWrite(ledPin,LOW);
    //5 min delay
    delay(60*1000*5);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
    //debounce
    delay(50);
  }
}

Custom parts and enclosures

Button Housing
Button Top

Schematics

Schematic
Just connect. The 220 ohm resistor can go between the LED and GND.
Schematic twitter to wear jqdaa2t76k

Comments

Similar projects you might like

Amazon Dash Button for Arduino!

Project tutorial by Brian Carbonette

  • 10,978 views
  • 4 comments
  • 23 respects

You've Been Using a Button Wrong this Whole Time

Project tutorial by SMM2

  • 9,647 views
  • 1 comment
  • 6 respects

How can you Report Thief with a Photo on Twitter by Arduino

Project tutorial by ahmed ismail

  • 1,904 views
  • 0 comments
  • 8 respects

Binary Wristwatch

Project showcase by thallia

  • 1,768 views
  • 0 comments
  • 12 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 49,270 views
  • 22 comments
  • 141 respects

Push Button Combination Lock Using Arduino

Project tutorial by Asim Zulfiqar and High Voltages

  • 9,600 views
  • 10 comments
  • 29 respects
Add projectSign up / Login