├── CONTRIBUTING.md ├── LICENCE.md ├── README.md ├── code └── robot1.py ├── cover.png ├── extras.md ├── hardware.yml ├── images ├── idle3.png └── temp.md ├── ks2.md ├── ks3.md ├── learn.md ├── lesson-1 ├── images │ └── idle3.png ├── lesson.md └── worksheet.md ├── lesson-2 ├── images │ ├── idle3.png │ ├── program-1.png │ ├── program-2.png │ └── program-3.png └── lesson.md ├── lesson-3 ├── images │ ├── audio_output.png │ ├── espeak1.png │ └── espeak2.png └── lesson.md ├── meta.yml ├── overview.md ├── software.md ├── software.yml └── teacher-instructions.md /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | All contributions are assumed to be licensed under the same license as the source, i.e. CC BY-SA. This license must remain in all derivatives of this work. 4 | 5 | ## Issues 6 | 7 | If you find a mistake, bug or other problem, please [open an issue](https://github.com/raspberrypilearning/turing-test-lessons/issues) in this repository. 8 | 9 | ## Pull Requests 10 | 11 | If you fix a mistake, bug or problem or have something to contribute, please create a pull request for each modification. Please consider grouping modifications sensibly, i.e. don't bundle typo fixes in the same pull request as code changes, instead file them separately. 12 | 13 | Please note that sometimes things are done for pedagogical reasons so changes which make sense from a software engineering perspective (reducing duplication or making use of more advanced programming language features) may not be suitable to maintain the intended educational value. 14 | 15 | ## Derivatives 16 | 17 | The licence must remain in all derivatives of this work. 18 | 19 | ## Licence 20 | 21 | Unless otherwise specified, everything in this repository is covered by the following licence: 22 | 23 | ![Creative Commons License](http://i.creativecommons.org/l/by-sa/4.0/88x31.png) 24 | 25 | ***Turing Test Lessons*** by the [Raspberry Pi Foundation](http://raspberrypi.org) is licenced under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). 26 | 27 | Based on a work at https://github.com/raspberrypilearning/turing-test-lessons 28 | -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | # Licence 2 | 3 | Unless otherwise specified, everything in this repository is covered by the following licence: 4 | 5 | ![Creative Commons License](http://i.creativecommons.org/l/by-sa/4.0/88x31.png) 6 | 7 | ***Turing Test Lessons*** by the [Raspberry Pi Foundation](http://raspberrypi.org) is licenced under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). 8 | 9 | Based on a work at https://github.com/raspberrypilearning/turing-test-lessons 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **This is an archived resource.** The repo will remain available but the resource will no longer be maintained or updated. Some or all parts of the resource may no longer work. To see our latest resources, please visit [raspberrypi.org](http://www.raspberrypi.org). 2 | 3 | # The Turing Test 4 | 5 | ![](cover.png) 6 | 7 | This scheme of work has been designed as an introduction to text-based programming using Python on the Raspberry Pi. By the end of all the lessons, students will have created an interactive chat bot and been introduced to the computer science concept of artificial intelligence. 8 | 9 | This scheme of work is specifically targeted towards introductory KS2 Computing, although these lessons could be used as a wider scheme of work at KS3. This has been developed in harmony with the new Computing curriculum in the UK. 10 | 11 | ##Learning outcomes: 12 | 13 | Over the course of three lessons, students will learn: 14 | 15 | - What a Raspberry Pi is, what its main features are, and how to set up and use one. 16 | - How to program a Raspberry Pi to act as a chat robot. 17 | - What is meant by artificial intelligence, in particular relating to the Turing test. 18 | - The following computer science concepts: 19 | - Sequencing 20 | - Debugging 21 | - User input 22 | - Print statements 23 | 24 | 25 | ##Computing Programme of Study Met 26 | 27 | ###KS2: 28 | 29 | - Design, write and debug programs that accomplish specific goals; solve problems by breaking them into smaller parts. Select, use and combine a variety of software on a range of digital devices to design and create a range of programs. 30 | - Use sequence, selection and repetition in programs; work with variables and various forms of input and output 31 | - Use logical reasoning to explain how some simple algorithms work; detect and correct errors in algorithms and programs 32 | 33 | ###KS3: 34 | 35 | - Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems. 36 | 37 | [National Curriculum Computing Programmes of Study](https://www.gov.uk/government/publications/national-curriculum-in-england-computing-programmes-of-study/national-curriculum-in-england-computing-programmes-of-study#key-stage-3) 38 | 39 | ##Resources 40 | 41 | For the majority of the lesson, it is suggested that work is carried out by students on a Raspberry Pi each or in pairs. Each student or pair should have access to the standard equipment described below: 42 | 43 | - A Raspberry Pi per pair 44 | - The latest NOOBS SD card with Raspbian installed per pair 45 | - 'espeak' downloaded and installed on each SD card 46 | - A keyboard and mouse connected to the Raspberry Pi per pair 47 | - A monitor connected to the Raspberry Pi per pair 48 | - A headphone splitter connected to the Raspberry Pi audio jack per pair (from lesson 3 onwards) 49 | - A pair of headphones connected to the splitter per student (from lesson 3 onwards) 50 | 51 | *Note: These lessons will use Python 3*. 52 | 53 | See the [teacher setup instructions](teacher-instructions.md) for more information. 54 | 55 | ##Lessons 56 | 57 | - [Lesson 1: How do Computers Think?](lesson-1/plan.md) 58 | - [Lesson 2: Can Computers Think for Themselves?](lesson-2/plan.md) 59 | - [Lesson 3: Make a Chatting Robot](lesson-3/plan.md) 60 | 61 | ## Licence 62 | 63 | Unless otherwise specified, everything in this repository is covered by the following licence: 64 | 65 | ![Creative Commons License](http://i.creativecommons.org/l/by-sa/4.0/88x31.png) 66 | 67 | ***Turing Test Lessons*** by the [Raspberry Pi Foundation](http://raspberrypi.org) is licenced under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). 68 | 69 | Based on a work at https://github.com/raspberrypilearning/turing-test-lessons 70 | -------------------------------------------------------------------------------- /code/robot1.py: -------------------------------------------------------------------------------- 1 | # My Python Program by ... 2 | import os, time 3 | 4 | def robot(text): 5 | os.system("espeak '" + text + "'") 6 | 7 | robot("Hello") 8 | 9 | time.sleep(1) 10 | 11 | robot('What is your name') 12 | name = input('What is your name: ') 13 | robot("Nice to meet you " + name) 14 | 15 | time.sleep(1) 16 | 17 | robot("How old are you") 18 | age = input('How old are you: ') 19 | robot("You do not look like you are aged " + age) 20 | 21 | -------------------------------------------------------------------------------- /cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/cover.png -------------------------------------------------------------------------------- /extras.md: -------------------------------------------------------------------------------- 1 | - A headphone splitter connected to the Raspberry Pi audio jack per pair (from lesson 3 onwards) 2 | - A pair of headphones connected to the splitter per student (from lesson 3 onwards) 3 | -------------------------------------------------------------------------------- /hardware.yml: -------------------------------------------------------------------------------- 1 | - name: Headphones or a speaker 2 | img: headphones-speaker 3 | -------------------------------------------------------------------------------- /images/idle3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/images/idle3.png -------------------------------------------------------------------------------- /images/temp.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ks2.md: -------------------------------------------------------------------------------- 1 | - Design, write, and debug programs that accomplish specific goals; solve problems by breaking them into smaller parts. Select, use, and combine a variety of software on a range of digital devices to design and create a range of programs. 2 | - Use sequence, selection, and repetition in programs; work with variables and various forms of input and output 3 | - Use logical reasoning to explain how some simple algorithms work; detect and correct errors in algorithms and programs 4 | -------------------------------------------------------------------------------- /ks3.md: -------------------------------------------------------------------------------- 1 | Partially meets: 2 | - Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems. 3 | -------------------------------------------------------------------------------- /learn.md: -------------------------------------------------------------------------------- 1 | Through this scheme of work, students will learn: 2 | 3 | - What a Raspberry Pi is, what its main features are, and how to set up and use one. 4 | - How to program a Raspberry Pi to act as a chat robot. 5 | - What is meant by artificial intelligence, in particular relating to the Turing test. 6 | - The following computer science concepts: 7 | - Sequencing 8 | - Debugging 9 | - User input 10 | - Print statements 11 | 12 | This resource covers elements from the following strands of the [Raspberry Pi Digital Making Curriculum](https://www.raspberrypi.org/curriculum/): 13 | 14 | - [Use basic programming constructs to create simple programs](https://www.raspberrypi.org/curriculum/programming/creator) 15 | -------------------------------------------------------------------------------- /lesson-1/images/idle3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-1/images/idle3.png -------------------------------------------------------------------------------- /lesson-1/lesson.md: -------------------------------------------------------------------------------- 1 | # Lesson 1 - How Do Computers Think? 2 | 3 | ##Introduction 4 | 5 | How do computers think? In this lesson, students will consider how computers and robots need to follow a sequence of instructions to complete a task. Much of this lesson is dedicated to getting students using a Raspberry Pi for the first time, logging in, accessing Python 3 or IDLE3, and typing a small sequence of instructions to make a shape. 6 | 7 | ## Learning objectives 8 | 9 | - Know that computers follow a sequence of instructions to make something happen. 10 | - Be able to set up a Raspberry Pi, and give a set of instructions in Python to make a shape. 11 | 12 | 13 | ## Learning outcomes 14 | 15 | ###All students are able to: 16 | 17 | - Know that computers run programs that are a sequence of instructions to make something happen. 18 | - Write a simple program. 19 | 20 | ###Most students are able to: 21 | 22 | - Know that Python is a computer programming language. 23 | - Write a simple Python program and explain the sequence it is following. 24 | 25 | ###Some students are able to: 26 | 27 | - Write a program to create a more complex shape. 28 | 29 | 30 | ## Lesson summary 31 | 32 | - An introduction to the basic physical parts of a Raspberry Pi 33 | - A demonstration that the Raspberry Pi can behave like a traditional computer 34 | - The first Python program 35 | 36 | ## Starter 37 | 38 | First, nominate three or four students to act as robots, then divide the remaining students into three or four teams. Each team are in a race to see who can get a 'robot' around the classroom or 'maze'. Note that this could be an outdoor task. Explain to the 'robots' that they are to play dumb and only follow the instructions they are given. Then, begin the race. 39 | 40 | Throughout the race, ensure that students are using instructions like "step forward 10 paces" or "turn 90 degrees to the right". 41 | 42 | After the race has been won, discuss any problems the teams encountered getting their robot to follow their instructions. Draw out through questioning that the robot could not make decisions for itself, and so the students had to be very specific about turns and steps. 43 | 44 | Explain that a computer works by executing statements one after another in a specific order. A given order of statements is called a **program**. Each program executes with a given **control flow**; this describes which statement we are executing, and what the next statement will be. 45 | 46 | ## Main development 47 | 48 | 1. Have a demonstration Raspberry Pi already connected and the final chatting robot program running. Hold up a Raspberry Pi board and ask the students what they think it is. Explain that it’s actually a computer and that in the coming lessons we’re going to do something special with it. Instead of running apps and games other people have created for us, we’re going to learn to write our own software to make a robot that chats to us. 49 | 50 | 2. Start with all the parts of the Raspberry Pi on a table: keyboard, mouse, speaker, memory card, power supply, monitor, monitor cable and the Raspberry Pi itself. Ask the class to name and describe each component as you connect it to the Raspberry Pi in front of the class. Finally, plug in the power and watch it boot up. An alternative demonstration would be to leave out the memory card and attempt to boot the Pi, which will fail. You can then describe the memory card as something that contains instructions to tell the Raspberry Pi how to start. The Raspberry Pis should all be booted and sitting on the login prompt waiting for authentication. 51 | 52 | 2. Ask students to set up their Raspberry Pi equipment, turn it on and log into their Pi using the username `pi` and the password `raspberry`. 53 | 54 | **Note that students will not see any text when typing the password but assure them it is working. Why do they think this might be the case? Hint: what might happen if someone was looking over their shoulder?** 55 | 56 | 3. Next, students should load the graphical environment by typing `startx`. Once the desktop has loaded, show students how to open **Python 3** or **IDLE3** by clicking on the **Main Menu** followed by **Programming** and selecting **Python 3**. 57 | 58 | **Note that this series of lessons uses Python 3. If students run IDLE then their code may not run.** 59 | 60 | 4. Explain to students that **Python 3** or **IDLE3** is an application or environment that allows you to write a simple program using the programming language **Python**. It allows you to write, edit and run code. 61 | 62 | 5. Show students how to draw a shape by typing a sequence of instructions, line by line. See the [Student Worksheet](worksheet.md) for the steps required to complete this task. 63 | 64 | 6. Ask students to shut down their Raspberry Pis by clicking on the **Shut Down** icon on the desktop. 65 | 66 | ## Plenary 67 | 68 | Write the following list of words on the board: 69 | 70 | - Instructions 71 | - Sequence 72 | - Raspberry Pi 73 | - Python 74 | - IDLE3 75 | 76 | Select a student randomly from the class. They must select one of the words from the board, stand up and point to someone else in the class who must then give the meaning of the word. That person then chooses the next person to give a word to. 77 | 78 | ## Homework 79 | 80 | Students should write a sequence of instructions for a task, such as getting dressed for school or their favourite dance moves. 81 | 82 | -------------------------------------------------------------------------------- /lesson-1/worksheet.md: -------------------------------------------------------------------------------- 1 | # Lesson 1 - How do Computers Think? 2 | 3 | ## Connecting your Raspberry Pi 4 | 5 | The Raspberry Pi is a bare bones computer. It’s not much use on its own. In order to program sounds with it, we need to connect a number of things to it: 6 | 7 | - **An SD card**. This card contains the programs that can be loaded onto the Raspberry Pi in order for it to do things. You need to slide the card into the slot with the metal pins facing in towards the Raspberry Pi. The label should be visible when it is inserted. 8 | - **A keyboard**. Plug the keyboard into one of the USB ports. USB stands for Universal Serial Bus. It’s a kind of connector for all sorts of devices. The keyboard will be the main tool we will use to communicate our programs to the Raspberry Pi. 9 | - **A mouse**. Plug the mouse into one of the other USB ports. 10 | - **A sound splitter**. This is a cable that will split the audio signal two ways. Plug this into the 11 | audio jack on the Raspberry Pi. 12 | - **Headphones**. These will allow you to hear the sound you will produce. Plug these into the sound splitter. 13 | - **A monitor**. This will allow you to see the program you’re currently creating. Plug the HDMI connector into the Raspberry Pi’s HDMI port. Plug the other end of the HDMI cable into your monitor. You’ll want to make sure you have power to the monitor, that it’s switched on and that it’s set to view what comes in on the HDMI cable (typically the digital option). 14 | - **A power adaptor**. Plug the power adaptor into a socket and then the small USB connector into the Raspberry Pi. When you turn the socket switch on, you should see the Raspberry Pi flash and text should appear on the monitor. 15 | 16 | ## Logging In 17 | 18 | 1. Once the Raspberry Pi has completed booting and the text has stopped whirring past on the screen, you’ll be greeted with a simple prompt for your username. 19 | 2. Type `pi` and then press **Enter**. 20 | 3. Next, you’ll be asked for your password. Type `raspberry` and press **Enter** again. Don’t worry that you don’t see the password on the screen as you type it. This is a security feature to stop people snooping over your shoulder and stealing your password. You should now be greeted with a strange text prompt. 21 | 22 | ## Starting the Graphical Environment 23 | 24 | The strange text prompt that you see is one of the most powerful ways to communicate with a computer. However, it’s not very easy and is full of strange arcane commands, a bit like a magic spell. We can therefore move to a more familiar graphical environment, with windows and menu bars, that may perhaps feel a bit more comfortable. To do this, type `startx` into the text terminal and press **Enter**. 25 | 26 | ## Starting the Python 3 Programming Environment 27 | 28 | Once the graphical environment has started, you can click on the **main menu** at the top of the screen and choose **Python 3** from the **Programming menu**. This will open the Python programming environment known as **IDLE3**. 29 | 30 | ![](images/idle3.png) 31 | 32 | ## Writing a Simple Program 33 | 34 | You are going to write a program to make a drawing of a shape. 35 | 36 | 1. Next to the three arrows `>>>` or prompt type: 37 | 38 | ```python 39 | import turtle 40 | ``` 41 | Then press **Enter**. 42 | 43 | 2. At the next `>>>` or prompt type: 44 | 45 | ```python 46 | robot = turtle.Turtle() 47 | ``` 48 | 49 | This command opens the Turtle Graphics window with an arrow in the middle. This is your turtle, called robot, and you can give it instructions to move. 50 | 51 | 3. Let's make it look more like a robot turtle by typing: 52 | 53 | ```python 54 | robot.shape("turtle") 55 | ``` 56 | 57 | 4. To instruct your robot turtle to move type: 58 | 59 | ```python 60 | robot.forward(100) 61 | robot.right(90) 62 | ``` 63 | 64 | What happens? What more would you need to type to make a square shape? 65 | 66 | -------------------------------------------------------------------------------- /lesson-2/images/idle3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-2/images/idle3.png -------------------------------------------------------------------------------- /lesson-2/images/program-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-2/images/program-1.png -------------------------------------------------------------------------------- /lesson-2/images/program-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-2/images/program-2.png -------------------------------------------------------------------------------- /lesson-2/images/program-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-2/images/program-3.png -------------------------------------------------------------------------------- /lesson-2/lesson.md: -------------------------------------------------------------------------------- 1 | # Lesson 2 - Can Computers Think For Themselves? 2 | 3 | ## Introduction 4 | 5 | This lesson will give an introduction to Python programming by writing a simple program to take user input, and then print statements to the screen. It builds on lesson 1 using IDLE 3 to program in Python 3. 6 | 7 | 8 | ## Learning objectives 9 | 10 | - Know how to debug code 11 | - Understand the differences between speaking to a human and speaking to a computer program 12 | - Be able to create and debug a simple computer program in Python using `print` and user input 13 | 14 | 15 | ## Learning outcomes 16 | 17 | ###All students are able to: 18 | 19 | - Be able to write a simple Python program and check that it works. 20 | 21 | ### Most students are able to: 22 | 23 | - Know that Python is a computer programming language. 24 | - Be able to write a simple Python program, and explain the sequence it is following. 25 | 26 | ### Some students are able to: 27 | 28 | - Understand the limitations of computers, compared to human intelligence, when following a sequence of instructions. 29 | 30 | 31 | ## Lesson summary 32 | 33 | - The first Python program 34 | 35 | ## Starter 36 | 37 | Direct students to a website containing a chat bot like [Elbot](http://www.elbot.com/), or display a website with a chat bot to the class. You could even use Siri on an Apple device. 38 | 39 | Students may put questions to the chat bot. Ask them to note any answers that don’t quite match the questions; for example, "who is the best football player in the world?". After a few minutes, have the students feed back in a whole-class discussion. The teacher should note some of the questions that may have confused the chat bot. Draw out from students any themes, or any reasons why they think the chat bot could not answer their questions as they would expect. 40 | 41 | Ask the students why it is so hard for programs like these to understand and interact with humans. Why is it so easy to confuse them? Draw out from questioning that computers execute or run programs that follow a sequence of instructions, and that they can only follow this sequence. 42 | 43 | Explain the concept of the [Turing test](http://en.wikipedia.org/wiki/Turing_test) and artificial intelligence. Explain that in this lesson, students will write Python programs on the Raspberry Pi to turn them into a chatting robot. 44 | 45 | 46 | ## Main development 47 | 48 | 1. Ask students to set up their Raspberry Pi equipment, turn it on and log into their Pi using the username `pi` and the password `raspberry`. 49 | 50 | **Note that students will not see any text when typing the password but assure them it is working. Why do they think this might be the case? Hint: what might happen if someone was looking over their shoulder?** 51 | 52 | 2. Next, students should load the graphical environment by typing `startx`. To use Python, students will need to access the programming environment **IDLE3**. To open IDLE3, students can either double-click on the IDLE3 icon on the desktop or click on the **Main Menu** and select **Programming**, followed by **IDLE 3**. 53 | 54 | ![](images/idle3.png) 55 | 56 | 3. Demonstrate the IDLE interpreter window to students. Explain that commands can be typed directly into this window after the prompt which looks like this: `>>>`. This window is referred to as the interpreter or shell. You can type a line of code after this prompt and press Enter; this will run that line of code. You can demonstrate this with `print("Hello World!")`. Ask students what they could replace the "Hello World" with. Have them experiment using the interpreter window for a few minutes. Explain that the computer can only follow one instruction at a time in **sequence**. 57 | 58 | 4. Explain to students that when you are writing many lines of code in a program, it can become tiresome to use the interpreter; should you want to save your code, it is better to use a text editor. Show students how to create a new text editor file by clicking on **File>New Window** from the menu at the top of the **IDLE3** window. Show students how to save this file, by clicking on **File>Save As** and naming it `name1.py`. 59 | 60 | 5. Direct students to type the following code into the text editor window. Point out the difference between a comment and a line of code. Comments are parts of a program that are ignored by the computer, so we can make notes about what is happening in the program. 61 | 62 | ```python 63 | 64 | # My Python Program by .... 65 | 66 | name = input('what is your name: '), 67 | print("Nice to meet you ", name) 68 | ``` 69 | 70 | *Note that the spaces before `"` in the string are important.* 71 | 72 | Save the file as a Python file by clicking on **File** then **Save As**, and name it **robot**. 73 | 74 | Then run the file by clicking on **Run** then **Run Module**. 75 | 76 | ![](images/program-1.png) 77 | 78 | 6. Students can then add their own input and `print` statements, perhaps asking for the user's age or their favourite colour. For example, they could add: 79 | 80 | ```python 81 | 82 | age = input('How old are you: ') 83 | print("You do not look like you are aged ", age) 84 | ``` 85 | Direct students to save the file and run the code as before. 86 | 87 | ![](images/program-2.png) 88 | 89 | 7. Once students have working programs with multiple questions, introduce the idea of spacing out the questions asked with time. In a conversation, there is usually a pause between answering a question and asking the next one. The goal is to create a chatting robot that might be confused for a real person; therefore, we need to place a pause in between the questions. This can be achieved using the `time` module. To add the module, students will need to add `import time` underneath the comment and before the questions. Then between the questions they will need to use `time.sleep(1)`, where the value 1 represents 1 second, like this: 90 | 91 | ![](images/program-3.png) 92 | 93 | 8. Allow the students to continue writing code to take user input and post information to the screen. Then ask students to save their work and shut down the Raspberry Pis by clicking on the **Shutdown** button on the desktop. 94 | 95 | ## Plenary 96 | 97 | Ask students to choose three new words they have learnt today or in the last few lessons, and define them. Then ask students to write a paragraph for each of the words, or one using all three at once. 98 | 99 | 100 | ## Homework 101 | 102 | Students should think of five questions that they would like their chatting robot to ask, ready for the next lesson. 103 | 104 | -------------------------------------------------------------------------------- /lesson-3/images/audio_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-3/images/audio_output.png -------------------------------------------------------------------------------- /lesson-3/images/espeak1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-3/images/espeak1.png -------------------------------------------------------------------------------- /lesson-3/images/espeak2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberrypilearning/turing-test-lessons/335049dd915bb043188a512fb9cf2b1da07abf2d/lesson-3/images/espeak2.png -------------------------------------------------------------------------------- /lesson-3/lesson.md: -------------------------------------------------------------------------------- 1 | # Lesson 3 - Make a chatting robot 2 | 3 | ## Introduction 4 | 5 | This lesson will teach students how to take their chatting robot programs, which currently print the conversation to the screen, and turn them into speaking robots where they can hear their robot ask the question. 6 | 7 | You will need to ensure that 'espeak' has been downloaded and installed on the SD cards using `sudo apt-get install espeak`. 8 | 9 | Students will need access to headphones in order to hear the sounds. You may also require a speaker to demonstrate to the class. 10 | 11 | Finally, you will need to ensure that sound is being forced to the headphones rather than HDMI by typing `amixer cset numid=3 1`, or by double-clicking on the Python Games icon and selecting **Force Headphones**. 12 | 13 | ## Learning objectives 14 | 15 | - Identify and use input and output devices on a Raspberry Pi 16 | - Be able to add code to chatting robot programs on the Raspberry Pi to allow text to be read aloud by it 17 | - Test and evaluate the chatting robot programs created so far 18 | 19 | 20 | ## Learning outcomes 21 | 22 | ### All students are able to: 23 | 24 | - Identify an input and an output device on a Raspberry Pi computer. 25 | - Add some code to a chatting robot program to allow text to be read aloud by it. 26 | 27 | 28 | ### Most students are able to: 29 | 30 | - Test and provide feedback to their peers on their chatting robot program. 31 | 32 | ### Some students are able to: 33 | 34 | - Devise ways to improve the chatting robot program through evaluation. 35 | 36 | 37 | ## Lesson summary 38 | 39 | - A parts-labelling activity 40 | - Adding text-to-speech 41 | - Improved Python programs 42 | 43 | ## Starter 44 | 45 | Place if possible four sets of the following out on desks, unconnected, or however many you can find of each item from the list: 46 | 47 | - Raspberry Pi 48 | - Speaker 49 | - Headphones 50 | - Pi camera (if you have one) 51 | - Webcam 52 | - Keyboard 53 | - Mouse 54 | - Monitor 55 | 56 | Allocate students to groups and give each group a different colour of sticky notes or paper. Give students time to label all the components with the following information: 57 | 58 | - What it is 59 | - Whether it is an input, process or output device 60 | - What it does 61 | 62 | After students have labelled the components, ask groups to explain their answers. Identify any which are incorrect or really interesting, and discuss the reasoning with the class. Explain that all computers have inputs and outputs. This is important to note for their chatting robot program, as they want to hear its speech outputting to headphones or a speaker. 63 | 64 | ![](images/audio_output.png) 65 | 66 | ## Main development 67 | 68 | 1. Ask students to set up their Raspberry Pi equipment, turn it on and log into their Pi using the username `pi` and the password `raspberry`. They should then load their chatting robot programs using **IDLE3**. 69 | 70 | 2. Using their homework from the previous lesson, instruct students to add more questions to their code using `input` and `print`. 71 | 72 | 3. Explain that now students will need to add some code in order for the Raspberry Pi to speak the words in the program. Students will need to add the following code to the top of their programs: 73 | 74 | ```python 75 | # My Python Program by ... 76 | import os, time 77 | 78 | def robot(text): 79 | os.system("espeak ' " + text + " ' ") 80 | 81 | robot("Hello") 82 | ``` 83 | **Note that the indentation is important; the text editor in IDLE3 should auto-indent for you. Also, the spacing and use of quotation marks is important. The program will not work without them.** 84 | 85 | 4. Ask students to save this as a new file by clicking on **File** and **Save As**, then name it **robot1**. They can then run their programs and they should hear a voice say "hello"! 86 | 87 | 5. Next, explain that instead of printing the questions to the screen, they can now get their robot voice to say them and then reply. 88 | 89 | To do this they first need to replace the word `print` with the function name `robot`, then remove the comma `,` and replace it with a plus symbol `+`. Ask students to save and test at this point. Can they explain what happens? Bonus points to anyone who can think of a way to get the robot to ask the questions as well! The answer is to add another line above the input line using the `robot` function, for example: 90 | 91 | ```python 92 | robot('What is your name') 93 | name = input('What is your name: ') 94 | robot("Nice to meet you " + name) 95 | ``` 96 | 97 | ![](images/espeak2.png) 98 | 99 | ## Plenary 100 | 101 | Direct students to swap seats with a partner. They have a few minutes to test their partner's programs, and suggest at least one improvement by writing a comment using the `#` symbol. Students should then return to their programs and make the suggested improvement. 102 | 103 | As an extension task, students could remove one line of code from their partner's program, swap back and see if they can fix the broken code! 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /meta.yml: -------------------------------------------------------------------------------- 1 | title: The Turing Test 2 | category: teach 3 | lessons: 4 | 1: How do Computers Think? 5 | 2: Can Computers Think for Themselves? 6 | 3: Make a Chatting Robot 7 | -------------------------------------------------------------------------------- /overview.md: -------------------------------------------------------------------------------- 1 | This scheme of work has been designed as an introduction to text-based programming using Python on the Raspberry Pi. By the end of all the lessons, students will have created an interactive chat bot and will have been introduced to the computer science concept of artificial intelligence. 2 | 3 | This scheme of work is specifically targeted towards introductory KS2 Computing, although these lessons could be used as a wider scheme of work at KS3. This has been developed in harmony with the new Computing curriculum in the UK. 4 | -------------------------------------------------------------------------------- /software.md: -------------------------------------------------------------------------------- 1 | # Software Installation 2 | 3 | ## Downloading and installing espeak 4 | 5 | 1. After booting, log in using the default login `pi` and password `raspberry`. 6 | 2. On the command line type: `sudo apt-get install espeak`. 7 | 3. Press `Y` on the keyboard when prompted. 8 | 9 | ## Forcing sound to headphones 10 | 11 | 1. Ensure that your headphones are plugged into the sound jack port on the Raspberry Pi. 12 | 2. After booting and logging in you can type the following line on the command line: `amixer cset numid=3 1`. 13 | 3. Alternatively you can load the desktop by typing `startx`, double-clicking on the **Python Games** icon, selecting **Force headphones** and clicking **OK**. 14 | 15 | ![](/lesson-3/images/audio_output.png) 16 | -------------------------------------------------------------------------------- /software.yml: -------------------------------------------------------------------------------- 1 | - espeak 2 | -------------------------------------------------------------------------------- /teacher-instructions.md: -------------------------------------------------------------------------------- 1 | # Teacher Setup Instructions 2 | 3 | For this scheme of work students will need access to: 4 | 5 | - A Raspberry Pi 6 | - A keyboard and mouse connected to the RPi 7 | - A monitor connected to the RPi 8 | - Latest NOOBS SD card with Raspbian installed (instructions below) 9 | - espeak downloaded and installed on each SD card (instructions below) 10 | 11 | For lesson 3 students will need this additional equipment: 12 | 13 | - A headphone splitter connected to the RPi audio jack, if students are working in pairs on one RPi. 14 | - A pair of headphones connected to the splitter or RPi per student. 15 | 16 | 17 | ## Downloading and installing NOOBS 18 | 19 | Instructions for best practice on [downloading and installing NOOBS can be read here](http://www.raspberrypi.org/help/noobs-setup/). 20 | 21 | 22 | ## Downloading and installing espeak 23 | 24 | 1. After booting, log in using the default login `pi` and password `raspberry`. 25 | 2. On the command line type: `sudo apt-get install espeak`. 26 | 3. Press `Y` on the keyboard when prompted. 27 | 28 | 29 | ## Forcing sound to headphones 30 | 31 | 1. Ensure that your headphones are plugged into the sound jack port on the Raspberry Pi. 32 | 2. After booting and logging in you can type the following line on the command line: `amixer cset numid=3 1`. 33 | 3. Alternatively you can load the desktop by typing `startx`, double-clicking on the **Python Games** icon, selecting **Force headphones** and clicking **OK**. 34 | 35 | ![](lesson-3/images/audio_output.png) 36 | 37 | ## Making a class set of SD cards 38 | 39 | Once you have completed the steps above, you can make a copy of your master SD card and then use that to make a class set. 40 | 41 | 1. Place your master SD card in a computer or laptop with an SD card reader. 42 | 2. On Windows use [Win disk 32 imager](http://sourceforge.net/projects/win32diskimager/) to make a copy of an SD card. On Mac OSX you can use the `dd` command or a [dd-gui](http://www.gingerbeardman.com/dd-gui/). 43 | 3. Remove the master SD card and keep it safe. 44 | 4. Take a fresh SD card and insert it into your computer or laptop. 45 | 5. Format the SD card then, using your imaging software, select the image and write it to the card. 46 | 6. Repeat the last step for the rest of your cards. 47 | --------------------------------------------------------------------------------