SlideShare ist ein Scribd-Unternehmen logo
1 von 68
Asssociation of Science Education Annual Conference
                      , 3rd January 2013


Arduino for the classroom

     Dr. Francisco Pérez García
      Institut Pompeu Fabra




                      ASE2013 Dr.Pérez                    1
Previous experiences: Contemporary Sciences and Research




                            ASE2013 Dr.Pérez               2
              http://www.youtube.com/watch?v=F_xkHOpMA9s
ASE2013 Dr.Pérez   3
http://www.youtube.com/watch?v=O1MvwAw_MHk
                ASE2013 Dr.Pérez             4
http://www.youtube.com/watch?v=FbuvE1n18ZE

               ASE2013 Dr.Pérez              5
My experience with students (Technology branch):

Course 2011-2012
Year 11: 16-17 years old
4h per week
Number of students: 12

Course 2012-2013 (Set 2012-Dec 2012)
Year 11: 16-17 years old
4h per week
Number of students: 16
(Also 2 students of year 12: 17-18 years old in their compulsory
RESEARCH PROJECT)
    First term: programming with C
    Second term: simple projects with Arduino and preparing project
    Third term: original project with Arduino
At Institut Pompeu Fabra (High School in Martorell near Barcelona,
                               ASE2013 Dr.Pérez                  6
Catalonia)
Student blogs 2011-2012 (Catalan language and part in
English)
http://cricardoromani.wordpress.com
http://cdanielaparicio.wordpress.com
http://cjordinieto.wordpress.com
http://cjosepalemany.wordpress.com
http://cadrianarrebola.wordpress.com
http://calexdelrincon.wordpress.com
http://ccristiansegovia.wordpress.com

Student blogs 2012-2013 (Only in English language)
http://candreamasegosa.wordpress.com
http://ckelianpordoy.wordpress.com
http://civanroldan.wordpress.com
http://cadriansanchez.wordpress.com
http://cvictorsalvador.wordpress.com
http://ccarlesdelaiglesia.wordpress.com
                           ASE2013 Dr.Pérez             7
ASE2013 Dr.Pérez   8
ASE2013 Dr.Pérez   9
WHY PROGRAMMING?

•   Computer science is no more about
    computers than astronomy is about
    telescopes. Edsger Dijkstra
•   The computer revolution hasn’t happened
    yet. Allan Kay
•   Debugging is the essence of intellectual
    activity. Seymour Pappert

                    ASE2013 Dr.Pérez       10
TINKERING




ASE2013 Dr.Pérez         11
Tinkering, the “MacGyver” style
From the “Tinkering” exhibition at the Exploratorium,
San Francisco:

“Tinkering is what happens when you try something you
don’t quite know how to do, guided by whim, imagination,
and curiosity.
When you tinker, there are no instructions - but there
are also no failures, no right or wrong ways of doing
things. It’s about figuring out how things work and
reworking them.
Contraptions, machines, wildly mismatched objects
working in harmony - This the stuff of tinkering.”

                         ASE2013 Dr.Pérez               12
This definition says a lot about the Arduino way of
prototyping. Actually there is not a manual on how to
do things but a reference collection of samples that
people can modify and combine with other examples
to learn about the logic of the programme and the
board.
It’s a “hands on” way of working in which even junk
becomes a source for learning and building
prototypes.
The reuse of material from other fields is an other big
knowledge and material source. Learning how to do
things by looking how other things work and can be
hacked.
Circuit bending and patching are two key words in this
learning school.
                     ASE2013 Dr.Pérez                13
THE HACKER ATTITUDE FOR OUR STUDENTS




               ASE2013 Dr.Pérez    14
The Hacker Attitude for our students

Five things taken from Eric S. Raymond’s
How To Become a Hacker:
1. The world is full of fascinating problems
waiting to be solved.
2. No problem should ever have to be solved
twice.
3. Boredom and drudgery are evil.
4. Freedom is good.
5. Attitude is no substitute for competence.
                  ASE2013 Dr.Pérez        15
What is Arduino
• Open Source Hardware, you can make your
  own board, or buy one.
• Cheap, easily available.
• Open Source Software.
• Very widespread, many projects openly
  available.
• Extra HW (shields) available (over 250 at
  http://shieldlist.com.
                    ASE2013 Dr.Pérez          16
ESPLORA




          LEONARDO




                     ASE2013 Dr.Pérez   17
Arduino Uno




    ASE2013 Dr.Pérez   18
Arduino Language
•   C like syntax, but simplified
•   Abstracts the pin naming to numbers
•   Trades efficience for ease of use
•   Easy to learn, yet powerful
•   Lots of example code
•   Easy to reuse C-code from other projects
•   Libraries can be written in C++
•   Lots of libraries available
                     ASE2013 Dr.Pérez          19
Download Arduino software at
       www.arduino.cc




               Console



ASE2013 Dr.Pérez               20
BOARD TYPE




ASE2013 Dr.Pérez          21
Sketch name or version
              Toolbar

       Save
       Open
     New
  Upload
Verify                                     Code




                        ASE2013 Dr.Pérez          22
Comments
                   about the
                   code
                   Setup code
                   Define
                   variables

                   Loop code
                   Main
                   code
ASE2013 Dr.Pérez           23
/*Blink
Turns on an LED on for one second,
then off for one second, repeatedly. Blink code is the equivalent
This example code is based on exampleto a Hello world to test
code that is in the public domain.*/
const int LED = 13; /* LED connected our Arduino board
to digital pin 13*/
void setup() {
// initialize the digital pin as an output.
/*Pin 13 has an LED connected on most
Arduino boards: */
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(LED, LOW); // set the LED off
delay(1000); // wait for a second
}
                                    ASE2013 Dr.Pérez         24
ASE2013 Dr.Pérez   25
ARDUINO AND A DC MOTOR



                              Arduino Uno

DC motor
           Transistor IRF530
           Resistor                     AND THIS
           Diode 1N4001                 SOURCE CODE


                    ASE2013 Dr.Pérez              26
SOURCE CODE FOR ARDUINO MOTOR

const int transistorPin = 9; // connected to transistor gate

void setup() {
pinMode(transistorPin, OUTPUT);
}

void loop()
{          // loop= repeat again and again
digitalWrite(transistorPin, HIGH); // switch the motor on
delay(50); // wait for 50 miliseconds
digitalWrite(transistorPin, LOW); // switch the motor off
delay(5000); // wait for 5 seconds

}




                                   ASE2013 Dr.Pérez            27
MOTOR TO IRRADIATE A SURFACE VERY SLOWLY




                   ASE2013 Dr.Pérez        28
ASE2013 Dr.Pérez   29
http://www.youtube.com/watch?v=UQEtOJE02wE

              ASE2013 Dr.Pérez               30
http://www.youtube.com/watch?v=e1iUjelHC6w

                  ASE2013 Dr.Pérez           31
RGB LED BLINKING




                   ASE2013 Dr.Pérez   32
Controlling LEDs cubes: Explosion example

int Columns[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int Rows[] = {12, 11, 10};
int t=400;
void setup() /*For loop: if this conditional is true do the code inside
{              the curly brackets, if it’s false exists the for loop*/
int counter;
for (int counter = 0; counter < 10; counter++){
pinMode(Columns[counter], OUTPUT); }
for (int counter = 0; counter < 4; counter++){
pinMode(Rows[counter], OUTPUT); }
}
void loop()
{
digitalWrite(Rows[1], HIGH);
digitalWrite(Columns[4], HIGH);
delay(t);
                             ASE2013 Dr.Pérez                    33
for(int i=0;i<t;i++){
  if(i%2==0){                                  digitalWrite(Rows[0], HIGH);
    digitalWrite(Rows[0], LOW);                digitalWrite(Rows[2], HIGH);
    digitalWrite(Rows[2], LOW);                digitalWrite(Columns[1], HIGH);
    digitalWrite(Columns[1], HIGH);            digitalWrite(Columns[3], HIGH);
    digitalWrite(Columns[3], HIGH);            digitalWrite(Columns[5], HIGH);
    digitalWrite(Columns[5], HIGH);            digitalWrite(Columns[7], HIGH);
                                           }
    digitalWrite(Columns[7], HIGH);            else {
  }                                             digitalWrite(Rows[0], LOW);
  else {                                        digitalWrite(Rows[2], LOW);
    digitalWrite(Columns[1], LOW);              digitalWrite(Columns[0], HIGH);
    digitalWrite(Columns[3], LOW);              digitalWrite(Columns[2], HIGH);
    digitalWrite(Columns[5], LOW);              digitalWrite(Columns[8], HIGH);
    digitalWrite(Columns[7], LOW);              digitalWrite(Columns[6], HIGH);
    digitalWrite(Rows[0], HIGH);               }
    digitalWrite(Rows[2], HIGH);               delay(1);
  }                                          }
  delay(1);                                  digitalWrite(Rows[0], HIGH);
}                                            digitalWrite(Rows[2], HIGH);
 for(int j=0; j<t; j++){                     delay(t);
   if(j%2==0){                               for (int counter = 0; counter < 10; counter++){
    digitalWrite(Columns[0], LOW);          digitalWrite(Columns[counter], LOW); }
    digitalWrite(Columns[2], LOW);          for (int counter = 0; counter < 4; counter++){
    digitalWrite(Columns[8], LOW);          digitalWrite(Rows[counter], LOW); }
    digitalWrite(Columns[6], LOW);    ASE2013 Dr.Pérez                               34
                                            }
ASE2013 Dr.Pérez   35
ASE2013 Dr.Pérez   36
http://www.youtube.com/watch?v=z4Qo9NDDRco
                       ASE2013 Dr.Pérez      37
Materials for
      LDR and LED-RGB using Arduino

●   -4 resistor 220 Ω
●   -1 LDR sensor
●   -1 RGB LED
●   -1 potenciometer
●   -1 Arduino Uno
●   - Wire
●   - Breadboard
●   - USB wire AB type or microUSB for Arduino Leonardo
                            ASE2013 Dr.Pérez              38
LDR




      ASE2013 Dr.Pérez   39
Pulse width modulation




             ASE2013 Dr.Pérez   40
ASE2013 Dr.Pérez   41
Microcontroller ATMega328
               Brain
               Sight
         Hearing                                 Sensors
         Smell                                   (analog inputs)
                    Taste
                      Touch
Nerves                                          Wires, Circuit




                                      Muscles
                                                      Actuators
                                                      (analog
                                      Heart           outputs)
                   ASE2013 Dr.Pérez                              42
Analog to digital conversion
                                 Analog sensor 0 to 5V


                                Sampling at Nyquist rate



                                  Value of each sample
                                  transformed to binary
                                  format



             ASE2013 Dr.Pérez                      43
ASE2013 Dr.Pérez   44
ASE2013 Dr.Pérez   45
SOURCE CODE: RGB-LED colour change depending on light level

int valueLDR = 1; /*First we define the variable name as integer and it is assigned
                  a value*/
int ledRed = 9;

int ledGreen=10; // or /*Comment*/ can be anywhere, do not affect code, help others

int ledBlue=11;

int pinLDR = 1;

//3 outputs for each RGB colour: red, green and blue
               /*The setup function comes before the loop function, and everything
void setup(){
               happens inside the curly backets*/
pinMode(ledRed, OUTPUT);
                           /*Outputs are declared in setup, this is done by
pinMode(ledGreen, OUTPUT); usingthe pinMode function, in this particular
                           example we declare numbers 9, 10 and 11 as
pinMode(ledBlue, OUTPUT); OUTPUT (in capital letters)*/

analogReference(EXTERNAL);
                                   ASE2013 Dr.Pérez                           46
}
void loop() {     The “void” in the header is what the function will return (or spit out)
                  when it happens, in this case it returns nothing so it is void
valueLDR = analogRead(pinLDR);

if(valueLDR >= 1023){

digitalWrite(ledRed, 128);

digitalWrite(ledGreen, 0);

digitalWrite(ledBlue, 0);

// digitalWrite to obtain different colours

}

else if((valueLDR >= 959) & (valueLDR < 1023)){

digitalWrite(ledRed, 255);

digitalWrite(ledGreen, 0);

digitalWrite(ledBlue, 0);
                                         ASE2013 Dr.Pérez                                   47
}
else if((valueLDR >= 895) & (valueLDR < 959)){   else if((valueLDR >= 639) & (valueLDR < 703)){else if((valueLDR >= 383) & (valueLDR < 447)){


digitalWrite(ledRed, 255);                       digitalWrite(ledRed, 128);                   digitalWrite(ledRed, 0);


digitalWrite(ledGreen, 128);                     digitalWrite(ledGreen, 128);                 digitalWrite(ledGreen, 128);


digitalWrite(ledBlue, 0);}                       digitalWrite(ledBlue, 255);}                 digitalWrite(ledBlue, 0);}


else if((valueLDR >= 831) & (valueLDR < 895)){   else if((valueLDR >= 575) & (valueLDR < 639)){else if((valueLDR >= 319) & (valueLDR < 383)){


digitalWrite(ledRed, 255);                       digitalWrite(ledRed, 0);                     digitalWrite(ledRed, 0);


digitalWrite(ledGreen, 255);                     digitalWrite(ledGreen, 128);                 digitalWrite(ledGreen, 255);


digitalWrite(ledBlue, 0);}                       digitalWrite(ledBlue, 255);}                 digitalWrite(ledBlue, 0);}


else if((valueLDR >= 767) & (valueLDR < 831)){   else if((valueLDR >= 511) & (valueLDR < 575)){else if((valueLDR >= 255) & (valueLDR < 319)){


digitalWrite(ledRed, 255);                       digitalWrite(ledRed, 0);                     digitalWrite(ledRed, 128);


digitalWrite(ledGreen, 255);                     digitalWrite(ledGreen, 0);                   digitalWrite(ledGreen, 255);


digitalWrite(ledBlue, 128);}                     digitalWrite(ledBlue, 255);}                 digitalWrite(ledBlue, 0);}


else if((valueLDR >= 703) & (valueLDR < 767)){   else if((valueLDR >= 447) & (valueLDR < 511)){else if((valueLDR >= 191) & (valueLDR < 255)){


digitalWrite(ledRed, 128);                       digitalWrite(ledRed, 0);                     digitalWrite(ledRed, 0);


digitalWrite(ledGreen, 255);                     digitalWrite(ledGreen, 0);                   digitalWrite(ledGreen, 255);


digitalWrite(ledBlue, 255);                      digitalWrite(ledBlue, 128);                  digitalWrite(ledBlue, 128);
                                                              ASE2013 Dr.Pérez                                                    48
}                                                }                                            }
else if((valueLDR >= 127) & (valueLDR < 191)) else

{                                                {

digitalWrite(ledRed, 128);                       digitalWrite(ledRed, 0);

digitalWrite(ledGreen, 255);                     digitalWrite(ledGreen, 0);

digitalWrite(ledBlue, 128);}                     digitalWrite(ledBlue, 0);

else if((valueLDR >= 63) & (valueLDR < 127))     }

{                                                }

digitalWrite(ledRed, 128);                       void color(int red, int green, int blue)

digitalWrite(ledGreen, 128);                     {

digitalWrite(ledBlue, 128);}                     analogWrite(ledRed, 255-red);

else if((valueLDR >=0) & (valueLDR < 63)){       analogWrite(ledGreen, 255-green);

digitalWrite(ledRed, 55);                        analogWrite(ledBlue, 255-blue);

digitalWrite(ledGreen, 55);                      // PWM for every colour

digitalWrite(ledBlue, 55); }           ASE2013 Dr.Pérez                                     49
http://www.youtube.com/watch?v=hxkYNy4zTWc
                          ASE2013 Dr.Pérez   50
ASE2013 Dr.Pérez   51
Playing music with Arduino
http://www.youtube.com/watch?v=YDL9WIVfS9w




                          ASE2013 Dr.Pérez   52
ASE2013 Dr.Pérez   53
ASE2013 Dr.Pérez   54
Spychip technology?
                      ASE2013 Dr.Pérez   55
ASE2013 Dr.Pérez   56
ASE2013 Dr.Pérez   57
SENSORS FOR
                   ARDUINO




ASE2013 Dr.Pérez           58
Transistor: to amplify the signal of the
sensor to the Arduino
                 ASE2013 Dr.Pérez          59
Sensors with 1kOhm resistor an NPN amplifier transistor
and a 7805 regulator transitor and sensors from Sandbox
Electronics, battery, LCD and Arduino Uno board
                           ASE2013 Dr.Pérez            60
LED RGB AS AN EMITTER AND
         NORMAL LED AS A SENSOR
           AND PROGRAM THE
           BRUNTON ALGORITHM TO
           TRANSFORM RGB EMISSION
           TO WAVELENGTH 350-700u




ASE2013 Dr.Pérez              61
Cloud internet of things platforms: www.cosm.com
Visualize and store sensor data online www.nimbits.com
                          ASE2013 Dr.Pérez
                                           www.thingspeak.com
                                                           62
ASE2013 Dr.Pérez   63
ASE2013 Dr.Pérez   64
http://www.virtualbreadboard.net
                    ASE2013 Dr.Pérez   65
Approximate pricing
• Arduino Leonardo             €25
• Resistors, LEDs, LDR         around €5
• Breadboard                   €10
• MQ sensors (CO, CH4, etc)    €5 each
• MG811 (CO2 sensor)           €50
• Voice recognition shield     €60
• Arduino for Android          €50
Sometimes very high import taxes from China!

                    ASE2013 Dr.Pérez           66
Resources
•   www.arduino.cc
•   http://blocs.xtec.cat/mecanica
•   www.sparkfun.com
•   www.fritzing.org
•   www.buildinginternetofthings.com
•   www.atmel.com/avr
•   www.avrfreaks.net
•   www.mcselec.com
•   www.argentdata.com

                     ASE2013 Dr.Pérez   67
ACKNOWLEGMENTS

This project on Arduino for the classroom is part of a project entitled
«Contemporary Sciences and Research» given to Institut Pompeu Fabra
from 2012 to 2014 and includes a book edition on Contemporary
Sciences


More information on Arduino and videos http://blocs.xtec.cat/mecanica

More information on the whole project at http://blocs.xtec.cat/pile

Book available on Nature magazine discoveries in 2012 supported by
this project at http://www.formaciovirtual.com/cs



                              ASE2013 Dr.Pérez                    68

Weitere ähnliche Inhalte

Ähnlich wie Arduino2013

Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hqAndreis Santos
 
Building Connected IoT Gadgets with Particle.io & Azure
Building Connected IoT Gadgets with Particle.io & AzureBuilding Connected IoT Gadgets with Particle.io & Azure
Building Connected IoT Gadgets with Particle.io & AzureNick Landry
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerMujahid Hussain
 
Arduino experimenters guide ARDX
Arduino experimenters guide ARDXArduino experimenters guide ARDX
Arduino experimenters guide ARDXJohnny Parrales
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduinoBetsy Eng
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino ProgrammingJames Lewis
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slidesmkarlin14
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
arduino
arduinoarduino
arduinomurbz
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5Syed Mustafa
 
Intro arduino English
Intro arduino EnglishIntro arduino English
Intro arduino EnglishSOAEnsAD
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10stemplar
 
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on ScalaAndrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on ScalaScala Italy
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and batteryVitali Pekelis
 
Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3Meifani Sumadijaya
 
Open Source Robotics as Booster to Creativity
Open Source Robotics as  Booster to CreativityOpen Source Robotics as  Booster to Creativity
Open Source Robotics as Booster to CreativityCarlos J. Costa
 

Ähnlich wie Arduino2013 (20)

Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
 
Building Connected IoT Gadgets with Particle.io & Azure
Building Connected IoT Gadgets with Particle.io & AzureBuilding Connected IoT Gadgets with Particle.io & Azure
Building Connected IoT Gadgets with Particle.io & Azure
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Arduino experimenters guide ARDX
Arduino experimenters guide ARDXArduino experimenters guide ARDX
Arduino experimenters guide ARDX
 
Ardx experimenters-guide-web
Ardx experimenters-guide-webArdx experimenters-guide-web
Ardx experimenters-guide-web
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduino
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
arduino
arduinoarduino
arduino
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
Intro arduino English
Intro arduino EnglishIntro arduino English
Intro arduino English
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
 
Arduino day 2019
Arduino day 2019Arduino day 2019
Arduino day 2019
 
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on ScalaAndrea Lattuada, Gabriele Petronella - Building startups on Scala
Andrea Lattuada, Gabriele Petronella - Building startups on Scala
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
 
Porte à puce
Porte à pucePorte à puce
Porte à puce
 
Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3Porte à puce - Automatic Door based on Arduino UNO R3
Porte à puce - Automatic Door based on Arduino UNO R3
 
Porte à puce
Porte à pucePorte à puce
Porte à puce
 
Open Source Robotics as Booster to Creativity
Open Source Robotics as  Booster to CreativityOpen Source Robotics as  Booster to Creativity
Open Source Robotics as Booster to Creativity
 

Mehr von Francisco Perez

Mehr von Francisco Perez (20)

Coding tools
Coding toolsCoding tools
Coding tools
 
Analysing the Universe
Analysing the UniverseAnalysing the Universe
Analysing the Universe
 
Contaminants
ContaminantsContaminants
Contaminants
 
Docking 1
Docking 1Docking 1
Docking 1
 
Campus Ítaca UAB
Campus Ítaca UABCampus Ítaca UAB
Campus Ítaca UAB
 
Vivid library powerpoint
Vivid library powerpointVivid library powerpoint
Vivid library powerpoint
 
Multicultural theatres
Multicultural theatresMulticultural theatres
Multicultural theatres
 
D'ESO a CF 2019
D'ESO a CF 2019D'ESO a CF 2019
D'ESO a CF 2019
 
Debating in Latvia
Debating in LatviaDebating in Latvia
Debating in Latvia
 
Projecte amb institut xinès
Projecte amb institut xinèsProjecte amb institut xinès
Projecte amb institut xinès
 
Projecte Erasmus+
Projecte Erasmus+Projecte Erasmus+
Projecte Erasmus+
 
Visit Jeonbuk High School (Corea)
Visit Jeonbuk High School (Corea)Visit Jeonbuk High School (Corea)
Visit Jeonbuk High School (Corea)
 
Guia pràctica per fer un bon tr btx 20 consells
Guia pràctica per fer un bon tr btx 20 consellsGuia pràctica per fer un bon tr btx 20 consells
Guia pràctica per fer un bon tr btx 20 consells
 
Essay
EssayEssay
Essay
 
Presentation for Portugal
Presentation for PortugalPresentation for Portugal
Presentation for Portugal
 
Sant Jordi 2018
Sant Jordi 2018Sant Jordi 2018
Sant Jordi 2018
 
Ponderacions catalunya pau 2018
Ponderacions catalunya pau 2018Ponderacions catalunya pau 2018
Ponderacions catalunya pau 2018
 
Des d'ESO a CCFF 2018
Des d'ESO a CCFF 2018Des d'ESO a CCFF 2018
Des d'ESO a CCFF 2018
 
Class lists
Class listsClass lists
Class lists
 
Families are reading the world classic novels
Families are reading  the world classic novelsFamilies are reading  the world classic novels
Families are reading the world classic novels
 

Kürzlich hochgeladen

BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 

Kürzlich hochgeladen (20)

BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

Arduino2013

  • 1. Asssociation of Science Education Annual Conference , 3rd January 2013 Arduino for the classroom Dr. Francisco Pérez García Institut Pompeu Fabra ASE2013 Dr.Pérez 1
  • 2. Previous experiences: Contemporary Sciences and Research ASE2013 Dr.Pérez 2 http://www.youtube.com/watch?v=F_xkHOpMA9s
  • 6. My experience with students (Technology branch): Course 2011-2012 Year 11: 16-17 years old 4h per week Number of students: 12 Course 2012-2013 (Set 2012-Dec 2012) Year 11: 16-17 years old 4h per week Number of students: 16 (Also 2 students of year 12: 17-18 years old in their compulsory RESEARCH PROJECT) First term: programming with C Second term: simple projects with Arduino and preparing project Third term: original project with Arduino At Institut Pompeu Fabra (High School in Martorell near Barcelona, ASE2013 Dr.Pérez 6 Catalonia)
  • 7. Student blogs 2011-2012 (Catalan language and part in English) http://cricardoromani.wordpress.com http://cdanielaparicio.wordpress.com http://cjordinieto.wordpress.com http://cjosepalemany.wordpress.com http://cadrianarrebola.wordpress.com http://calexdelrincon.wordpress.com http://ccristiansegovia.wordpress.com Student blogs 2012-2013 (Only in English language) http://candreamasegosa.wordpress.com http://ckelianpordoy.wordpress.com http://civanroldan.wordpress.com http://cadriansanchez.wordpress.com http://cvictorsalvador.wordpress.com http://ccarlesdelaiglesia.wordpress.com ASE2013 Dr.Pérez 7
  • 10. WHY PROGRAMMING? • Computer science is no more about computers than astronomy is about telescopes. Edsger Dijkstra • The computer revolution hasn’t happened yet. Allan Kay • Debugging is the essence of intellectual activity. Seymour Pappert ASE2013 Dr.Pérez 10
  • 12. Tinkering, the “MacGyver” style From the “Tinkering” exhibition at the Exploratorium, San Francisco: “Tinkering is what happens when you try something you don’t quite know how to do, guided by whim, imagination, and curiosity. When you tinker, there are no instructions - but there are also no failures, no right or wrong ways of doing things. It’s about figuring out how things work and reworking them. Contraptions, machines, wildly mismatched objects working in harmony - This the stuff of tinkering.” ASE2013 Dr.Pérez 12
  • 13. This definition says a lot about the Arduino way of prototyping. Actually there is not a manual on how to do things but a reference collection of samples that people can modify and combine with other examples to learn about the logic of the programme and the board. It’s a “hands on” way of working in which even junk becomes a source for learning and building prototypes. The reuse of material from other fields is an other big knowledge and material source. Learning how to do things by looking how other things work and can be hacked. Circuit bending and patching are two key words in this learning school. ASE2013 Dr.Pérez 13
  • 14. THE HACKER ATTITUDE FOR OUR STUDENTS ASE2013 Dr.Pérez 14
  • 15. The Hacker Attitude for our students Five things taken from Eric S. Raymond’s How To Become a Hacker: 1. The world is full of fascinating problems waiting to be solved. 2. No problem should ever have to be solved twice. 3. Boredom and drudgery are evil. 4. Freedom is good. 5. Attitude is no substitute for competence. ASE2013 Dr.Pérez 15
  • 16. What is Arduino • Open Source Hardware, you can make your own board, or buy one. • Cheap, easily available. • Open Source Software. • Very widespread, many projects openly available. • Extra HW (shields) available (over 250 at http://shieldlist.com. ASE2013 Dr.Pérez 16
  • 17. ESPLORA LEONARDO ASE2013 Dr.Pérez 17
  • 18. Arduino Uno ASE2013 Dr.Pérez 18
  • 19. Arduino Language • C like syntax, but simplified • Abstracts the pin naming to numbers • Trades efficience for ease of use • Easy to learn, yet powerful • Lots of example code • Easy to reuse C-code from other projects • Libraries can be written in C++ • Lots of libraries available ASE2013 Dr.Pérez 19
  • 20. Download Arduino software at www.arduino.cc Console ASE2013 Dr.Pérez 20
  • 22. Sketch name or version Toolbar Save Open New Upload Verify Code ASE2013 Dr.Pérez 22
  • 23. Comments about the code Setup code Define variables Loop code Main code ASE2013 Dr.Pérez 23
  • 24. /*Blink Turns on an LED on for one second, then off for one second, repeatedly. Blink code is the equivalent This example code is based on exampleto a Hello world to test code that is in the public domain.*/ const int LED = 13; /* LED connected our Arduino board to digital pin 13*/ void setup() { // initialize the digital pin as an output. /*Pin 13 has an LED connected on most Arduino boards: */ pinMode(LED, OUTPUT); } void loop() { digitalWrite(LED, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(LED, LOW); // set the LED off delay(1000); // wait for a second } ASE2013 Dr.Pérez 24
  • 26. ARDUINO AND A DC MOTOR Arduino Uno DC motor Transistor IRF530 Resistor AND THIS Diode 1N4001 SOURCE CODE ASE2013 Dr.Pérez 26
  • 27. SOURCE CODE FOR ARDUINO MOTOR const int transistorPin = 9; // connected to transistor gate void setup() { pinMode(transistorPin, OUTPUT); } void loop() { // loop= repeat again and again digitalWrite(transistorPin, HIGH); // switch the motor on delay(50); // wait for 50 miliseconds digitalWrite(transistorPin, LOW); // switch the motor off delay(5000); // wait for 5 seconds } ASE2013 Dr.Pérez 27
  • 28. MOTOR TO IRRADIATE A SURFACE VERY SLOWLY ASE2013 Dr.Pérez 28
  • 32. RGB LED BLINKING ASE2013 Dr.Pérez 32
  • 33. Controlling LEDs cubes: Explosion example int Columns[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; int Rows[] = {12, 11, 10}; int t=400; void setup() /*For loop: if this conditional is true do the code inside { the curly brackets, if it’s false exists the for loop*/ int counter; for (int counter = 0; counter < 10; counter++){ pinMode(Columns[counter], OUTPUT); } for (int counter = 0; counter < 4; counter++){ pinMode(Rows[counter], OUTPUT); } } void loop() { digitalWrite(Rows[1], HIGH); digitalWrite(Columns[4], HIGH); delay(t); ASE2013 Dr.Pérez 33
  • 34. for(int i=0;i<t;i++){ if(i%2==0){ digitalWrite(Rows[0], HIGH); digitalWrite(Rows[0], LOW); digitalWrite(Rows[2], HIGH); digitalWrite(Rows[2], LOW); digitalWrite(Columns[1], HIGH); digitalWrite(Columns[1], HIGH); digitalWrite(Columns[3], HIGH); digitalWrite(Columns[3], HIGH); digitalWrite(Columns[5], HIGH); digitalWrite(Columns[5], HIGH); digitalWrite(Columns[7], HIGH); } digitalWrite(Columns[7], HIGH); else { } digitalWrite(Rows[0], LOW); else { digitalWrite(Rows[2], LOW); digitalWrite(Columns[1], LOW); digitalWrite(Columns[0], HIGH); digitalWrite(Columns[3], LOW); digitalWrite(Columns[2], HIGH); digitalWrite(Columns[5], LOW); digitalWrite(Columns[8], HIGH); digitalWrite(Columns[7], LOW); digitalWrite(Columns[6], HIGH); digitalWrite(Rows[0], HIGH); } digitalWrite(Rows[2], HIGH); delay(1); } } delay(1); digitalWrite(Rows[0], HIGH); } digitalWrite(Rows[2], HIGH); for(int j=0; j<t; j++){ delay(t); if(j%2==0){ for (int counter = 0; counter < 10; counter++){ digitalWrite(Columns[0], LOW); digitalWrite(Columns[counter], LOW); } digitalWrite(Columns[2], LOW); for (int counter = 0; counter < 4; counter++){ digitalWrite(Columns[8], LOW); digitalWrite(Rows[counter], LOW); } digitalWrite(Columns[6], LOW); ASE2013 Dr.Pérez 34 }
  • 38. Materials for LDR and LED-RGB using Arduino ● -4 resistor 220 Ω ● -1 LDR sensor ● -1 RGB LED ● -1 potenciometer ● -1 Arduino Uno ● - Wire ● - Breadboard ● - USB wire AB type or microUSB for Arduino Leonardo ASE2013 Dr.Pérez 38
  • 39. LDR ASE2013 Dr.Pérez 39
  • 40. Pulse width modulation ASE2013 Dr.Pérez 40
  • 42. Microcontroller ATMega328 Brain Sight Hearing Sensors Smell (analog inputs) Taste Touch Nerves Wires, Circuit Muscles Actuators (analog Heart outputs) ASE2013 Dr.Pérez 42
  • 43. Analog to digital conversion Analog sensor 0 to 5V Sampling at Nyquist rate Value of each sample transformed to binary format ASE2013 Dr.Pérez 43
  • 46. SOURCE CODE: RGB-LED colour change depending on light level int valueLDR = 1; /*First we define the variable name as integer and it is assigned a value*/ int ledRed = 9; int ledGreen=10; // or /*Comment*/ can be anywhere, do not affect code, help others int ledBlue=11; int pinLDR = 1; //3 outputs for each RGB colour: red, green and blue /*The setup function comes before the loop function, and everything void setup(){ happens inside the curly backets*/ pinMode(ledRed, OUTPUT); /*Outputs are declared in setup, this is done by pinMode(ledGreen, OUTPUT); usingthe pinMode function, in this particular example we declare numbers 9, 10 and 11 as pinMode(ledBlue, OUTPUT); OUTPUT (in capital letters)*/ analogReference(EXTERNAL); ASE2013 Dr.Pérez 46 }
  • 47. void loop() { The “void” in the header is what the function will return (or spit out) when it happens, in this case it returns nothing so it is void valueLDR = analogRead(pinLDR); if(valueLDR >= 1023){ digitalWrite(ledRed, 128); digitalWrite(ledGreen, 0); digitalWrite(ledBlue, 0); // digitalWrite to obtain different colours } else if((valueLDR >= 959) & (valueLDR < 1023)){ digitalWrite(ledRed, 255); digitalWrite(ledGreen, 0); digitalWrite(ledBlue, 0); ASE2013 Dr.Pérez 47 }
  • 48. else if((valueLDR >= 895) & (valueLDR < 959)){ else if((valueLDR >= 639) & (valueLDR < 703)){else if((valueLDR >= 383) & (valueLDR < 447)){ digitalWrite(ledRed, 255); digitalWrite(ledRed, 128); digitalWrite(ledRed, 0); digitalWrite(ledGreen, 128); digitalWrite(ledGreen, 128); digitalWrite(ledGreen, 128); digitalWrite(ledBlue, 0);} digitalWrite(ledBlue, 255);} digitalWrite(ledBlue, 0);} else if((valueLDR >= 831) & (valueLDR < 895)){ else if((valueLDR >= 575) & (valueLDR < 639)){else if((valueLDR >= 319) & (valueLDR < 383)){ digitalWrite(ledRed, 255); digitalWrite(ledRed, 0); digitalWrite(ledRed, 0); digitalWrite(ledGreen, 255); digitalWrite(ledGreen, 128); digitalWrite(ledGreen, 255); digitalWrite(ledBlue, 0);} digitalWrite(ledBlue, 255);} digitalWrite(ledBlue, 0);} else if((valueLDR >= 767) & (valueLDR < 831)){ else if((valueLDR >= 511) & (valueLDR < 575)){else if((valueLDR >= 255) & (valueLDR < 319)){ digitalWrite(ledRed, 255); digitalWrite(ledRed, 0); digitalWrite(ledRed, 128); digitalWrite(ledGreen, 255); digitalWrite(ledGreen, 0); digitalWrite(ledGreen, 255); digitalWrite(ledBlue, 128);} digitalWrite(ledBlue, 255);} digitalWrite(ledBlue, 0);} else if((valueLDR >= 703) & (valueLDR < 767)){ else if((valueLDR >= 447) & (valueLDR < 511)){else if((valueLDR >= 191) & (valueLDR < 255)){ digitalWrite(ledRed, 128); digitalWrite(ledRed, 0); digitalWrite(ledRed, 0); digitalWrite(ledGreen, 255); digitalWrite(ledGreen, 0); digitalWrite(ledGreen, 255); digitalWrite(ledBlue, 255); digitalWrite(ledBlue, 128); digitalWrite(ledBlue, 128); ASE2013 Dr.Pérez 48 } } }
  • 49. else if((valueLDR >= 127) & (valueLDR < 191)) else { { digitalWrite(ledRed, 128); digitalWrite(ledRed, 0); digitalWrite(ledGreen, 255); digitalWrite(ledGreen, 0); digitalWrite(ledBlue, 128);} digitalWrite(ledBlue, 0); else if((valueLDR >= 63) & (valueLDR < 127)) } { } digitalWrite(ledRed, 128); void color(int red, int green, int blue) digitalWrite(ledGreen, 128); { digitalWrite(ledBlue, 128);} analogWrite(ledRed, 255-red); else if((valueLDR >=0) & (valueLDR < 63)){ analogWrite(ledGreen, 255-green); digitalWrite(ledRed, 55); analogWrite(ledBlue, 255-blue); digitalWrite(ledGreen, 55); // PWM for every colour digitalWrite(ledBlue, 55); } ASE2013 Dr.Pérez 49
  • 52. Playing music with Arduino http://www.youtube.com/watch?v=YDL9WIVfS9w ASE2013 Dr.Pérez 52
  • 55. Spychip technology? ASE2013 Dr.Pérez 55
  • 58. SENSORS FOR ARDUINO ASE2013 Dr.Pérez 58
  • 59. Transistor: to amplify the signal of the sensor to the Arduino ASE2013 Dr.Pérez 59
  • 60. Sensors with 1kOhm resistor an NPN amplifier transistor and a 7805 regulator transitor and sensors from Sandbox Electronics, battery, LCD and Arduino Uno board ASE2013 Dr.Pérez 60
  • 61. LED RGB AS AN EMITTER AND NORMAL LED AS A SENSOR AND PROGRAM THE BRUNTON ALGORITHM TO TRANSFORM RGB EMISSION TO WAVELENGTH 350-700u ASE2013 Dr.Pérez 61
  • 62. Cloud internet of things platforms: www.cosm.com Visualize and store sensor data online www.nimbits.com ASE2013 Dr.Pérez www.thingspeak.com 62
  • 65. http://www.virtualbreadboard.net ASE2013 Dr.Pérez 65
  • 66. Approximate pricing • Arduino Leonardo €25 • Resistors, LEDs, LDR around €5 • Breadboard €10 • MQ sensors (CO, CH4, etc) €5 each • MG811 (CO2 sensor) €50 • Voice recognition shield €60 • Arduino for Android €50 Sometimes very high import taxes from China! ASE2013 Dr.Pérez 66
  • 67. Resources • www.arduino.cc • http://blocs.xtec.cat/mecanica • www.sparkfun.com • www.fritzing.org • www.buildinginternetofthings.com • www.atmel.com/avr • www.avrfreaks.net • www.mcselec.com • www.argentdata.com ASE2013 Dr.Pérez 67
  • 68. ACKNOWLEGMENTS This project on Arduino for the classroom is part of a project entitled «Contemporary Sciences and Research» given to Institut Pompeu Fabra from 2012 to 2014 and includes a book edition on Contemporary Sciences More information on Arduino and videos http://blocs.xtec.cat/mecanica More information on the whole project at http://blocs.xtec.cat/pile Book available on Nature magazine discoveries in 2012 supported by this project at http://www.formaciovirtual.com/cs ASE2013 Dr.Pérez 68