Skip navigation

Enchanted Objects

8 Posts authored by: iayanpahwa

Here's a small DEMO video showing working of Enchanted Wardrobe Project. FEEDBACKs

WELCOME

Here's a flowchart explaining the complete working on Enchanted Wardrobe:flowchart_enchanted_objects.jpg

 

I am bit conscious about the suggest clothes feature, Based on temperature and weather conditions outside the wardrobe needed to be suggest clothing for the day to the user and now if user wants to go by the suggestion he can press the button and accordingly the cloth section will come ahead.! say if its a bright sunny day and wardrobe suggests to wear cotton clothes put shades and uv protection cream and if user agrees then the cotton clothes sections should come ahead if user agrees to the suggestion and presses the button, for this the sections should be divided properly in the wardrobe and a motorized mechanism needs to be made. GOOD IDEA to use motor shield but how is the question, SUGGESTIONS ARE WELCOMED .

For Enchanting the suggestions in sound I'll save pre-made MP3 files in root of OPEN-WRT yun os and can envoke them to play within arduino code. I am gonna buy a usb based sound card tomorrow and i wish ALSA(Advanced Linux Sound Architecture) drivers works for me.

Header 1

opkg update

opkg install kmod-usb-audio

opkg install madplay

Commands to bring USB sound functionality to yun.

 

FINGERS CROSSED

In the Last blog post(s) we used Yahoo Weather API under TEMBOO choreo to extract local weather information. The API returned data in XML form which we later parsed using Temboo Output filters and get needed information from the response. Now In this blog I'll show you three more powerful features of Temboo which is helping maker to integrate Digital/Analog input triggers and Actuators with their existing cloud APIs to build Internet Of Things based devices. Consider having a phone call when lights in room goes down a certain threshold now this can be achieved to hook a Light Sensor(LDR) reading continuous readings of ambient lights and monitoring the levels, if the level exceeds threshold it calls an API function which triggers phone, The digit pressed on your phone can be used to turn on the lights, hence this basic IoT device can be broken down into Input(LIGHT) cloud(PHONE CALL API SERVICE like NEXMO and TWILIO) and output say a light bulb. Keeping this approach in mind Temboo makes IoT easy to prototype as follows:

 

We already covered the cloud API part where weather data is coming from Yahoo API but in my project Enchanted Wardrobe I am looking to integrate the whole setup inside my wardrobe and want it to call the api and fetch information only when the wardrobe has been opened by me, this approach will have a lots of advantages like

--> Saving Energy and microcontroller free running cycles because I dont want it active all the time rather it is going to be used only few times in a day so why let it running for no reason?

--> It reduces the number of call to the server. Making unnecessary calls to APIs again and again in short interval of times overload them and they might block you from accessing them.

            The design is therefore smart, consumes less power and work only when needed(WIN).

 

 

Integrating input Trigger:


I want my wardrobe to enchants me weather only when I open it, Therefore I need some kind of mechanism to sense opening and closing of the doors. There are fancy door sensors available in the market in glossy casing but to keep the cost low am going to use a Magnetic REED switch, infact the fancy one has same mechanism inside them so why dont use it barely. This works as a normal switch but with a difference of passing current through them in the presence of a magnet. Hence i can integrate the switch on door of wardrobe connect it to my YUN and have a magnet in periphery opposite to the door hence deactivating it when the door is opened, this way i can sense the trigger. How REED switches work?reed.gif

 

The code is super simple, just use it with normal switch sketch inside arduino with pinMode(REED,INPUT_PULLUP); inside setup() and digitalRead(REED) inside loop before calling the api and using if else to check the opening of door.

 

A fancy way to do this is to tell this requirmentdirectly to temboo. In the page where we configured the API you can find the hyperlink which says is the choreo triggered by an input there you say yes and configured the pin for the api to get triggered as and select digital or analog triggered and suitable pin number with input. You can even hook up analog sensor using this approach.

 

However if you are using active low based triggered I've noticed that temboo generated code doesn't activated the pullup resistorby default so I recomend you doing that to avoid pin floating problems.

button.JPG

 

 

Actuating based on API responses

 

Similarly like triggering API based on input you can trigger an actuator like LED based on results obtained from API for ex: tuning on LED on pin13 if temperature of city >25'c or sooutput.JPG

 

Thats how we can use powerfull feature of Temboo on Arduino Yun without even coding a single line.

 

One more interesting feature that temboo offers is the ability to stream and store sensors reading to online cloud services like Google Big Query and Microsoft power BI, for this you can use WANT TO STREAM SENSOR DATA feature of temboo.stream.JPG

In my last blog post I talk about fetching Weather Information of a desired location using Yahoo Weather API and TEMBOO services on Arduino Yun. The purpose of using Temboo like services in my Design challenge project is to make project as simple as possible and even simpler to replicate so we each can have our own Enchanted Wardrobe in homes . Temboo makes it easy even for non-programmers to have a feel of IoT World and best part it comes pre-bundled with Arduino yun and other Arduino using Ethernet/Wifi/Gsm Shield and some more boards like TI-CC3200, Adafruit CC3000 wifi module and now even with Samsung Artik so you can probably make the same project with any one of them without actually modifying code, Temboo will handle that for you.

 

So progressing ahead, last time we were able to get Weather Information from Yahoo Weather API using Temboo's Choreo but as I mentioned the response from APIs are generally in some encoded form. Similarly Yahoo Weather API returns in  XML(eXtensible Markup Language) or JSON(Java Script Object Notation) which are definitely not human readable but the needed information can be extracted by Parseing this response. For ex to Parse JSON in python we use JSON library similarly we've an ArduinoJsonParser or XML parser library for Arduino which we can use, but Temboo provides more flexibility while handling parseing from APIs it uses in its choreos and similar operation can be performed easily by using what Temboo calls : "OUTPUT FILTERS". Output filters makes easy to parse XML or JSON response from APIs and extract the required information from the returned response container. Here we'll use XML based output filter and you'll see that it is as easy to append just two extra lines in our previous code. So Lets Get Started

 

Before moving Ahead, we should be aware about what different things we can parse from the Yahoo weather API. The WEATHER API by Yahoo provides the following information:

 

>Temperature

>Pressure

>HIGH MARK of Temperature in a day

>LOW MARK of Temperature in a day

>Humidity

>Visibility

>Condition Text(Like Cold/ThunderStorm/Haze etc)

>Condition Code which can be resolved from API's documentation on Yahoo's Website

 

Moving Ahead on Parseing:

 

Step 1>> Complete steps till last blog post .

step2>> Login to Temboo Output Filter webpage, it can also be found on left hand side lowermost tabs on Temboo's homepage.

 

utilities.JPG

 

step 3>> Select XML or JSON if you've requested yahoo to return data in JSON.

step4>> Select Get Values from XML tab.

step5>> In node field you can type data to be extracted say 'temperature' and in XML field add the response(XML) you got from API(in previous blog program).

INPUT.JPG

 

 

step6>> Alternatively you can add following lines of code before  GetWeatherByAddressChoreo.run(); function

 

   GetWeatherByAddressChoreo.addOutputFilter("temperature", "/rss/channel/item/yweather:condition/@temp", "Response");

   GetWeatherByAddressChoreo.addOutputFilter("code", "/rss/channel/item/yweather:condition/@code", "Response");

    GetWeatherByAddressChoreo.addOutputFilter("text", "/rss/channel/item/yweather:condition/@text", "Response");

 

This resolves Temperature, Code and Text from XML in similar fashion you can extract say Humidity.serial.JPG

 

Will be adding a triggered sensor in the next one. Stay Tuned!

In this blog post I'll show you how to fetch weather information from Yahoo Weather API using Temboo services which came pre bundled for Arduino Yun.

 

About TEMBOO:

 

Temboo is an online service which enables developer build Internet enabled applications using 200+ choreos and APIs around the web without actually coding, The temboo generates the required code needed to accomplished work from an API ex Fetching geo coordinates from google services, Weather from yahoo etc. Temboo also supports a large number of boards ranging from Arduino to TEXAS INSTRUMENTS MXP430, CC3200 and now even SAMSUNG ARTIK. You can program them to talk to web using Temboo auto code generation service in IoT mode.

Here I've used Temboo to fetch Weather data of my city using Yahoo Weather API.Sign up on Temboo's Website

 

 

step 1>> Sign up for a Temboo's account on www.temboo.com.

step 2>> Select Arduino Yun as board and turn on IoT mode.

step 3>> On left hand side choose Yahoo Weather > Weather by location choreo.

step 4>> Enter your city credentials and other optional inputs like you want temperature in *c or *f.

step 4>> Copy the generated code and header file.

step 5>> Open Arduino IDE and paste the code, compile and and upload to target board.

step 6>> Open Serial Monitor to check the output.

 

I am attaching the code, just change the header file credentials according to your account info.

 

The data in serial monitor will be a raw XML response from yahoo server from which usefull data can be extracted using Parseing, In next blog post we'll parse the temperature and other data using Temboo output Filters and use them efficiently.

 

2.JPGHomepageWeather ChoreoResponse from API

Yes I am an udergraduate Engineering student and have been busy with my pre-final year exams, which were keeping me barred to progress in this design challenge. I waited a long to tinker with my new kits and finally I can start now. I have planned on journey ahead in Enchanted Wardrobe and will document the whole build in number of blog post.

 

1) Taking Yun to the cloud and talk to Yahoo Weather API using Temboo.

2) Parseing the XML response from Yahoo to extract the useful required information.

3) Mapping the temperature and current weather conditions to type of clothes suggested to wear on that specific day.

4) Adding a Reed/Door open switch to make Yun starts fetching data and process it only when wardrobe door is opened to make it less power hungry.

5) Adding text-to-speech capabilities and RGB i2c LCD to display and speaks out current weather conditions.

6) Adding a user button on application of which the suggested clothes section will automatically come ahead for easy access.(Need to figure out the mechanics behind and tinker with my wardrobe).

7) Optional: Mapping temperature data to RGB values using linear interpolation and show it on RGB LED wrapped in circle inside wardrobe and programmed using RGB infineon shield.

 

Lets start the journey, though am starting a bit late, but wish to complete it on time. Fingers Crossed . Only 4 weeks left..

I received my kits today, Finally I can start with my first module of Enchanted Wardrobe. It would be around the Yun.

P.S the servo is quiet big, I got an idea to use it wisely ,IMG_2166.JPG@STAY TUNED! for more.

Thanks Element14 once again...

Introduction:

 

Thank you element14 community, organizers, sponsors for selecting my project making it eligible for "Enchanted Objects" design challenge, enabling me to test my skills and knowledge to convert everyday dumb objects in smart enchanted objects. This is my very first design challenge and I wish to make each blog post count specially focusing on the people who would like to replicate my projects for their personal use or improve them with their creativity. So lets get started.

 

My project is sub-divided into small modules each aims to convert dumb everyday object present in our houses into a smart device capable of easing your life giving you a feel of connected home and a bit of tony stark laboratory(kidding). This post is meant to introduce you to the very first module i'll be working on and its called Enchanted Wardrobe.

 

 

It might sound science fiction by now but now its possible to make your wardrobe suggests clothes or OUTFIT OF THE DAY for you. HOW? Thanks to Enchanted Wardrobe in your house. But how does it actually works?


Answer lies in weather:

 

GOOD Morning Human: ITS SEEMS A BRIGHT SUNNY DAY, HOW ABOUT PICKING LIGHT COLOR COTTON TODAY? DON'T FORGET YOUR SHADES.

 

HEY HUMAN SEEMS LIKE ITS GOING TO RAIN TODAY, DONT FORGET UMBRELLA/RAIN COAT AND BOOTS.

 

HEY HUMAN SEEMS CHILLY WEATHER TODAY, WOOL WILL WORK JUST FINE #WIN


 

For version-1 these messages can be displayed on and RGB LCD, if success I may implement a Text to speech based system.

 

We can also think of bringing these clothes forward if acknowledged by the user, provided the clothes are arranged properly.(IDEA!)

That's how a normal everyday object lying in our room, we use daily can be converted to a smart enchanted objects.


INTRO.JPG