Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mom presentation_monday_arduino in the physics lab

50 views

Published on

Arduino coupled with low cost sensors is an incredible opportunity to mix electronic with Physics and to implement field data collection, IBSE and Home Labs (the other face of fliped classrooms)

Published in: Education
  • Be the first to comment

  • Be the first to like this

Mom presentation_monday_arduino in the physics lab

  1. 1. www.mattersofmatter.eu Arduino & low cost sensors Arduino in the Physics Lab This project has received funding from the European Union's Erasmus + Programme for Education under KA2 grant 2014-1-IT02-KA201-003604. The European Commission support for the production of these didactical materials does not constitute an endorsement of the contents which reflects the views only of the authors, and the Commission cannot be held responsible for any use which may be made of the information contained therein. All MoM materials, this document included, belong to MoM-Matters of Matter authors and are distributed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License as OER Open Educational Resources. www.mattersofmatter.eu . Funded by EU under the Erasmus+ KA2 grant N° 2014-1-IT02-KA201-003604_1.
  2. 2. www.mattersofmatter.eu Arduino & low cost sensors What is Arduino? www.arduino.cc Arduino is an open source physical computing platform based on a simple input/output (I/O) board
  3. 3. www.mattersofmatter.eu Arduino & low cost sensors Getting Started with Arduino Interactive Device The interactive device is an electronic circuit that • is able to sense the environment using sensors • processes the information from the sensors with software (code) • will then be able to interact with the environment using actuators
  4. 4. www.mattersofmatter.eu Arduino & low cost sensors SENSORS ACTUATORS Light or infrared sensors Light sources (LED, LED RGB) • servomotor Environment sensors (humidity temperature and atmospheric pressure) Infrared and laser sources Sound sensors Sound generators (buzzer) Motion sensors Motion generators (servomotor) Magnetic field sensors Gas sensors
  5. 5. www.mattersofmatter.eu Arduino & low cost sensors Software programs, called sketches, are created on a computer using the Arduino integrated development environment (IDE). (free ) Arduino Software IDE main window
  6. 6. www.mattersofmatter.eu Arduino & low cost sensors Structure of any Arduino code 1. Define Variables 2. Setting up functions 3. Eternal loop void setup() {} void loop() {} Setup function is run once, when the microcontroller boots up or resets. After setup function the processor moves on to run code inside the loop function. Code inside loop function will be run over and over until the microcontroller is shut down. int pin = 1; Before going to the setup function constant variables should be defined • It’s required to have both setup() and loop() functions in the code
  7. 7. www.mattersofmatter.eu Arduino & low cost sensors Breadboard Layout
  8. 8. www.mattersofmatter.eu Arduino & low cost sensors Blink a LED There are a lot of different LEDs available on the market. Different LED characteristics include • colors light / radiation wavelength, • light intensity, • a variety of other LED characteristics. LED voltage drops Typically the LED voltage drop is between around 2 and 4 volts. Voltage drop (V) RED 1,6 YELLOW 2,2 GREEN 2,4 WHITE (warm) 3,0 WHITE (cold) 3,5
  9. 9. www.mattersofmatter.eu Arduino & low cost sensors LEDs and Resistors LED needs a current limiting resistor Current for Light Emitting Diodes = 10/15mA R = (V -VLED ) I R=220 Ω (a good and practical compromise) http://www.instructables.com/id/Choosing-The-Resistor-To-Use-With-LEDs/
  10. 10. www.mattersofmatter.eu Arduino & low cost sensors ATTENTION! PIN13 On pin 13, a resistance of 1 K Ohm is already integrated in the board, so no additional resistance is required
  11. 11. www.mattersofmatter.eu Arduino & low cost sensors In order to determine the resistance of a colour coded resistor it is necessary to know the number that corresponds to the various colours. This information is obtained from a Resistor Colour Code Chart.
  12. 12. www.mattersofmatter.eu Arduino & low cost sensors A simple exercise…. On the desk there are some resistors a. Using Colour Coded Resistor chart calculate the corresponding value in Ohm b. Then check with the multimeter that the calculated value is correct. N.B. Short review of multiples and sub - multiples of the powers of 10
  13. 13. www.mattersofmatter.eu Arduino & low cost sensors Example 1 - Blinking led You need • Breadboard • Led • Resistor (220 ohm) • Arduino • Wires
  14. 14. www.mattersofmatter.eu Arduino & low cost sensors int ledPin = 9; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); delay(1000); } Writing your first program: Basic blinking LED
  15. 15. www.mattersofmatter.eu Arduino & low cost sensors int ledPin = 13; //Variable to store the pin number void setup() { pinMode(ledPin, OUTPUT); //set ledPin as output } void loop() { digitalWrite(ledPin, HIGH); //LED ON delay(1000); //Wait 1000ms (=1s) digitalWrite(ledPin, LOW); //LED OFF delay(1000); //Wait 1000ms (=1s) } Writing your first program: Basic blinking LED •Code is case sensitive •Statements are commands and must end with a semi-colon •Comments follow a // or begin with /* and end with */ You may change the blinking time
  16. 16. www.mattersofmatter.eu Arduino & low cost sensors Uploading the program 1. Click Verify The code is checked for syntax errors 2. Click Upload The program is uploaded to the Arduino mCu board
  17. 17. www.mattersofmatter.eu Arduino & low cost sensors The Traffic Light Controller • Red, yellow and green LEDs. • A breadboard. • 3 x 220 Ω resistors. • Connecting wires. You need You could modify the previous blinking sketch
  18. 18. www.mattersofmatter.eu Arduino & low cost sensors int Green=9; //inizializziamo le variabili int Yellow=11; //assegnando i tre pin alle porte digitali da 9 a 11 int Red=13; int Pausa = 6000; // variabile intera corrispondente a 1000 in delay stop per 1 sec void setup(){ //definisco tutti i pin in modalità output-lo faccio una volta sola all'inizio pinMode (Green,OUTPUT); pinMode (Yellow,OUTPUT); pinMode (Red,OUTPUT); } void loop() { // da qui tutto si ripete all'infinito accende e poi spegne sequenzialmente i tre led digitalWrite(Red, HIGH);// attiviamo il primo pin high=acceso delay (Pausa); //pausa di 6000 ms cioè 6 s digitalWrite(Red, LOW);// disattiviamo il primo pin low=spento digitalWrite(Green, HIGH);// ora ripetiamo con il secondo pin delay (Pausa); digitalWrite(Yellow, HIGH);// attiviamo il primo pin high=acceso delay (2000); //pausa di 2000 ms cioè 2 s digitalWrite(Green, LOW); digitalWrite(Yellow, LOW); } The Traffic Light Controller
  19. 19. www.mattersofmatter.eu Arduino & low cost sensors LDR: Light Dependent Resistor (Photoresistor) It’s an analog sensor It needs a 10kΩ resistor, to limit the current The variable resistance range will be∞ • 0Ω (when the light intensity is maximum) • ∞ (when the light intensity is minimum)
  20. 20. www.mattersofmatter.eu Arduino & low cost sensors LDR _ the sketch const int SegnalePin = A0; //pin a cui si collega il "segnale" const int Pausa = 200; //valore della pausa tra 2 successive misurazioni int Segnale = -1; //dichiarazione della variabile e inizializzazione //ad un valore di controllo (impossibile da ottenere //nella misura: se si ottiene in output è indice di errore) void setup(){ Serial.begin(9600); //Inizializzazione monitor seriale } void loop(){ Segnale = analogRead(SegnalePin); //Lettura del Segnale Serial.println(Segnale); //Stampa su monitor seriale: delay(Pausa); } Results (in V) are printed in serial monitor !!!Control that this number is equal to the number at bottom right in the serial monitor window
  21. 21. www.mattersofmatter.eu Arduino & low cost sensors Sensor + Actuator: LDR+LED We will turn on a LED when the illumination value falls below a fixed level IF/ELSE The if statement executes a command/statement if a specified condition is true. If the condition is false, another command/statement can be executed. if (pinFiveInput < 500) { // action A } else { // action B }
  22. 22. www.mattersofmatter.eu Arduino & low cost sensors const int SegnalePin = A0; //pin a cui si collega il "segnale" const int LedPin = 8; //pin a cui collegare il LED const int Soglia = 400; //valore di riferimento di soglia: //DEVE ESSERE CALIBRATO SULLA SPECIFICA SITUAZIONE // se necessario sostituite 400 con il valore da voi ottenuto const int Pausa = 200; //valore della pausa tra 2 successive misurazioni int Segnale = -1; //dichiarazione della variabile e inizializzazione //ad un valore di controllo (impossibile da ottenere //nella misura: se si ottiene in output è indice di errore) void setup(){ Serial.begin(115200); //Inizializzazione monitor seriale pinMode(LedPin, OUTPUT); //Dichiarazione del pin a cui è collegato il LED come Output: } void loop(){ //Lettura del Segnale: Segnale = analogRead(SegnalePin); //Stampa su monitor seriale: Serial.println(Segnale); //Uso come ATTUATORE: da "scommentare" se utilizzato if(Segnale < Soglia){ digitalWrite(LedPin, HIGH); } else { digitalWrite(LedPin, LOW); } delay(Pausa); }
  23. 23. www.mattersofmatter.eu Arduino & low cost sensors Light intensity vs distance Light source=smartphone flash LDR Activity • change the distance between source and LDR • read serial monitor • plot ddp vs distance This activity couldbe used to test Lambert Law Iµ 1 r2
  24. 24. www.mattersofmatter.eu Arduino & low cost sensors Our students have done this experiment and these are their results
  25. 25. www.mattersofmatter.eu Arduino & low cost sensors Thermistor 10K: thermal resistor In thermistors the resistance drastically changes with temperature (change of 100 ohms or even more per degree!) There are two kinds of thermistors: • NTC (negative temperature coefficient) • used for temperature measurement • PTC (positive temperature coefficient). • used as resettable fuses
  26. 26. www.mattersofmatter.eu Arduino & low cost sensors THERMISTORS HAVE SOME ADVANTAGES OVER OTHER KINDS OF TEMPERATURE SENSORS: • First they are much cheaper than any other one 0,80 Euro • They are also much easier to waterproof since its just a resistor. • They work at any voltage (digital sensors require 3 or 5V logic). • Compared to a thermocouple, they don't require an amplifier to read the minute voltages - you can use any microcontroller to read a thermistor. • They can also be incredibly accurate for their price. (Assuming you have an accurate enough analogue converter) • They are difficult to break or damage Thermistor 10K: thermal resistor
  27. 27. www.mattersofmatter.eu Arduino & low cost sensors Thermistor 10K: thermal resistor THE FIRST SKETCH: termistore 10k normale // the value of the 'other' resistor #define SERIESRESISTOR 10000 // What pin to connect the sensor to #define THERMISTORPIN A0 void setup(void) { Serial.begin(9600); } void loop(void) { float reading; reading = analogRead(THERMISTORPIN); Serial.print("Analog reading"); Serial.println(reading); // convert the value to resistance reading = (1023 / reading) - 1; reading = SERIESRESISTOR / reading; Serial.print("Thermistor resistance"); Serial.println(reading); delay(1000); }
  28. 28. www.mattersofmatter.eu Arduino & low cost sensors When doing analog readings, especially with a 'noisy' board like Arduino, we suggest two tricks to improve results: A) use the 3.3V voltage pin as an analog reference; B) take a bunch of readings in a row and average them. Thermistor_aref2.ino Finally, of course, we want to have the temperature reading, not just a resistance! • you can simply use the temperature/resistance table (calibration) • you probably want actual temperature values. to do that we’ll use the Steinhart-Hart Law
  29. 29. www.mattersofmatter.eu Arduino & low cost sensors Wrapping up …
  30. 30. Home Labs con Arduino # I laboratori capovolti: l’altra faccia delle ‘flipped classrooms’ Workshop 5 Maggio 2017- School Makers Day - Bologna www.mattersofmatter.eu
  31. 31. Tool calibration..no black boxes! Different thermometers calibration (intervention is possible through code,averaging) Range, Sensitivity, Precision  understanding tools limits and potentialities
  32. 32. www.mattersofmatter.eu Arduino & low cost sensors Home labs • More time available for exploration • Personalized learning own pace curiosity/inquiry • Inquiry Based Learning • Discussion- make room for analysis & debate at school • Interdisciplinariety • Citizen Science Arduino • Low Cost • Portable- field trips • Build your own tools: no black box • Community all over the world • Prototyping, immediate testing • Coding/ Physical computing • Wide applicability outside school
  33. 33. www.mattersofmatter.eu Arduino & low cost sensors Photoluminescence Malus Law • Red LED + LDR • LDR
  34. 34. www.mattersofmatter.eu Arduino & low cost sensors Light intensity Temperature IR -Temp Solar Radiation Control windows film Solar ovens & water pastorization Cool roofs & cool pavements Best thermal vector fluid Salt solutions Indoor photovoltaics Tea with milk: thermal gradient & cooling rate Sustainability ….
  35. 35. www.mattersofmatter.eu Arduino & low cost sensors Sea-side Fridge
  36. 36. www.mattersofmatter.eu Arduino & low cost sensors 1 Calibrazione e confronto di vari sensori Calibrare un sensore Riflettere sul funzionamento dei diversi termometri Valutare i sensori migliori da usare con arduino Termometri, temperatura, equilibrio termico CURVE DI RISCALDAMENTO /RAFFREDDAMENTO 2 Calibrazione del circuito stampato sudafrica Rinforzo – nuove tecnologie 3 homelab Te al latte homelab Il maglione della nonna Il telino da primo soccorso Pollo in rosticceria Materiali isolanti – conduzione convezione, irraggiamento Frigorifero a sabbia Forni solari e frighi lunari! Conduzione, convzione, irraggiamento, equaziione fondamentale calorimetria homelab Apertura frigorifero Cool roofs Pellicole solari per finestre e per macchine Effetto serra,spettro elettromagnetico Materiali isolanti homelab Ecopiatto Curve di raffreddamento, conduzione Miglior fluido vettore Curve riscaldamento/raffreddamento Calore specifico capacità termica PV cells rendimento e temperatura Lampadine a risparmio energetico e dissipazione sotto forma di calore Equazione fondamentale calorimetria homelab Il calore assorbito dai diversi colori Assorbimento, emissività See file docx «Proposte di lavoro con sensori di temperatura»
  37. 37. www.mattersofmatter.eu Arduino & low cost sensors https://computers.tutsplus.com/tutorials/how-to-use-a-breadboard-and-build-a-led-circuit--mac-54746 https://sielearning.tafensw.edu.au/toolboxes/Electrotechnology/toolbox/hq/mag1/restrain.htm http://www.makeuseof.com/tag/arduino-traffic-light-controller/ https://learn.adafruit.com/thermistor References

×