a1tD000000882XCIAY

Course: Programming with CoDrone Lite
8-Gyro Sensor with CoDrone Lite

  • 4-7 grade
  • Beginner

Lesson Description:

Gyroscopes have been helping people navigate for centuries, and gyro sensors are currently being used in smartphones to help detect motion. In this lesson, students will be learning about gyroscopes, gyro sensors, and then how to use the gyro sensor in their CoDrone. In addition,  students will learn how to use the gyro sensor to make the CoDrone turn in the direction that they want. They will also perform a mission so they can fly their CoDrone in a square.

Objectives: 

  • Explain how a gyro sensor can be used
  • Create and run a program in Snap that can check their CoDrone’s altitude using the CoDrone’s gyro sensor
  • Create and run a program in Snap that can have the CoDrone take off and travel in the same direction using its gyro sensor
  • Create and run a program in Snap that uses the CoDrone’s gyro sensor to turn
  • Create and run a program in Snap that has the CoDrone complete a mission to fly in a square using the gyro sensor

image description

Lesson Modules


Teaching Tips:

  • Ask students if they know what a gyroscope is. Show the video below first and then ask for observations, thoughts, and and questions. Next, have students read the article and ask how they think it relates to their CoDrone.

           Video: Gyroscope Tricks and Physics Stunts

           Article: What are Gyroscopes?

After watching the video and reading the article, answer the questions.


What is a gyro sensor and how did it work with their CoDrone? What did they use it to do?

How else do they think they could use the gyro sensor with their CoDrone’s flight?


Teaching Tips:

• Ask students to use pseudocode to explain to a partner how they programmed their drone in Snap using both their own words and the appropriate academic language.

Gyro sensor

Gyro sensors are a lot like compasses --- they sense rotational motion and detect orientation to figure out what direction something is facing. They're used in everything from space shuttles to cell phones, and now in your CoDrone!

The gyro sensor in your CoDrone reads from 0 to 359 degrees. At 360 degrees, when a full circle is completed, it starts back over at 0.

When the CoDrone is powered up, the direction it is facing at that point is saved at 0 degrees.

Challenges

Activity: Gyro challenge

The challenge: have the CoDrone take off and travel in the same direction, no matter where it starts from.

Challenge Rules:

  1. The CoDrone will take off, turn towards the proper direction, and then fly forward.
  2. You can divide your program into 4 sections, have one of your sections be a direction where your CoDrone does not turn, and have the other sections be directions where your CoDrone does turn.

Hint: the code you just made already divides the angles into 4 sections.

Activity: Compass challenge

Your challenge is to have the CoDrone take off and turn towards the four main directions --- 0, 90, 180, and 270!

Challenge rules:

  1. Your CoDrone needs to take off and turn towards the next direction.
  2. Once your CoDrone is facing the right direction, have it wait 3 seconds.
  3. Repeat until your CoDrone has faced all directions.

Hint: one direction was just done for you!


Teaching Tips:

Sample code

You can use the code for one side for all four sides, but you will need to change some of the values so it makes a full square! These are what your ranges should be:

  • 0 degrees: 355-5
  • 90 degrees: 85-95
  • 180 degrees: 175-185
  • 270 degrees: 265-275

Don't forget to include a flight event block at the end of your code so your CoDrone can land!

Summary

In this mission, you are going to program your CoDrone to fly in a square using its gyro sensor. The CoDrone will take off, turn towards 0 degrees, fly forward and then stop. It will do this for 90, 180, and 270 degrees until it's back where it started.



Teaching Tips:

For more math extension:

    • 4th grade: Have students work in pairs with one flying the drone and one marking its angles as it turns. The pairs should then measure the distance between sides of the rectangles to find their area and perimeter. They should also measure the angles to see if their drone really turned 90 degrees!
    • 5th grade: Have students work in pairs with one flying the drone and one marking its angles as it turns as well as its height (this can be marked on the wall). The pairs should then measure the distance between sides of the rectangles as well as its height to find their volume. They should also measure the angles to see if their drone really turned 90 degrees!
    • 6th grade: Have students work in pairs with one flying the drone and one marking its angles as it turns as well as its height (this can be marked on the wall). The pairs should then measure the distance between sides of the rectangles as well as its height to find their surface area. They should also measure the angles to see if their drone really turned 90 degrees!
    • 7th grade: Have students work in pairs with one flying the drone and one marking its angles as it turns as well as its height (this can be marked on the wall). The pairs should then measure the distance between sides of the rectangles as well as its height to find their area, volume, and surface area. They should also measure the angles to see if their drone really turned 90 degrees!

How can a gyroscope or gyro sensor work to predict something’s direction?

Did your gyro sensor perform as accurately as you thought it would? What do you think could change its accuracy?

Explain either one of your programs using pseudo-code.

Did you have any problems running your code? If so, what did you do to fix them?