220 likes | 509 Views
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012. Physical Computing. Taking the computing off the desktop and putting it to work in the physical world Robert Kenny Educational Technology April 27, 2012.
E N D
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Physical Computing Taking the computing off the desktop and putting it to work in the physical world Robert Kenny Educational Technology April 27, 2012
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Physical Computing • The interaction of a programmable computing device with a physical phenomenon. • It is usually repetitive and reactive. • Responses to a physical input with an output can be manifested with physical action.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Physical Computing • Input and Output is a physical phenomenon converted to a form for the computing device (Process) • Conversion through sensors or transducers • Process usually a programmable medium
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Physical Computing Example: Process-monitors temp. and responds with signal at certain temperatures Output - Signal from processor turns on fan Input – Sensor detects Temp. chg T
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Physical Computing • The microcontroller is at the heart of Physical Computing • Smaller and more limited version of the microprocessor that powers desktop computer workstations. • This device is in use in cars, microwave ovens, cell phones, and even in their digital watches.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Physical Computing • Microcontrollers are programmed with a simplified version of common programming languages • Include the elements of basic input and output commands, decision making statements, certain control statements and syntax, and other commands based on the features of the unique microcontroller.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Sample Code /* DigitalReadSerial Reads a digital input on pin 2, prints the result to the serial monitor This example code is in the public domain. */void setup() { Serial.begin(9600); pinMode(2, INPUT);}void loop() { int sensorValue = digitalRead(2); Serial.println(sensorValue, DEC);}
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 The Arduino Board • The Arduino board, is only one of several Physical Computing application modules on the market. • It uses an Amtel microcontroller chip on board and an open source software based on “Process” and other open source software to program it.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Arduino Board Microcontroller chip • Communicates with other computers through a USB/serial port. • It can have its program uploaded through this port • Gets power through the USB port or through a Power-In jack. • See below for the specifications for the Arduino. Input/Output Connections USB Port Input/Output Connections Power in Serial Comm. Chip
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 The following links demonstrate Physical Computing using the Arduino board: Demo Video 1: http://www.youtube.com/watch?v=n92t_RjQEGg Demo Video 2:http://www.youtube.com/watch?v=b31GcBtN13U Demo Video 3:http://www.youtube.com/watch?v=48l6o0IevWQ Also see the following links for some more applications of Physical Computing: http://www.youtube.com/watch?v=mFAsc1DcoFE http://www.youtube.com/watch?v=xFEkx0gxcws
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Specifications • Microcontroller: ATmega328 • Operating Voltage: 5V • Input Voltage (recommended): 7-12V • Input Voltage (limits): 6-20V • Digital I/O Pins: 14 (of which 6 provide PWM output) • Analog Input Pins: 6 • DC Current per I/O Pin: 40 mA • DC Current for 3.3V Pin:50 mA • Flash Memory:32 KB (ATmega328) of which 0.5 KB used by bootloader
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Code for the Temperature Change Detect Project: #define ledB 8 //the pin for the Blue led #define ledW 7 //the pin for the White led #define ledR 4 //the pin for the Red led int tempVin = 0; //initialize variable tempVin as determined by the thermistor void setup() { pinMode (ledB, OUTPUT); // set ledB as an output pinMode (ledW, OUTPUT); // set ledW as an output pinMode (ledR, OUTPUT); // set ledR as an output } void loop() { tempVin = analogRead(0); //read the input voltage value from themistor //if the temp value "hot", then turn on red led while (tempVin >=600){ digitalWrite(ledW,LOW); //turn off white led digitalWrite(ledR, HIGH); //turn on red led delay (500); tempVin = analogRead(0); } //if temp value is “cold”, turn on blue led while (tempVin <= 500) { digitalWrite(ledW,LOW); //turn off white led digitalWrite(ledB, HIGH); //turn on the Blue led delay (500); tempVin = analogRead(0); } //if temp value is room temp, turn on white led { digitalWrite(ledW, HIGH); //turn on the white led digitalWrite(ledR,LOW); digitalWrite(ledB,LOW); delay (500); } } Note: Comments are preceded by “//”. Some comments follow their code statement.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Code for the Light Brightness Detect Project: //initialize variable from light sensor intlightVin = 0; //initialize variable for output to buzzer intsoundVout = 0; //initialize variable for output to buzzer //set pin 9 on Arduino output connection to OUTPUT void setup(){ pinMode(9,OUTPUT); } void loop(){ //input from light sensor lightVin = analogRead(0); //buzzer sound is a ratio of the light signal in soundVout =255-(lightVin/4); //send signal to buzzer analogWrite(9,soundVout); } Note: Comments are preceded by “//”.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Educational Context • Computer technology and critical thinking skills have been cited as being a major focus for education. • In recent surveys, US secondary schools have fallen into the middle of the pack of industrial nations in science and math performance. • Technology and engineering use these skills (science, math, and critical thinking), therefore the sharper focus is on increasing them. • The STEM (Science, Technology, Engineering, and Mathematics) initiative is advocating new policies in education.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Educational Context • Other fields, including the non-technical fields of design and architecture will also need more of these skills to compete. • Learning about Physical Computing will contribute to this effort. It is already taught in some institutions of higher learning in the art and design schools. • Could be a nice complementary study in both Technology Education and the Arts in the high school levels as well.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 References O’Sullivan, D., Igoe, T. 2004. Physical Computing: Sensing and Controlling the Physical World with Computers, Boston, MA: Thomson. President’s Council of Advisors on Science and Technology (2010).Report to the President: Prepare and Inspire: K-12 education in science, technology, engineering, and math (stem) for America’s future. Retrieved from http://www.whitehouse.gov/sites/default/files/microsites/ostp/pcast-stemed-report.pdf McMahon, G. (2009). Critical Thinking and ICT Integration in a Western Australian Secondary School. Educational Technology & Society, 12 (4), 269–281.