Introduction: IDC2018IOT Cloth Hanger

the IOT cloth hanger will make your closet smarter and give you online statistics on the clothes inside it.

it has 3 main feature:

  1. when you want to choose what to wear, you can press on the color you feel like wearing today and the IOT clothes hangers with matching colors will light up.
  2. when shopping for new cloth you can find our how many clothes you have of each color.
  3. and most important if you have a sibling who is constantly "borrowing" your clothes you will get an alarm to your mail if that happens.

Step 1: Different Components of the IOT Cloth Hanger

for each cloth hanger we used:

  • nodemcu: the "brains".
  • rgb sensor (tcs34725): to determine what color is the cloth on the hanger.
  • pressure sensor: to detect when putting cloth on the hanger or taking off.

  • led stripe: to signal if the cloth matches the choice on the app.

Step 2: Data Flow

cloth hanger => put on cloth => detect color => send the color and hanger id throw HTTP to firbase

cloth hanger => take off cloth => send GET request to ifttt webhook => send email (SMTP maybe)

Blynk app => choose color => http request to cloth hanger => all cloth hangers with the chosen color will light color on led strip

cloth hanger => takes all info from firbase databse (http) => update adafriut feeds (mqtt)

Step 3: Biggest Challenge and How We Faced It

our biggest challenge in this project was finding a way to convert the RGB sensor's output to Red Green and Blue values that are more similar to what the eye sees, and then to figure out what color it is on the hanger.

in order to make the RGB values more similar to what the eye sees we used a gamma table so every reading of the RGB sensor was mapped through this 256 array. the gamma table is created with this function:

for (int i=0; i<256; i++) {

float x = i;

x /= 255;

x = pow(x, 2.5);

x *= 255;

gammatable[i] = x;


then we needed to take the rgb values and distinguish which color it is. for that we calculated the "distance" of each basic color from the sensor's output, to do so we stored all basic colors in 3 arrays for red green and blue and calculated the distance of the output and each color, then we searched for the min distance in the table and that is the color that is the closest to the actual color.

Step 4: The Cloth Hanger Limitation

  • it can only detect 3 colors: red, green and blue
  • it needs be connected to a power source so it either needs a battery for each cloth hanger or each time you put a hanger you will connect it with cable
  • it needs a good wifi connection

Step 5: Future Plans

  1. add more colors: need to test a lot of clothes on the rgb sensor in order to understand the values we get for each color and then add more colors to be able to detect (1 week)
  2. after adding more colors we want to be able to suggest color combinations to the users (2 days)
  3. build a prototype hanger for the iot equipment (3 weeks)

Step 6: If You Want to Build It Your Own

i uploaded the code so you can try and run it, all you need to do is connect all the components as in the image.

then in the blynk app add 3 button for every color, blue v0, red v1, green v2.

also open an ifttt aplet in webhook called "If maker Event "someonetouchingcloset", then Send me an email at <youremail>" from the settings you can get the webhhook link and insert it in a blynk button called webhook as well with V4.

and you are all set up! have fun!