Close menu

Resources


PIPER COMPUTER

Everything you need to teach STEAM effectivly using the Piper Computer Kit.

Educator Guides StoryMode Project Guides PiperCode Project Guides
PIPER MAKE

Teach fundamental STEM skills while providing a bridge to career connected learning.

Educator Guides
Best Practices Standards Glossary FAQ Educator Forum

EDUCATOR PORTAL

Close menu

ALL GUIDES


StoryMode

  1. Mars
  2. Cheeseteroid
  3. Treasure Hunt
  4. Chain Reaction
  5. Power Plant
  6. Rainbow Bridge
  7. Funky Fungi
  8. Breadboard Bluffs
  9. Return to the Cheeseteroid

  1. Pip Hop
  2. Bot Builder

  1. Ring Race
  2. Snake Trap
  3. Dark Maze
  4. Explosive Escape
  5. Chest Quest

PiperCode

  1. Blink
  2. Stop Light
  3. Light Show
  4. Tally
  5. Siren
  6. Circuit Design
  7. Debug
  8. Frog Frenzy

  1. Color Coded
  2. Ther-Mood-Stat
  3. Security Zone

  1. Randomizer
  2. El Pangolin (Simon)
  3. Beat the Buzzer
  4. 5-Button Synthesizer

PIPER COMPUTER

PROJECT GUIDES


YOU ARE HERE

PiperCode Sensor Explorer

Project 2 of 3

PiperCode Project

Ther-Mood-Stat


Beginner

30 Mins

Grades 3 - 8

Look for the graphic above
to launch the project
INTRODUCTION

Fiery or Icy? This temperature sensor project is #mood

Students will learn how to wire and program a temperature sensor to read temperatures and display emojis based on the readings. Home heaters use a temperature sensor to tell the heater to turn on if it gets too cold. If it gets too warm, it tells the heater to turn off. This way, your house stays comfy!

PROJECT MATERIALS

Piper Computer Kit
Temperature Sensor
Breadboard
4 Wires (green, yellow, red, black)
4-Pin Jumper Cable

Newer Sensor Explorer Kits are now shipping with a 4-pin cable that has a white wire instead of a green wire. When you see the green wire in a wiring diagram, just connect the white wire instead.


PROJECT RESOURCES

Concepts

Students will deepen their understanding of temperature, forms of energy, and quantitative/qualitative data while continuing their use of sensors and piper code.

Troubleshooting Tips

  • During wiring, students can use the RPi pin map to check to make sure they have wired up the component correctly. This will light up to show when current is being sent to a pin. Don’t forget to type in ‘no emoji’ in the variable!

Our customer support specialists are on hand to ensure your implementation of Piper runs seamlessly.
View Support Docs or Contact Support
PROJECT STEPS

Step 1 Wire up your Temperature Sensor

In this project, you will create a ther-mood-stat using the Temperature Sensor. First, wire up your sensor to the Raspberry Pi using the diagram and the pin map below.

Step 2 Create the Function

Find a do something block under Function and drag it out to your programming environment as shown below. Change "do something" to "emoji". This block creates a routine with an implicit return.

Step 3 Write the emoji conditional

Find the if, return block under Function. Drag it inside of the to emoji block. The if,return block allows the function to return something. In this case, we want to return emojis at different temperature ranges!

Step 4 Set the range with 'and' logic

Under Logic, find the and block and place it inside of the if, return block. This allows you to create a temperature range for the return.

Step 5 Add inequalities to set the range

Place 2 = blocks, found under Logic, into the and Logic block as shown. Change the inequalities to ≥ and < respectively using the image above. Discuss: What do these symbols represent? Why are we using these inequalities in this case?

Step 6 Set temperature in Fahrenheit

Find the Temperature block under Expansions. Drag 2 Temperature blocks, one into each inequality block, as shown. Change the units to Fahrenheit.

Step 7 Add integer variables and adjust the values

Under Variables, find the integer block with a 0. Add one to each inequality and change the values based on the image above (80 and 90 respectively). The integers allow you to define the temperature range to return a specific emoji.

Step 8 Select a representative emoji

Find the Emoji block under Expansions. Add the Emoji block to the return in the if, return block. Select the emoji based on your personal preference. Discuss: Which temperature range matches a particular emoji?

Step 9 Set a return phrase

Next, we need to set a return for when the temperature is out of the range you set. Find the " " block under Variable and place it inside the return of the to emoji function as shown. Choose a statement and type it into the block. For example: "no emoji".

Step 10 Shout the emoji

To have your emoji show on the screen and keep it on the screen, you will need to use a shout color block found under Chip, a repeat forever block under Loops, and an emoji block found under Function. This separate code excerpt should look like the image above.

Step 11 Test your code

Click START in the top left corner of the screen to start your code. Measure something in the included temperature range to test the emoji function. (Hint: Rub your hands together and hold the sensor in your hand).

Step 12 View the data

As you measure, open the Temperature graph under your programming space by clicking on Data and choosing Temperature. Make sure you have the correct temperature units selected. Use the data visualizer to help you find the correct temperature in the range.

Step 13 Duplicate

Add more emoji possibilities by clicking on the if, return block. Once highlighted, right click and select Duplicate. Drag the duplicate blocks into the to emoji function. Do anywhere between 2-4 times.

Step 14 Customize temperature & emojis

Select values for the temperature ranges and emojis based on those ranges. An example can be seen in the image above.

Step 15 Test and try Celsius

Click START, measure different temperatures and see what mood you're in based on the emojis. Use the temperature graph to help guide you as you measure objects. Discuss: How would your temperature ranges change if you use values in Celsius? Try it!

Completed!