GrovePi Temp-Humidity Sensor Lesson Video Script. Slide 1

Similar documents
Explore and Challenge:

Using the SparkFun PicoBoard and Scratch

MICROSCANNER TM D-Series

Section 2 Lab Experiments

Let s start by making a pencil, that can be used to draw on the stage.

Let s start by making a pencil that can be used to draw on the stage.

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

Try what you learned (and some new things too)

MicroLab 500-series Getting Started

Lesson 3: Arduino. Goals

Module. Introduction to Scratch

Explore and Challenge:

Open the Tech Toys Scratch project. Your club leader will give you a copy of this project, or you can open it online at jumpto.cc/toys-go.

Digital Wireless Weather System

Tilt Sensor Maze Game

Sensor Calibration Lab

Arduino Lesson 1. Blink. Created by Simon Monk

200 mm VW Displacement Sensor

Workshop 1 Measurement techniques and sensors

Installation Instructions

KMC Input Wizards. Application Guide. Contents. Introduction to the Binary and Analog Wizards

TRACEABLE RADIO-SIGNAL REMOTE THERMOMETER INSTRUCTIONS

How to Make Games in MakeCode Arcade Created by Isaac Wellish. Last updated on :10:15 PM UTC

Understanding the Arduino to LabVIEW Interface

HEAT ACTIVATED SWITCH KIT

Excel 2003: Discos. 1. Open Excel. 2. Create Choose a new worksheet and save the file to your area calling it: Disco.xls

The CO2 Sensor Calibration Kit

TS-WS-07 Wireless Indoor/Outdoor 8-Channel Thermo-Hygrometer with Jumbo Display User Manual

Excel 2016 Cell referencing and AutoFill

Scratch Coding And Geometry

Controlling a Sprite with Ultrasound

AS726X NIR/VIS Spectral Sensor Hookup Guide

MULTIMETRE DIGITAL 3 3/4 AVEC ECHELLE AUTOMATIQUE & EXTINCTION AUTOMATIQUE MANUEL D UTILISATION

Instrument Cluster Display. Grant Scott III Erin Lawler Mike Carlson

Collecting Live Data in Fathom NCTM 2013

Solving Equations and Graphing

Installation Manual. Ultra RF Analogue Transmitter QC0168. Manual Ref: QC0168. Version: March

RLC Software User s Manual

Wireless Pressure Station with Backlight

SCATT Biathlon shooting trainer User s Manual

DESCRIPTION DIMENSIONS HOW TO ORDER

NH3 system. This procedure should only be used as a guide; your particular installation may be different depending on the NH3 controlling system.

Application Note CTAN #305

Pong! The oldest commercially available game in history

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

UNIT TWO: Data for Simple Calculations. Enter and format a title Modify font style and size Enter column headings Move data Edit data

IMPORTANT Carefully remove all the parts from the carton and place them individually on a soft cloth to prevent scratches or other damag

STRUCTURE SENSOR & DEMO APPS TUTORIAL

Tarocco Closed Loop Motor Controller

Getting started with the SparkFun Inventor's Kit for Google's Science Journal App

Wireless Color Weather Station

User's manual of the LB -798 hygrometer

Excel Tool: Plots of Data Sets

Experiment 3 Ohm s Law

SCATT BASIC SHOOTER TRAINING SYSTEM USER MANUAL. SCATT company Tel: +7 (499)

EXERCISE 4: A Simple Hi-Fi

Assignment 5 due Monday, May 7

Yara Water Solution. Installation Guide. Product summary: - Included components - Tools for setup - Installation overview

How big is your room and what are the walls made out of?

Introduction to Simulink Assignment Companion Document

WIRELESS TEMPERATURE S TATION I NSTALLATION MANUAL

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

KUMU A O CUBESAT: THERMAL SENSORS ON A CUBESAT

DHT11 Electronic Brick of Digital Temperature & Humidity Sensor

Part II: Number Guessing Game Part 2. Lab Guessing Game version 2.0

Unit 5: What s in a List

- Wiring Brochure Universal Reset Module 423e

Wireless Pressure Station

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

Yara Water Solution. Installation Guide. Product summary: - Included components - Tools for setup - Installation overview

PivotTables PivotCharts (Chapter 5)

- Wiring Brochure Universal Reset Module 423

WS-7136U Wireless 433 MHz Temperature Station. Instruction Manual

2 Thermistor + Op-Amp + Relay = Sensor + Actuator

Handheld Infrared Thermometers

WS-7212NU Wireless 433 MHz Weather Station. Instruction Manual

Digital Room Sensor Technical Guide

Scratch for Beginners Workbook

INTAC Microprocessor Humidifier Controller

E2T0 DVP

User Guide. Heavy Duty Psychrometer + IR Thermometer. Model HD550

Digital Guitar Effects Box

CREATING (AB) SINGLE- SUBJECT DESIGN GRAPHS IN MICROSOFT EXCEL Lets try to graph this data

New Agrosta Winterwood Digital Firmness Color Size Tester Version June 2018

The Revolve Feature and Assembly Modeling

Familiarization with the Servo Robot System

Mini Photo Printer User Manual

Pic-Convert Board Instructions

Activity P56: Transistor Lab 2 Current Gain: The NPN Emitter-Follower Amplifier (Power Output, Voltage Sensor)

OM-60-TH SERVICE LOGGER WITH TEMPERATURE/HUMIDITY/DEW POINT SENSOR GETTING STARTED

GSM BASED PATIENT MONITORING SYSTEM

The lump sum amount that a series of future payments is worth now; used to calculate loan payments; also known as present value function Module 3

Temperature activated switch

TC LV-Series Temperature Controllers V1.01

The appliance is fitted with a 3-digit display in order to show the room temperature and the 2 + and - key parameters for the programming functions.

ADI-100 Interrupter. Operator s Manual. 526 S. Seminole Bartlesville, OK /

patterns in mathematics unit 3 notes.notebook Unit 3: Patterns in Mathematics

Learning to use your easypod. [somatropin (rdna origin) for injection]

Peltier Cooled Thermal Management System User s Guide

CX105 Conductivity/Resistivity Transmitter

Transcription:

Slide 1 Grove Pi Temp-Humidity Lesson In this GrovePi lesson we will Kick it up with a Temperature-Humidity sensor. A temperature-humidity sensor is used to detect temperature and to detect humidity level like a thermostat and a hygrometer. Common uses of temperature sensors are in home wall thermostats and room heaters. They are used to regulate the temperature in a room so it is not too hot or not too cold. Temperature humidity sensors are often used in greenhouses where the temperature and relative humidity are monitored and controlled to improve plant growth. Temperature sensors are also in oven thermostats, meat thermometers, and in refrigerators and freezers. But those are a special type of temperature sensor made for harsh conditions, and we cannot use our sensor for those extremes. Slide 2» Connect the Hardware GrovePi to Temp- Humidity Sensor» Learn Scratch command blocks» Complete activities to learn how to control the Temp-Humidity Sensor» Write your own program to control the Temp- Humidity Sensor Let s get started. Here s an overview of what we are going to do in this lesson. First we will connect the hardware devices, which means the GrovePi assembly connected to the Temp- Humidity Sensor module. Next for the software control we will use the Scratch Programming Environment on the Raspberry Pi. We will learn about the specific command blocks that we need for controlling the Temp-Humidity Sensor. Then we have several activities to complete where we write Scratch programs to control the Temp- Humidity Sensor. 1

Slide 3 Slide 4» Grove Pi Assembly» Temp-Humidity Sensor module» LCD Display» 2 Cables» Analog Ports» Digital Ports» I2C Ports» Raspberry Pi Serial» GrovePi+ Serial» Use D6 for the Temp- Humidity Sensor Finally, you will create your own project to control the Temp-Humidity Sensor. Let s pull out the hardware parts that we need. We will be using the GrovePi with Raspberry Pi Assembly from prior lessons. We need the Temp-Humidity Sensor module from the GrovePi kit. We will also be using the LCD display and we need two cables to connect these devices. The GrovePi board has analog ports, digital ports, I2C ports, and serial ports. The Temp-Humidity Sensor is a digital device. So we will be using one of the digital ports. Those are the ones shown in Red here and are labeled D2, D3, D4, D5, D6, D7, and D8. The one we will use for the Temp- Humidity Sensor connection is D6. Slide 5» Capacitive sensor measures humidity in RH (relative humidity)» NTC Thermistor measures temperature in degrees Celsius Specifications» Low power consumption» Accuracy: up to 0.3 degree in temperature and 2% in relative humidity. The grove temp-humidity module is a high accuracy temperature and humidity sensor used in home conditions. It can be mounted on a box with the screw holes around the edge of the blue circuit board. It consists of a capacitive sensor element used for measuring relative humidity and a negative temperature coefficient (NTC) thermistor used for measuring temperature in degrees Celsius. It is a small device with ultra low power consumption. 2

The accuracy of this module is up to 0.3 degrees in temperature and 2% in relative humidity. This is a good device for use in home environments and if it is protected in an enclosed case, it can be used in a greenhouse or plant growth environment. Slide 6 SCRATCH PROGRAMMING LANGUAGE Programming the LEDs To obtain data from the sensor, we will use Scratch programs. We will use the Scratch programming language on the Raspberry Pi. We are going to assume you have made the connection to the Raspberry Pi as demonstrated in prior lessons, and have either a laptop or a monitor, mouse, and keyboard connected. We also assume you can see the operating system on the Raspberry Pi and are ready to use the Scratch programming language. If you don t get through all the activities in this lesson during one class session, remember these setups are required before starting each activity. And of course we assume you have gone through the introductory lessons for Scratch and are familiar with it. If you have not already done these things, pause or stop this video and come back when you have everything set up. 3

Slide 7» Send message to Sensor on Specified Digital Port to take a temperature reading and store in temp sensor value broadcast temp(port) temp sensor value» Send message to Sensor on Specified Digital Port to take a humidity reading and store in humidity sensor value broadcast humidity(port) humidity sensor value The temp-humidity module has two sensors, and we use different commands to get their values. To obtain an input from the temperature sensor, we use two command blocks. First, we use broadcast to send the command temp followed by the port number. This directs the GrovePi to send a signal to the temperature sensor. This starts it detecting the temperature and obtains a number from the sensor. The next command block temp sensor value - will store the number so that we can display it with the say command. We will also use other commands to compare the sound sensor value to a number and take an action. We use a similar method to obtain an input from the humidity sensor. We broadcast humidity followed by the port number. The humidity value is stored in the humidity sensor value. We can also display it with the say command. And we can use other commands to compare the humidity sensor value to a number and take an action. 4

Slide 8» Adds two numbers» 30 + 10 = 40» Subtracts second number from first number» 30 10 = 20» Multiplies two numbers» 30 * 10 = 300» Divides first number by second number» 30 / 10 = 3 There are a few math command blocks we are going to use in our program, and let s take a moment just to review them. These command blocks can be inserted into other commands. The Addition command adds two numbers. You can type numbers into the two white boxes or you can place a variable name there and it will a add the values of the variables. For example 30 + 10 will result in 40. The Subtraction command subtracts one number from another. You can type numbers into the two white boxes or you can place a variable name there and it will subtract the right value from the left one. For example, 30-10 will result in 20. The Multiplication command multiplies two numbers. You can type numbers into the two white boxes or you can place a variable name there and it will multiply the values of the variables. For example, 30 x 10 will result in 300. The Division command divides one number into another. You can type numbers into the two white boxes or you can place a variable name there and it will divide the right value into the left one. For example 30 / 10 will result in 3. 5

Slide 9» Reports true if two values are equal» Temp = 60» Reports true if first value is less than second» Temp < 60» Reports true if first value is greater than second» Temp > 60 We also have Boolean expressions that we can use with numbers or variables. These command blocks can also be inserted into other commands. The equal block reports true if two values are equal. For example if we compared the value of a variable named Temp to 60 and they were equal, this would be true. Otherwise it would be false. The Less than block reports true if the first value is less than the second. For example if we compared the value of a variable named Temp to 60 and the variable had a number that is less than 60 then this would be true, if it was equal to or greater than 60 then it would be false. The Greater than block reports true if the first value is greater than the second. For example if we compared the value of a variable named Temp to 60 and the variable had a number that is greater than 60 then this would be true, if it was equal to or less than 60 then it would be false. Slide 10 Grove Pi Temp Sensor Lesson Temp-Humidity Sensor Let s get started with our first activity. You will find the directions in the worksheet for this lesson. In this activity we are going to detect and report the temperature. For the hardware connections, we will have the Temperature-Humidity sensor connected to port D6 on the GrovePi board. 6

Slide 11 Here is an animation showing the hardware connection points. Go ahead and set up your hardware for this activity by plugging one end of a cable into the Temperature-Humidity sensor and the other end into Port D6. Slide 12 when space key pressed broadcast temp6 say temp sensor value Let s go over the program we will create. We will use a Sprite, so we select one. We start with a when space key pressed hat command. Then we have a broadcast temp 6 command that will obtain the temperature input from port D6. Next we have a say command that will display the temperature sensor value we obtained from the broadcast command. Slide 13 Now let s go through creating this program step by step. We Open up scratch and select GrovePi and then Start Programming Then we select a sprite We Click on control then drag when space key pressed out to the script We Click and drag broadcast out and place it under when space key pressed We Click on Operators and drag join into broadcast then type temp in the first column and 6 in the second. We next drag out a Say command Then we drag out a sensor value command and put it into the say command 7

We select temp from the drop down box in the sensor value That s it, we save the program with our initials and Temp_Activity01 Slide 14» Detecting Temperature in Room» How can you obtain a higher or lower value?» Caution: Electronic devices can be destroyed with water.» Direct contact with Ice cubes or wet environments must be avoided.» How can you protect it?» Record changes in temperature. Now let s run the program Press the space bar and the sprite should display the value of the sensor in a speech bubble. The temperature is in Celsius. If you are not familiar with Celsius values, locate a Celsius to Fahrenheit chart on the Internet. So the sprite is displaying the current temperature in the room. Think about what methods you could use to obtain a higher or lower value. Remember this is an electronic device, so you can destroy it with water. So putting it directly on an ice cube is not a good idea, nor is putting it in any wet environment such as in a cup of heated liquid. What other methods can you use to cool or heat up the room or some small area? Or are there parts of the room that are already warmer or cooler? Is there any direct sunlight in the room? Would that be warmer? Create an experiment and record what you changed in the environment and the various temperature values. 8

Slide 15 Grove Pi Temp Sensor Lesson Temp-Humidity Sensor Let s move on to our second activity for the GrovePi Temp-Humidity Sensor. You will find the directions in the worksheet for this lesson. In this activity we are going to detect and report the humidity level. For the hardware connections, we will have the Temperature-Humidity sensor connected to port D6 on the GrovePi board. Slide 16 Here is an animation showing the hardware connection points. If you don t already have this connected, go ahead and set up your hardware for this activity by plugging one end of a cable into the Temperature-Humidity sensor and the other end into Port D6. Slide 17 When left arrow key pressed Broadcast humidity6 Say humidity sensor value Let s go over the program we will create. We start with a when left arrow key pressed hat command. Then we have a broadcast humidity 6 command that will obtain the humidity input from the sensor on port D6. Next we have a say command that will display the humidity sensor value, showing us the humidity value. 9

Slide 18 Now let s go through creating this program step by step. Let s start with the program from our last activity for checking the temperature We select the Sprite We duplicate the temperature display code by right clicking when space key pressed and selecting duplicate In the new block, we change the hat command from space key to down arrow Then we change the first join column from temperature to humidity Then change the sensor value to humidity We use the SAVE AS command and save the program with our initials followed by Temp_Acitivity_02 Slide 19 When we run the program, it now displays the Humidity when we press the down arrow, or the Temperature when we press the space key. If your program does not do this, go back and verify the code to see if you have any typing mistakes. Also check to see that the sensor is plugged into port D6. Make modifications and try again until it works. 10

Slide 20 Grove Pi Temp Sensor Lesson Temp-Humidity Sensor This is Activity 3 of the Grove Pi Temperature Sensor. You will find the directions in the worksheet for this lesson. In this activity we are going to detect and report the temperature level and convert it from Celsius to Fahrenheit. For the hardware connections, we will have the Temperature-Humidity sensor connected to port D6 on the GrovePi board. Slide 21 1) Start with Activity 2 program 2) In the Temperature section, add a conversion from Celsius to Fahrenheit 3) To covert the temperature from Celsius to Fahrenheit the formula is C x 9/5 + 32 = F 4) Using Operator command blocks to convert the temp sensor value to Fahrenheit. 5) Use a thermometer Sprite to display temperature in both Celsius and Fahrenheit 6) Use a hygrometer Sprite to display humidity We will start with the program from Activity 2 where we checked the humidity and temperature. This is your programming challenge. In the temperature section of the code, convert the temperature from Celsius to Fahrenheit. Use the formula temp Celsius x 9/5ths + 32 = temperature Fahrenheit. To verify your values, search for and use an online program that converts Celsius to Fahrenheit. Then find some clip art and create your own thermometer Sprite to display the Temperature in both Celsius and Fahrenheit. Also find some clip art for a hygrometer and use it as a sprite to display the humidity. Save the program with your initials followed by temp_activity03 11

Slide 22 Stop the video, write your program, and then come back and compare your solution to ours. Slide 23 Here s an example of the program code that we used. We have command blocks for each of the sprites. The first one displays the temperature and humidity. We added the math to convert the value from Celsius to Fahrenheit, and stored it in a new variable. Then we used those variables in the Say command to display the temperature in both Celsius and Fahrenheit. We have another sprite which displays the humidity level. If you were not able to make this work, use this code example and create your program. 12

Slide 24 Here is the program running. When we press the space bar it is displaying the temperature in both Celsius and Fahrenheit with a temperature sprite. A hygrometer sprite is displaying the relative humidity when we press the left arrow on the keyboard. Your program should look similar. Slide 25 Grove Pi Temp Sensor Lesson Temp-Humidity Sensor This is activity 4 of the GrovePi Temperature Humidity Sensor Lesson You will find the directions in the worksheet for this lesson. In this activity we are going to detect and report the temperature level and convert it from Celsius to Fahrenheit, and then show it on the LCD display device. For the hardware connections, we will have the Temperature-Humidity sensor connected to port D6 on the GrovePi board. We also need the LCD display connected to port I2C-2. 13

Slide 26 1) Start with program from last activity 2) Connect the LCD display 3) Display the temperature in both Celsius and Fahrenheit on the LCD display 4) Display the humidity on the LCD display 5) Bonus - Create a single bar graph to display the temperature in Celsius on the LCD display. Here s another programming challenge for you. Start with the program from the last activity where we displayed the temperature and humidity with a Sprite. Then go back and find the programs we used to display information onto the LCD display. Modify the program from Activity 3 so that it connects to the LCD display. Then modify it to add a display of the temperature in both Celsius and Fahrenheit on the LCD display Also display the humidity on the LCD display. As an extra bonus, try to create a single bar graph to display the temperature in Celsius on the LCD display. Slide 27 Stop the video, write your program, and then come back and compare your solution to ours. 14

Slide 28 Here is the code that we added to display the temperature and humidity on the LCD display. Notice that we copied the code from our other program and just changed the information that is displayed. If you were not able to make yours work, go ahead and copy this code and create the program. Here is also the code we added to display the temperature in a bar graph on the LCD display. This may be a little more complex than code we have used before, but it creates a simple bar graph from the value in the Celsius variable. If you were not able to make yours work, go ahead and copy this code and create the program. Slide 29 Here s an example of a program running which is displaying the temperature in both Celsius and Fahrenheit on the LCD display, and also displaying a bar graph of the temperature. Slide 30 Grove Pi Temp Sensor Lesson This is activity 5 of the GrovePi Temperature Humidity Sensor Lesson Temp-Humidity Sensor 15

Slide 31 It s your turn to create a program Using the code blocks you learned in this lesson, kick it up by: a) Detect temperature and humidity and display it b) Take action based on a change in temperature or humidity c) Allow user to select a desired temperature and display difference between actual and desired» How will you use the Temp-Humidity sensor?» What do you do based on the information?» How will you report the information? Now it s your turn to create a program. Using the code blocks you learned in this lesson, kick it up. Think about how and why you want to use the Temp-Humidity Sensor. It can start with detecting the room temperature and humidity and displaying it on the LCD display Then you could take some action based on a change in the temperature or humidity. For example, maybe you sound an alarm if the temperature goes below freezing, or above a temperature which is too hot for most plants. Or you may allow the user to set a desired temperature and/or humidity level and display the difference between actual and desired. This could be part of an interface for an invention or part of science experiment where you are monitoring plant growth or a chemical reaction. Or maybe this is a primary part of a weather station you are building. Or if it is part of a pet feeder invention, perhaps you want to give more water when it is hot or very humid. So begin to think about it, and create your design. How will you use the Temperature Humidity Sensor? What do you do based on the information? What action will you take? And how will you report the information to the user? Will you use a sprite or the LCD display or some other method? 16

Slide 32» Connect the Hardware GrovePi to Temp- Humidity Sensor» Learn Scratch command blocks» Complete activities to learn how to control the Temp-Humidity Sensor» Write your own program to control the Temp- Humidity Sensor This completes the activities for the Temp-Humidity Sensor. To summarize, We connected the hardware devices - the Temp-Humidity Sensor module was connected to the GrovePi assembly via a digital port. Next we used Scratch and learned about the specific command blocks for obtaining information from the Temp- Humidity Sensor. Then we completed several activities where we displayed information from the Temp-Humidity Sensor. Finally, you created your own project using the Temp-Humidity Sensor. With skills for using one more sensor, you are well on your way to using the GrovePi hardware to make an invention or interactive science experiment. 17