Teacher's Guide to Intel Galileo - Intel Innovation Toolbox

0 downloads 227 Views 11MB Size Report
Running Python programs. ... Creating the Python Web Server . .... Science involves testing predictions by gathering dat
This self-help guide has been developed to provide support in introducing the Intel® Galileo Gen 2 development board into the classroom for learning and teaching.

A Teacher’s Guide to the Intel® GALILEO

MacICT

Macquarie ICT Innovations Centre



A TEACHER’S GUIDE TO THE INTEL® GALILEO

“A Teacher’s Guide To The Intel® Galileo” 2014 This guide is licensed under Creative Commons

Attribution-NonCommercial-NoDerivs You are free to:

Share — copy and redistribute the material in any medium or format The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Macquarie ICT Innovations Centre (MacICT) Building C5B, Macquarie University North Ryde, NSW, 2109 (02) 9850 4310 www.macict.edu.au Authors Sarah Boyd John Burfoot Daniel Green Cathie Howe

CONTENTS INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Why use it as a teacher?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Linking to the Australian Curriculum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Learning Area: Science . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Learning Area: Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Learning Area: Technologies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Learning Area: English. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Learning Area: The Arts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6 2 2 2 3 3 5 5

PEDAGOGICAL APPROACHES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Inquiry-Based Learning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The 5E Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Project Based Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Design Based Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Design Thinking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6 6 7 7 7

GETTING STARTED. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 What is the Galileo? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What is a development board? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What is Arduino? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8 8 8

SETTING UP YOUR INTEL® GALILEO GEN 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Getting to know the Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Installing the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Connecting the Board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Installing the drivers and other software . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Launching the Arduino IDE application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Updating your board firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Opening your first sketch: the blink example . . . . . . . . . . . . . . . . . . . . . . . . . 14 Select your board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Select your serial port. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Uploading the program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Booting from a MicroSD image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Which SD Card?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Formatting your SD Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Booting from your SD Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

BEGINNING WITH ARDUINO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Basic Electric Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 The Blink Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Explanation of the Arduino Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Visual Programming with Ardublock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 What is ArduBlock? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Installing ArduBlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Blink with Ardublock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Button with Ardublock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Building a Skill Tester: using multiple LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Hardware construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33



A TEACHER’S GUIDE TO THE INTEL® GALILEO

Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Coding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Building a night light: using a photocell and LED . . . . . . . . . . . . . . . . . . . . . . . 38 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Hardware construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Coding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

USING THE GALILEO AS A COMPUTER. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Communicating with the Galileo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Connecting via Serial. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Linux and the Galileo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Creating a program in Linux using vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Connecting via Ethernet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Connecting via SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Built in function len . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Modules in python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Running Python programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Indentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Javascript and Node.js on the Galileo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Coding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Node.js Resources: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Displaying temperature > function functionOne() { alert('You clicked the top text'); } function functionTwo() { alert('You clicked the bottom text'); }