авто из германии
Gta android скачать

Internship final report – Relazione di chiusura tirocinio, a cura di Gonçalo Neto

Scritto da Alessandra De Rosa on . Postato in Formazione, Prodotti, Progetto Leonardo da Vinci, Servizi

This work experience has been great for me, not just because of having this experience as a worker, but because I’ve learned a lot of new things and developed new skills that will help me in the near future.

When I started working, I barely knew about arduino comparing with what I know now. With a lot search and work, I was able to get more knowledge about it and become better and better by the time. In the beginning I couldn’t do much, I started working simply with arduino, cables, resistors and leds. For the code, I also didn’t know much functions for it, despite already being used to the C language. When I was getting better, I was given new components such as the temperature sensor and the relay, which is an important component that can be used like a switch to turn on and off another components.

Later, when I got used to arduino, I was given a new component called Ethernet Shield, where I could do new things from a web page. Before starting using it, I had to search a lot so I would be ready to finally use it by myself. This component made possible to use a web page, where I had to learn html and php. From this web page, I developed my skills with these new languages building tables and text boxes. Though, I had some problems with it, bugs in the code, but with patience and hard work me and my colleague managed to fix it.

By the time, I was given more components like the light sensor and buzzer. The first one gets the light values and the second simply makes sound. At the end of each project, me and my colleague had the task of making a tutorial, with detailed explanation, pictures taken of arduino and of the web page, the code we used and explanation about it and finally a video showing what really happens in the project. We had also the task of writing a report at the end of the day, saying what we have been doing.

To be honest, I’ve really enjoyed working at hydra solutions, because despite being a very good company, it also has great workers that have always given their time to help us and they have always been nice to us, mainly our tutor who has always stopped his work for a bit to help us in any situation. They make this company have a great ambient and I feel proud having worked here.

Internship final report – Relazione di chiusura tirocinio, a cura di Alexandre Leitão

Scritto da Alessandra De Rosa on . Postato in Formazione, Prodotti, Progetto Leonardo da Vinci, Servizi

This experience of seeing people work at a company and work with them was really interesting, here I had the chance to learn new stuff related to all kinds of matters and practice some old knowledge.

Here I have worked with Arduino Uno R3, later a Ethernet shield and lots of sensors and components which gave me the opportunity to learn how Arduino works, how Arduino programming is important and needs a lot of thinking and management. For each component that I had, I tried to study it and see how it works, even though most of the times some components didn’t work properly at first , but in the end I manage to make it all work. The first thing new I learned was controlling a display that in the beginning seemed hard but when I learned how to use it, it has really simple. The other components that I worked with and seemed difficult were the Ethernet shield and the relay, the one that was most difficult to work with was the relay, but in the end it worked properly and we did some great project’s with it. The Ethernet shield was my biggest challenge here, before I came here I had base of html and for web that was it, but to work with the Ethernet shield I had to learn html much better and a small introduction to PHP,I have also researched JavaScript which I didn’t use. I learned to think in the future utilities of something I just made and to see that I can resolve problems without asking for help or without stopping anyone’s work.

All the projects we have done I noticed a big difference from the beginning, I saw that I learned a lot and my work has quickly getting better. I have done lots of projects with tutorials and videos explaining how the projects worked, with this tutorials I learned the importance of making the things (programming) not only understandable to me but to the others who will read my code to try to understand and make it work.

I had also to work with a small amount of Computer hardware, it wasn’t difficult, I had to put thermic paste in a processor from my computer, and install 2 sound boards (with drivers).

I also learned that in the beginning of every project I need to think what I am going to do, plan it, write it and then execute it, for later on to see and resolve problems faster. In the end of every day I was used to make reports of what I’ve done in that day, and that thought me that in the work world we need to do the things quick and well without problems.

All the people that worked with us were great, Salvatore, Gaetano and Alessandra were the greatest people, Salvatore was our tutor and helped me with lots of things and thought me some good advice about lots of things, I didn’t have lot’s of contact with Gaetano but we was always a nice guy that asked if we needed anything and always helped us when we need it, Alessandra was the one received and edited all our tutorials and videos to put on the HydraSolutions webpage. (Simona was also a great co-worker but we didn’t work with her). The ambient of the company was great, I think I was very lucky to come here, I had the opportunity to meet new people who thought me good things who were nice to me and who never recused to help me.

For me this was a great experience where I have gained and shared knowledge and learned how work in a company is. All the projects were not easy as the first ones, the projects got difficult one after another but it has good to see that I could do it and I had the knowledge and the ability to make more. I had to fight with bugs with the help of my partner and Tutor, most of them we solved but unfortunately some of them we didn’t. In the end all of this was a great time and I am grateful for all the things the company did for me.

Tutorial Arduino: how to control the temperature and how to verify the light – come controllare la temperatura e controllare il livello di luce

Scritto da Alessandra De Rosa on . Postato in Formazione, Prodotti, Progetto Leonardo da Vinci, Servizi, Tutorials Arduino

In this tutorial, we’re going to explain you how to control the temperature and how to verify the light.

Here are the components we used:

  • 1 Arduino
  • 1 Ethernet Shield
  • 1 Relay
  • 1 Temperature sensor
  • 1 Light sensor
  • 4 Leds
  • 5 Resistors
  • 1 Buzzer

The web page has one table for the temperature with a text box, with the actual temperature and another  table for the light with a text box also, and the actual light.

Depending on the values we put comparing with the temperature, above the table appears text saying when to turn on/off the air conditioner. The same happens for the light but instead of appearing text, the led turns ON when the difference between the reference light and the actual light is greater than 10%.

In addiction, depending on the light the sensor gets, if the light level is 10% higher/lower than the internal reference temperature the buzzer makes sound (in the video it is set to 60%).

How it looks:

arduino

Lower temperature:

arduino

Higher temperature:

arduino

Light OFF because the difference between the light written and the actual one is lower than 10%:

arduino web

Light OFF because the difference between the light written and the actual one is greater than 10%:

arduino web

The code we used:

#include &lt;String.h&gt;&lt;/p&gt;<br />
&lt;p&gt;#include &lt;SPI.h&gt;&lt;/p&gt;<br />
&lt;p&gt;#include &lt;Ethernet.h&gt;&lt;/p&gt;<br />
&lt;p&gt;byte mac[] = {&lt;br /&gt;<br />
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // mac address&lt;/p&gt;<br />
&lt;p&gt;byte ip[] = {&lt;br /&gt;<br />
  192, 168, 1, 25 }; // ip arduino internet in&lt;/p&gt;<br />
&lt;p&gt;byte subnet[] = {&lt;br /&gt;<br />
  255, 255, 255, 0 }; //subnet mask&lt;/p&gt;<br />
&lt;p&gt;EthernetServer server(80); //server port&lt;/p&gt;<br />
&lt;p&gt;String readString; //string&lt;br /&gt;<br />
String string;&lt;br /&gt;<br />
int temp1=0 , temp2=0;&lt;/p&gt;<br />
&lt;p&gt;int vrif = 1.1;&lt;/p&gt;<br />
&lt;p&gt;int Rele = 0, lastlight=0;&lt;/p&gt;<br />
&lt;p&gt;int Ref_light=60;&lt;/p&gt;<br />
&lt;p&gt;void setup(){&lt;/p&gt;<br />
&lt;p&gt;  Ethernet.begin(mac, ip, subnet);&lt;/p&gt;<br />
&lt;p&gt;  analogReference(INTERNAL); //lowers the voltage reference&lt;br /&gt;<br />
  pinMode(8,OUTPUT); //cold&lt;br /&gt;<br />
  pinMode(9,OUTPUT); // hot&lt;br /&gt;<br />
  pinMode(7,OUTPUT); // rele&lt;br /&gt;<br />
  pinMode(6,OUTPUT); // buzzer&lt;br /&gt;<br />
  pinMode(5,INPUT); // analog temp sensor&lt;br /&gt;<br />
  pinMode(0,INPUT); // analog light sensor&lt;br /&gt;<br />
  pinMode(2,OUTPUT); // Led Control&lt;/p&gt;<br />
&lt;p&gt;  Serial.begin(9600);&lt;br /&gt;<br />
}&lt;/p&gt;<br />
&lt;p&gt;void loop()&lt;/p&gt;<br />
&lt;p&gt;{&lt;br /&gt;<br />
  /*Client*/&lt;/p&gt;<br />
&lt;p&gt;  int i=0;&lt;br /&gt;<br />
  long int Rlight=0;&lt;br /&gt;<br />
  float TempAverage=0;&lt;br /&gt;<br />
  int y1=0, light=0, dif=0, clight=0;&lt;br /&gt;<br />
  EthernetClient client = server.available();&lt;/p&gt;<br />
&lt;p&gt;  TempAverage=analogRead(5); // get light and temp values&lt;br /&gt;<br />
  Rlight=analogRead(0);&lt;/p&gt;<br />
&lt;p&gt;  TempAverage = (90.0 * vrif * TempAverage) / 1024.0; // calculating the real light and temp values&lt;/p&gt;<br />
&lt;p&gt;  Rlight*=100;&lt;br /&gt;<br />
  Rlight/=1024;&lt;/p&gt;<br />
&lt;p&gt;  if (client) {    // check for client &lt;/p&gt;<br />
&lt;p&gt;    boolean currentLineIsBlank = true;&lt;/p&gt;<br />
&lt;p&gt;    while (1) // read the URL returned by the web page&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      if (client.available()) {&lt;/p&gt;<br />
&lt;p&gt;        char c = client.read();&lt;/p&gt;<br />
&lt;p&gt;        readString.concat(c);  // assembling the URL in a Arduino String&lt;/p&gt;<br />
&lt;p&gt;        if (c == '\n' &amp;&amp;  currentLineIsBlank)   //if HTTP request has ended&lt;br /&gt;<br />
        {&lt;/p&gt;<br />
&lt;p&gt;          Serial.println(readString);&lt;br /&gt;<br />
          string = readString;&lt;/p&gt;<br />
&lt;p&gt;          if(readString.indexOf(&quot;T=&quot;) &gt; 0) //check for Temperature Reference chage&lt;br /&gt;<br />
          {&lt;/p&gt;<br />
&lt;p&gt;            for(i=0;string[i];i++) // getting the value converted from char to int from the URL&lt;br /&gt;<br />
            {&lt;br /&gt;<br />
              if(string[i] == 'T' &amp;&amp; string[i+1] == '=' &amp;&amp; string[i+2] &gt;=48  &amp;&amp; string[i+2] &lt;=57 &amp;&amp; string[i+3] &gt;= 48 &amp;&amp; string[i+3] &lt;= 57)&lt;br /&gt;<br />
              {&lt;/p&gt;<br />
&lt;p&gt;                switch(string[i+2])&lt;br /&gt;<br />
                {&lt;br /&gt;<br />
                case 48:&lt;br /&gt;<br />
                  y1+= 0;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 49:&lt;br /&gt;<br />
                  y1+=10;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 50:&lt;br /&gt;<br />
                  y1+=20;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 51:&lt;br /&gt;<br />
                  y1+=30;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 52:&lt;br /&gt;<br />
                  y1+=40;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 53:&lt;br /&gt;<br />
                  y1+=50;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 54:&lt;br /&gt;<br />
                  y1+=60;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 55:&lt;br /&gt;<br />
                  y1+=70;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 56:&lt;br /&gt;<br />
                  y1+=80;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 57:&lt;br /&gt;<br />
                  y1+=90;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                }&lt;br /&gt;<br />
                switch(string[i+3])&lt;br /&gt;<br />
                {&lt;br /&gt;<br />
                case 48:&lt;br /&gt;<br />
                  y1+= 0;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 49:&lt;br /&gt;<br />
                  y1+=1;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 50:&lt;br /&gt;<br />
                  y1+=2;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 51:&lt;br /&gt;<br />
                  y1+=3;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 52:&lt;br /&gt;<br />
                  y1+=4;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 53:&lt;br /&gt;<br />
                  y1+=5;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 54:&lt;br /&gt;<br />
                  y1+=6;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 55:&lt;br /&gt;<br />
                  y1+=7;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 56:&lt;br /&gt;<br />
                  y1+=8;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                case 57:&lt;br /&gt;<br />
                  y1+=9;&lt;br /&gt;<br />
                  break;&lt;br /&gt;<br />
                }&lt;/p&gt;<br />
&lt;p&gt;              }&lt;br /&gt;<br />
            }&lt;/p&gt;<br />
&lt;p&gt;          }&lt;/p&gt;<br />
&lt;p&gt;            if(readString.indexOf(&quot;L=&quot;) &gt; 0) // check for Light Reference change&lt;br /&gt;<br />
           {&lt;/p&gt;<br />
&lt;p&gt;           for(i=0;string[i] != '&#92;&#48;';i++) // getting the value converted from char to int from the URL&lt;br /&gt;<br />
           {&lt;/p&gt;<br />
&lt;p&gt;           if(string[i] == 'L' &amp;&amp;string[i+1] == '=' &amp;&amp; string[i+2] &gt;=48  &amp;&amp; string[i+2] &lt;=57 &amp;&amp; string[i+3] &gt;= 48 &amp;&amp; string[i+3] &lt;= 57)&lt;br /&gt;<br />
           {&lt;/p&gt;<br />
&lt;p&gt;           switch(string[i+2])&lt;br /&gt;<br />
           {&lt;br /&gt;<br />
           case 48:&lt;br /&gt;<br />
           light+= 0;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 49:&lt;br /&gt;<br />
           light+=10;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 50:&lt;br /&gt;<br />
           light+=20;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 51:&lt;br /&gt;<br />
           light+=30;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 52:&lt;br /&gt;<br />
           light+=40;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 53:&lt;br /&gt;<br />
           light+=50;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 54:&lt;br /&gt;<br />
           light+=60;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 55:&lt;br /&gt;<br />
           light+=70;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 56:&lt;br /&gt;<br />
           light+=80;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 57:&lt;br /&gt;<br />
           light+=90;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           }&lt;br /&gt;<br />
           switch(string[i+3])&lt;br /&gt;<br />
           {&lt;br /&gt;<br />
           case 48:&lt;br /&gt;<br />
           light+= 0;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 49:&lt;br /&gt;<br />
           light+=1;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 50:&lt;br /&gt;<br />
           light+=2;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 51:&lt;br /&gt;<br />
           light+=3;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 52:&lt;br /&gt;<br />
           light+=4;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 53:&lt;br /&gt;<br />
           light+=5;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 54:&lt;br /&gt;<br />
           light+=6;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 55:&lt;br /&gt;<br />
           light+=7;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 56:&lt;br /&gt;<br />
           light+=8;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           case 57:&lt;br /&gt;<br />
           light+=9;&lt;br /&gt;<br />
           break;&lt;br /&gt;<br />
           }&lt;/p&gt;<br />
&lt;p&gt;           }&lt;br /&gt;<br />
           }&lt;br /&gt;<br />
           }&lt;/p&gt;<br />
&lt;p&gt;          break;&lt;br /&gt;<br />
        }&lt;/p&gt;<br />
&lt;p&gt;      }&lt;br /&gt;<br />
    }&lt;/p&gt;<br />
&lt;p&gt;    Serial.println(y1);&lt;br /&gt;<br />
    Serial.println(light);&lt;/p&gt;<br />
&lt;p&gt;    if(temp1 &lt; (int)TempAverage &amp;&amp; temp1 != 0) // control the Relay (air conditioning) depending on the temperature&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      Rele=1;&lt;br /&gt;<br />
    }&lt;br /&gt;<br />
    if(temp1 &gt; (int)TempAverage &amp;&amp; temp1 != 0)&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      Rele=1;&lt;br /&gt;<br />
    }&lt;br /&gt;<br />
    if(temp1 == (int)TempAverage &amp;&amp; temp1 != 0)&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      Rele=0;&lt;br /&gt;<br />
    }&lt;br /&gt;<br />
    if(Rele == 1)&lt;br /&gt;<br />
    TempAverage-=12;&lt;/p&gt;<br />
&lt;p&gt;    if(Rlight&gt;light)  //check for light issues&lt;br /&gt;<br />
    clight= Rlight-light;&lt;br /&gt;<br />
    else&lt;br /&gt;<br />
    clight=light-Rlight;&lt;/p&gt;<br />
&lt;p&gt;    if(clight &gt; 10)&lt;br /&gt;<br />
    digitalWrite(2,HIGH);&lt;br /&gt;<br />
    else&lt;br /&gt;<br />
    digitalWrite(2,LOW);&lt;/p&gt;<br />
&lt;p&gt;    // Web page:&lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;&lt;!DOCTYPE html&gt;&quot;);&lt;br /&gt;<br />
    client.println(&quot;&lt;?php session_start(); ?&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;&lt;html&gt; &quot;);   &lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;&lt;head&gt;&lt;meta http-equiv=\&quot;refresh\&quot; content=\&quot;10\&quot;&gt;&lt;title&gt;ARDUINO Led Control&lt;/title&gt;&lt;meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' &gt;&lt;a href=&quot;&quot;http://www.hydrasolutions.it&quot;&quot;&gt;&lt;img src=&quot;&quot;http://2.bp.blogspot.com/-p5i_N2bHBOk/U7b48Dwy_tI/AAAAAAAAABY/IEIbQcWPJRQ/s1600/logotr.png&quot;&quot; alt=&quot;&quot;Hydra Icon/&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/head&gt;&lt;body&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;&lt;br /&gt;<br />
&lt;table&gt;<br />
&lt;tr&gt;<br />
&lt;th&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot; &lt;/th&gt;<br />
&lt;td&gt;<br />
&lt;table border=&quot;&quot;&gt;<br />
&lt;tr&gt;<br />
&lt;th&gt;Reference Temperature &lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
    client.println(&quot;<br />
&lt;th&gt;<br />
&lt;form action=&quot;&quot;method=get&quot;&quot;&gt;&lt;input type=&quot;&quot;text&quot;&quot; name=&quot;&quot;T&quot;&quot; value=&quot;&quot;Insert&quot;&quot;&gt;&lt;input type=&quot;&quot;submit&quot;&quot; value=&quot;&quot;check&quot;&quot;&gt;&lt;?phpif(!isset($_GET['temp']))$var_1 = ;else$var_1 = $_GET['temp'];$_SESSION['data'] = $var_1;&gt;&lt;/form&gt;<br />
&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
    client.println(&quot;<br />
&lt;th&gt;Reference Light&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
    client.println(&quot;<br />
&lt;th&gt;<br />
&lt;form action=&quot;&quot;method=get&quot;&quot;&gt;&lt;input type=&quot;&quot;text&quot;&quot; name=&quot;&quot;L&quot;&quot; value=&quot;&quot;Insert&quot;&quot;&gt;&lt;input type=&quot;&quot;submit&quot;&quot; value=&quot;&quot;Try&quot;&quot;&gt;&lt;?phpif(!isset($_GET['temp']))$var_2 = ;else$var_2 = $_GET['temp'];$_SESSION['data'] = $var_2;?&gt;&lt;/form&gt;<br />
&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;th&gt;Reference temperature set to &lt;/th&gt;<br />
&lt;th&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    if(y1 == 0)&lt;br /&gt;<br />
      client.print(temp1);&lt;br /&gt;<br />
    else&lt;br /&gt;<br />
      client.print(y1);&lt;br /&gt;<br />
   client.println(&quot;&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;   client.println(&quot;<br />
&lt;th&gt;Refence light set to &lt;/th&gt;<br />
&lt;th&gt;&quot;);&lt;br /&gt;<br />
   if(light == 0)&lt;br /&gt;<br />
    client.print(temp2);&lt;br /&gt;<br />
    else&lt;br /&gt;<br />
    client.print(light);&lt;br /&gt;<br />
   client.println(&quot;%&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;   client.println(&quot;&lt;/th&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;th&gt;Temperature of the room   &lt;/th&gt;<br />
&lt;th&gt;&quot;);&lt;br /&gt;<br />
   if(Rele == 1)&lt;br /&gt;<br />
      TempAverage-=12;&lt;br /&gt;<br />
    else&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
    }&lt;br /&gt;<br />
    client.println(TempAverage);&lt;br /&gt;<br />
    client.println(&quot;&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;<br />
&lt;th&gt;Light leven of the room    &lt;/th&gt;<br />
&lt;th&gt;&quot;);&lt;br /&gt;<br />
    client.print(Rlight);&lt;br /&gt;<br />
   client.println(&quot;%&lt;/th&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
   client.println(&quot;&lt;/table&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;p&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    if(temp1 &lt; (int)TempAverage &amp;&amp; temp1 != 0)&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      client.println(&quot;<br />
&lt;p&gt;Turn heater ON!&lt;/p&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
      digitalWrite(7,HIGH); // RELE&lt;br /&gt;<br />
      digitalWrite(8,LOW); // blue&lt;br /&gt;<br />
      digitalWrite(9,HIGH); // reed&lt;/p&gt;<br />
&lt;p&gt;    }&lt;br /&gt;<br />
    if(temp1 &gt; (int)TempAverage &amp;&amp; temp1 != 0)&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      client.println(&quot;<br />
&lt;p&gt;Turn Air conditioner ON!&lt;/p&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
      digitalWrite(7,HIGH); // RELE&lt;br /&gt;<br />
      digitalWrite(8,HIGH); // blue&lt;br /&gt;<br />
      digitalWrite(9,LOW); // reed&lt;br /&gt;<br />
    }&lt;br /&gt;<br />
    if(temp1 == (int)TempAverage &amp;&amp; temp1 != 0)&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      client.println(&quot;<br />
&lt;p&gt;Teperature OK!&lt;/p&gt;<br />
&lt;p&gt;&quot;);&lt;br /&gt;<br />
      digitalWrite(7,LOW); // REL&lt;br /&gt;<br />
      digitalWrite(8,LOW); // green&lt;br /&gt;<br />
      digitalWrite(9,LOW); // reed&lt;br /&gt;<br />
    }  &lt;/p&gt;<br />
&lt;p&gt;    client.println(&quot;&lt;/body&gt;&lt;/html&gt;&quot;);&lt;/p&gt;<br />
&lt;p&gt;    readString=&quot;&quot;;&lt;/p&gt;<br />
&lt;p&gt;    if(y1 != temp1 &amp;&amp; y1 != 0)  //saving the References in a global variable in order for the values not to be losed in the loop process&lt;br /&gt;<br />
      temp1=y1;&lt;/p&gt;<br />
&lt;p&gt;    if(light != temp2 &amp;&amp; light != 0)&lt;br /&gt;<br />
      temp2=light;&lt;/p&gt;<br />
&lt;p&gt;    client.stop();&lt;/p&gt;<br />
&lt;p&gt;   delay(2000);&lt;/p&gt;<br />
&lt;p&gt;    if(light &gt; Ref_light+10) //making the buzzer buzz when the light levels are diferent&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      tone(6,960,1000);&lt;br /&gt;<br />
      delay(500);&lt;br /&gt;<br />
    }&lt;br /&gt;<br />
    if(light &lt; Ref_light-10)&lt;br /&gt;<br />
    {&lt;br /&gt;<br />
      tone(6,960,1000);&lt;br /&gt;<br />
      delay(500);&lt;br /&gt;<br />
    }&lt;/p&gt;<br />
&lt;p&gt;  }&lt;/p&gt;<br />
&lt;p&gt;}&lt;br /&gt;<br />

 31 of July 2014

Alexandre Leitao

Gonçalo Neto

Arduino: Maggior controllo della luce – Resoconto attività 31 luglio 2014

Scritto da Alessandra De Rosa on . Postato in Formazione, Prodotti, Progetto Leonardo da Vinci, Servizi

Today we started a new project based on the last projects we’ve been doing, which consisted on controlling the temperature and light via web. For this one, we had more control of the light, because we added a feature where we turned on the led when the difference between the reference light and the actual light is greater than 10%.

Finally, we made the tutorial for this project with pictures, explanation and the code. We also made a video.

 

31 of July 2014

Alexandre Leitao

Gonçalo Neto

Tutorial Arduino: control of temperature and light with a buzzer – Controllo della temperature e della luminosità con l’aggiunta di un buzzer

Scritto da Alessandra De Rosa on . Postato in Formazione, Prodotti, Progetto Leonardo da Vinci, Servizi, Tutorials Arduino

For this tutorial consists on controlling the light using a buzzer and controlling the temperature.

Here are the components we used:

  • 1 Arduino
  • 1 Ethernet Shield
  • 1 Relay
  • 1 Temperature sensor
  • 1 Light sensor
  • 3 Leds
  • 3 Resistors
  • 1 Buzzer

The web page has one table for the temperature with a text box and the actual temperature and one simple table for the light.

Depending on the values we put comparing with the temperature, above the table appears text saying when to turn on/off the air conditioner.

For the light, depending on the light sensor gets, if the light level is 10% higher/lower than the internal reference temperature the buzzer makes sound (in the video it is set to 60%).

How it looks:

arduino temperature and light control refresh with buzzer

Same temperature:

arduino temperature and light control refresh with buzzer

Lower temperature:

arduino temperature and light control refresh with buzzer

Higher temperature:

arduino temperature and light control refresh with buzzer

Code:

#include &lt;String.h&gt;<br />
#include &lt;SPI.h&gt;<br />
#include &lt;Ethernet.h&gt;<br />
byte mac[] = {<br />
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // mac address<br />
byte ip[] = {<br />
  192, 168, 1, 25 }; // ip arduino internet in<br />
byte subnet[] = {<br />
  255, 255, 255, 0 }; //subnet mask<br />
EthernetServer server(80); //server port<br />
String readString; //string<br />
String string;<br />
int temp1=0 , temp2=0;<br />
int vrif = 1.1;<br />
int Rele = 0, lastlight=0;<br />
int Ref_light=60;</p>
<p>void setup(){<br />
  Ethernet.begin(mac, ip, subnet);<br />
  analogReference(INTERNAL); //lowers the voltage reference<br />
  pinMode(8,OUTPUT); //cold<br />
  pinMode(9,OUTPUT); // hot<br />
  pinMode(7,OUTPUT); // rele<br />
  pinMode(6,OUTPUT);<br />
  pinMode(5,INPUT);<br />
  pinMode(0,INPUT);</p>
<p>  Serial.begin(9600);<br />
}<br />
void loop()<br />
{<br />
  /*Client*/</p>
<p>  int i=0; //y1 = temperatura e light = light level from user<br />
  long int Rlight=0;<br />
  float TempAverage=0;<br />
  int y1=0, light=0, dif=0; // references posted by the user!<br />
  EthernetClient client = server.available();</p>
<p>  TempAverage=analogRead(5);<br />
  Rlight=analogRead(0);</p>
<p>  TempAverage = (90.0 * vrif * TempAverage) / 1024.0;</p>
<p>  Rlight*=100;<br />
  Rlight/=1024;</p>
<p>  if (client) {<br />
    boolean currentLineIsBlank = true;<br />
    //tone(13,960,1000);<br />
    while (1)<br />
    {<br />
      if (client.available()) {</p>
<p>        char c = client.read();</p>
<p>        readString.concat(c);<br />
        //Serial.println(readString);<br />
        //if HTTP request has ended<br />
        if (c == '\n' &amp;&amp;  currentLineIsBlank)<br />
        {<br />
          Serial.println(readString);<br />
          string = readString;<br />
          if(readString.indexOf(&quot;T=&quot;) &gt; 0)<br />
          {<br />
            for(i=0;string[i];i++)<br />
            {<br />
              if(string[i] == 'T' &amp;&amp; string[i+1] == '=' &amp;&amp; string[i+2] &gt;=48  &amp;&amp; string[i+2] &lt;=57 &amp;&amp; string[i+3] &gt;= 48 &amp;&amp; string[i+3] &lt;= 57)<br />
              {<br />
                switch(string[i+2])<br />
                {<br />
                case 48:<br />
                  y1+= 0;<br />
                  break;<br />
                case 49:<br />
                  y1+=10;<br />
                  break;<br />
                case 50:<br />
                  y1+=20;<br />
                  break;<br />
                case 51:<br />
                  y1+=30;<br />
                  break;<br />
                case 52:<br />
                  y1+=40;<br />
                  break;<br />
                case 53:<br />
                  y1+=50;<br />
                  break;<br />
                case 54:<br />
                  y1+=60;<br />
                  break;<br />
                case 55:<br />
                  y1+=70;<br />
                  break;<br />
                case 56:<br />
                  y1+=80;<br />
                  break;<br />
                case 57:<br />
                  y1+=90;<br />
                  break;<br />
                }<br />
                switch(string[i+3])<br />
                {<br />
                case 48:<br />
                  y1+= 0;<br />
                  break;<br />
                case 49:<br />
                  y1+=1;<br />
                  break;<br />
                case 50:<br />
                  y1+=2;<br />
                  break;<br />
                case 51:<br />
                  y1+=3;<br />
                  break;<br />
                case 52:<br />
                  y1+=4;<br />
                  break;<br />
                case 53:<br />
                  y1+=5;<br />
                  break;<br />
                case 54:<br />
                  y1+=6;<br />
                  break;<br />
                case 55:<br />
                  y1+=7;<br />
                  break;<br />
                case 56:<br />
                  y1+=8;<br />
                  break;<br />
                case 57:<br />
                  y1+=9;<br />
                  break;<br />
                }<br />
              }<br />
            }<br />
          }<br />
          break;<br />
        }<br />
      }<br />
    }</p>
<p>    Serial.println(y1);<br />
    Serial.println(light);</p>
<p>    if(temp1 &lt; (int)TempAverage &amp;&amp; temp1 != 0)<br />
    {<br />
      Rele=1;<br />
    }<br />
    if(temp1 &gt; (int)TempAverage &amp;&amp; temp1 != 0)<br />
    {<br />
      Rele=1;<br />
    }<br />
    if(temp1 == (int)TempAverage &amp;&amp; temp1 != 0)<br />
    {<br />
      Rele=0;<br />
    }<br />
    if(Rele == 1)<br />
    TempAverage-=12;</p>
<p>    // Web page:<br />
    client.println(&quot;&lt;!DOCTYPE html&gt;&quot;);<br />
    client.println(&quot;&lt;?php session_start(); ?&gt;&quot;);<br />
    client.println(&quot;&lt;html&gt; &quot;);<br />
    client.println(&quot;&lt;table&gt;&lt;tr&gt;&lt;th&gt;&quot;);<br />
    client.println(&quot; &lt;tr&gt;&lt;td&gt;&lt;table border=&quot;&quot;&gt;&lt;tr&gt;&lt;th&gt;Reference Temperature &lt;/th&gt;&quot;);<br />
    client.println(&quot;&lt;th&gt;&lt;form action=&quot;&quot; method=&quot;&quot;get&quot;&quot;&gt;&lt;input type=&quot;&quot;text&quot;&quot; name=&quot;&quot;T&quot;&quot; value=&quot;&quot;Insert value&quot;&quot;&gt;&lt;input type=&quot;&quot;submit&quot;&quot; value=&quot;&quot;check&quot;&quot;&gt;&lt;?phpif(!isset($_GET['temp']))$var_1 = &quot;&quot;;else$var_1 = $_GET['temp'];$_SESSION['data'] = $var_1;?&gt;&lt;/th&gt;&quot;);<br />
    client.println(&quot;&lt;tr&gt;&lt;/tr&gt;&lt;th&gt;Reference temperature set to &lt;/th&gt;&lt;th&gt;&quot;);<br />
    if(y1 == 0)<br />
      client.print(temp1);<br />
    else<br />
      client.print(y1);</p>
<p>    client.print(&quot;&lt;/th&gt;&lt;tr&gt;&quot;);<br />
    client.println(&quot;&lt;tr&gt;&lt;th&gt;Temperature of the room   &lt;/th&gt;&lt;th&gt;&quot;);<br />
    if(Rele == 1)<br />
      TempAverage-=12;<br />
    else<br />
    {<br />
    }<br />
    client.println(TempAverage);<br />
    client.print(&quot;&lt;/th&gt;&lt;/tr&gt;&quot;);<br />
    client.println(&quot;&lt;/table&gt;&lt;/td&gt;&quot;);<br />
    client.println(&quot;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;table border=&quot;&quot;&gt;&quot;);<br />
    client.println(&quot;&lt;tr&gt;&lt;th&gt;Light leven of the room    &lt;/th&gt;&lt;th&gt;&quot;);<br />
    client.print(Rlight);<br />
    client.print(&quot;%&lt;/th&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&quot;);<br />
    client.println(&quot;&lt;/table&gt;&quot;);<br />
    if(temp1 &lt; (int)TempAverage &amp;&amp; temp1 != 0)<br />
    {<br />
      client.println(&quot;&lt;p&gt;Turn heater ON!&lt;/p&gt;&quot;);<br />
      digitalWrite(7,HIGH); // RELE<br />
      digitalWrite(8,LOW); // blue<br />
      digitalWrite(9,HIGH); // reed<br />
    }<br />
    if(temp1 &gt; (int)TempAverage &amp;&amp; temp1 != 0)<br />
    {<br />
      client.println(&quot;&lt;p&gt;Turn Air conditioner ON!&lt;/p&gt;&quot;);<br />
      digitalWrite(7,HIGH); // RELE<br />
      digitalWrite(8,HIGH); // blue<br />
      digitalWrite(9,LOW); // reed<br />
    }<br />
    if(temp1 == (int)TempAverage &amp;&amp; temp1 != 0)<br />
    {<br />
      client.println(&quot;&lt;p&gt;Teperature OK!&lt;/p&gt;&quot;);<br />
      digitalWrite(7,LOW); // REL<br />
      digitalWrite(8,LOW); // green<br />
      digitalWrite(9,LOW); // reed<br />
    }<br />
    client.println(&quot;&lt;/body&gt;&lt;/html&gt;&quot;);<br />
    readString=&quot;&quot;;<br />
    if(y1 != temp1 &amp;&amp; y1 != 0)<br />
      temp1=y1;<br />
    if(light != temp2 &amp;&amp; light != 0)<br />
      temp2=light;<br />
    client.stop();<br />
   delay(2000);<br />
    if(light &gt; Ref_light+10)<br />
    {<br />
      tone(6,960,1000);<br />
      delay(500);<br />
    }<br />
    if(light &lt; Ref_light-10)<br />
    {<br />
      tone(6,960,1000);<br />
      delay(500);<br />
    }<br />
  }<br />
}<br />

30 of July 2014

Alexandre Leitao

Gonçalo Neto

Google+