Lesson 1 - Raspberry Pi Introduction and Platypus
Jump to navigation
Jump to search
Raspberry Pi Introduction and Platypus Lesson
| Lesson number | Step by step instructions | Dropbox Video link | Teacher resources |
|---|---|---|---|
| Lesson 2a | #Learn how to build a Raspberry Pi | Raspberry Pi Beginner's Guide pdf | |
| Lesson 2b | #Learn about the platypus in the Plenty River | Platypus release video mp4 | |
| Lesson 2c | #Installation of Scratch on the Raspberry Pi | ||
| Lesson 2d | #Introduction to the Scratch programming language | Scratch coding script for dog lesson Scratch .sb file |
Learn how to build a Raspberry Pi
- One of the most important tools we will be using in this course is a little computer called the Raspberry Pi
- The Raspberry Pi is a small, low cost computer designed for young people so they can become more computer literate.
- The Raspberry Pi is also a great tool that we can use for Climate Change and Environmental education.
- Raspberry was chosen after famous fruit computer brands (e.g. Apple, Blackberry, Acorn)
- Pi is short for the computer language Python
- A Raspberry Pi needs a monitor, mouse, keyboard and power supply to run.
- Re-using old computer equipment is much better than buying them new.
- It also needs a microSD card with the Raspbian Operating System installed.
Components required for assembly of Raspberry Pi computer:
- Raspberry Pi computer (Raspberry Pi 4, 3B, and 3B+ boards)
- Mouse with USB plug
- Keyboard with USB plug
- Monitor connected to HDMI port using a VGA to HDMI converter
- Power supply
Important assembly instructions
- Power supply is always connected last.
- Make sure the computer monitor is turned on before starting the Raspberry Pi.
- Make sure the VGA plugs are connected correctly. Can sometime be plugged in upside down (incorrectly).
- Make sure the power supply plug is connected correct to the Raspberry Pi (dot facing upwards).
Safety discussion
Raspberry Pi can be easily damaged with the following actions:
- Dropping Raspberry Pi
- Touching internal circuitry
- Spilling water on Raspberry Pi
Other safety issues
- Only teacher should power up the Raspberry Pi (high voltage AC power).
- Computer monitors are very heavy and should only be moved by the teacher.
- Electrical cables are a potential trip hazard. Keep them off the ground.
- Keep mouse and keyboard cables on the table. Hang them behind the monitor to keep them out of the way.
Learn about the platypus in the Plenty River
- In this lesson we will learn about the platypus that lives in the Plenty river.
- The students will work on projects that will help to save the platypus.
- Unfortunately, the platypus will become extinct from the Plenty river catchment over the next 30 years unless we make some big changes.
- We all need to help the platypus by:
- floods - we need to reduce the amount of stormwater going to local waterways. Install rainwater tanks at home.
- droughts - use tank water at home to water your garden. Water in the ground will help replenish groundwater. Groundwater keeps waterways flowing even during dry periods.
- litter - put all litter in bins and pick up litter on roads. Litter goes directly to waterways via stormwater pipes.
- turbidity - Stop soil and dirt entering waterways. Turbidity in the water stops plants from producing oxygen. Dirt also adds excess nutrients to the water and can cause algal blooms.
- replanting - Planting more native plants around waterways (riparian vegetation) to create better habitat and protection for the platypus.
Important characteristics of the platypus
- Thick coat (inner and outer coat).
- Webbed feet.
- A special bill that can detect electrical signals made by other animals (e.g. yabby).
- Males have a poisonous spur on their legs.
- Largest mammal to lay eggs.
Installation of Scratch on the Raspberry Pi
- To install Scratch on the Raspberry Pi we need to use the Terminal application.
- Click on the Terminal icon at the top of the screen.
- Many of the user settings in Terminal window can be adjusted.
- In this example we will increase the font settings.
- From the Edit menu select Preferences
- Click on the Terminal font setting on the right of screen. The default value is 10.
- A new Pick a Font window will open up.
- Change the font size to 16.
- Save the changes by clicking on Select then OK
- Re-size the Terminal window.
- Enter the command sudo apt-get update to update software library catalogs on the Raspberry Pi.
- We need to do this before we install new software.
- Enter the command sudo apt-get install scratch to install scratch.
- Answer y (yes) to any questions.
- The installation will take one minute.
- Once the installation is complete the Scratch program can be launched from the Raspberry Pi icon.
- Click on Programming > Scratch
Introduction to the Scratch programming language
- Scratch is a very simple block coding language that can be installed on the Raspberry Pi.
- Scratch is very easy to learn and will form a good foundation for other programming languages.
- Scratch (version 1.4) will be installed on this computer.
Starting Scratch for the First Time
- Open Scratch from the Raspberry Pi menu (top left) by clicking on Programming > Scratch
- The Scratch environment is divided into the Stage (right of screen), the pallet which contains coding blocks (left of screen) and coding area where coding blocks are assembled to make a script (middle of screen)
Automating your Sprite
- Make sprite move using Move 10 block
- Click on the block to make the cat move 10 steps
- Automate the spirte with Forever block
- Add When Green Flag is Clicked to start the code
- Remember to click on the Stop button to stop the code
- From the Motion pallet add If on edge, bounce
- When the cat touches the edge of the stage it will bounce back.
- Don't worry that the cat is upside down. We will fix this later.
Adding a New Sprite
- Use the Scissor tool to delete the cat sprite.
- Add a new sprite
- Add the new sprite from a file. Click on the middle button.
- Click on the Animals folder
- Select the dog 2-b sprite.
- Select the Shrink tool and then click on the dog sprite to make it smaller.
- To de-select the shrink tool click away from the dog sprite.
Adding more Costumes for Animation
- To animate our dog we need to import another dog costume.
- Click on the Costumes tab and then click on the Import button.
- Select dog 2-c
- Click on each dog costume.
- You should see the dog sprite on the Stage start to walk.
- By swapping costumes we can animate our dog.
- Click on the Scripts tab.
- From the pallet on the left of the screen, click on Looks
- Drag the next costume block and place it within the forever loop.
- Click on Green Flag to start your program.
- The dog should be running very fast.
- To slow the dog animation - click on the Control Tab
- Drag the wait 1 second block and place it within the forever loop
- If the dog is too slow, change the wait period to wait 0.1 seconds
- You may need to double click the time to enter a new time.
Saving Scratch Projects
- To save the current project click on the File dropdown menu.
- Click on Save As
- The project will be saved in a folder named Scratch Projects
- Give the file a descriptive name.
- Make sure there are no spaces in the file name.
- Use file names such as dog_animation using the hyphen symbol to separate words.
- Or use camel-back notation such as dogAnimation.
- When working on the same project just click on File > Save to save the project.
Exiting the Scratch Program
- Exit the Scratch program by clicking on the File drop down menu and selecting Quit
Watch outs
- Don't forget to save your work as you go.
- If you lose your code check that you have not accidentally clicked on the Stage.
- To bring back your code just click on your original sprite (e.g. dog sprite).
- Code in Sprite is Object-Oriented. Code is attached to individual Sprites.