element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Enchanted Objects
  • Challenges & Projects
  • Design Challenges
  • Enchanted Objects
  • More
  • Cancel
Enchanted Objects
Blog Enchanted Windows
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: coolbox
  • Date Created: 24 Jun 2015 6:21 PM Date Created
  • Views 926 views
  • Likes 2 likes
  • Comments 2 comments
  • enchanted_objects
  • enchanted_windows
  • arduino_yun
  • arduino
Related
Recommended

Enchanted Windows

coolbox
coolbox
24 Jun 2015

Hi,

Here,I want to post some update about may Enchanted windows project. I was able to control window using arduino yun’s wi-fi.I was not sure about a actual window so I have tried with thermo Cole model.

 

Here I have used 150 RPM DC geared motor with Infineon DC motor control shield.pic connections are:

Digital 2 in yun -> IN1 in motor shield

Digital 3 in yun -> IN2 in motor shield

INH1 and INH2 were connected to 5V in yun. Also I have shorted GND of Infineon shield and yun as power for both board are different. Yun was powered by 5V supply and motor shield was powered by 12V supply same as motor supply.

 

Yun Software:

I have modified Bridge example as per my requirement. Using REST APIs I was able to control motor. Code is as below:

 

 


 

#include <Bridge.h>

#include <YunServer.h>

#include <YunClient.h>

 

// Listen to the default port 5555, the Yún webserver

// will forward there all the HTTP requests you send

 

YunServer server;

boolean JustTwoSeconds;

 

void setup()

{

  // Bridge startup

  pinMode(13, OUTPUT);

  digitalWrite(13, LOW);

  Bridge.begin();

  digitalWrite(13, HIGH);

 

  // Listen for incoming connection only from localhost

  // (no one from the external network could connect)

  server.listenOnLocalhost();

  server.begin();

 

  // For Driving Motor We need this two pins.

  pinMode( 2, OUTPUT ); //IN_1

  pinMode( 3, OUTPUT ); //IN_2

 

 

}

 

void loop()

{

  // Get clients coming from server

  YunClient client = server.accept();

 

  // There is a new client?

  if (client)

  {

    // Process request

    process(client);

 

    // Close connection and free resources.

    client.stop();

  }

 

  delay(50); // Poll every 50ms

 

  if( JustTwoSeconds )

  {

    JustTwoSeconds = 0;

    delay(4900); // 1.5 sec

    digitalWrite( 2, LOW ); //IN_1

    digitalWrite( 3, LOW ); //IN_2   

  }

}

 

 

 

void process(YunClient client) {

  // read the command

  String command = client.readStringUntil('/');

 

  // is "digital" command?

  if (command == "digital") {

    digitalCommand(client);

  }

 

  // is "analog" command?

  if (command == "analog") {

    analogCommand(client);

  }

 

  // is "mode" command?

  if (command == "mode") {

    modeCommand(client);

  }

}

 

 

 

 

void digitalCommand(YunClient client)

{

  int pin, value;

 

     // Read pin number

     pin = client.parseInt();

 

    

   if( pin == 1 )

   {

         digitalWrite( 2, HIGH ); //IN_1

         digitalWrite( 3, LOW ); //IN_2

        

         JustTwoSeconds = 1;

   }

   else if( pin == 2 )

   {

         digitalWrite( 2, LOW ); //IN_1

         digitalWrite( 3, HIGH ); //IN_2

        

         JustTwoSeconds = 1;

   }

   else if( pin == 3 )

   {

         digitalWrite( 2, LOW ); //IN_1

         digitalWrite( 3, LOW ); //IN_2

   }

   else

   {

       ;

   }

}

 

 

 

 

 

 

 

HTML File:

For EASY interface I have created simple HTML file which you can open in any device. Code is as follow:

 

<body bgcolor = "yellow">

 

<a href = "http://192.168.240.1/arduino/digital/1 ">

<h3><center> OPEN WINDOW </center></h3>

</a>

 

</br>

</br>

 

<a href = "http://192.168.240.1/arduino/digital/2 ">

<h3><center> CLOSE WINDOW </center></h3>

</a>

 

</br>

</br>

 

<a href = "http://192.168.240.1/arduino/digital/3 ">

<h3><center> STOP </center></h3>

</a>

 

</body>

 

I will publish a video soon.

  • Sign in to reply

Top Comments

  • Workshopshed
    Workshopshed over 10 years ago +1
    Good to see the shield and motors working, the model window turned out nicely too.
Parents
  • Workshopshed
    Workshopshed over 10 years ago

    Good to see the shield and motors working, the model window turned out nicely too.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • coolbox
    coolbox over 10 years ago in reply to Workshopshed

    Thanks Andy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • coolbox
    coolbox over 10 years ago in reply to Workshopshed

    Thanks Andy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube