Major site overhaul: resources hub, content migration, new blog posts, forms
- Redesign /resources as sectioned hub with category pages - Migrate 645 Squarespace CDN images to local /images/content/ - Create 9 new news/blog posts with event photos - Fix blog post slugs (rename gibberish filenames) - Rename Design Blog to Design Blogs across site - Remove education page, replace with Platform in nav - Redesign rover repair request form with dynamic rover entries - Add school search combobox to contact, store, and repair forms - Extract shared KNOWN_SCHOOLS data - Make /rover-expansion-3d-printing dynamically pull from MDX - Add related resources sections to product pages - Fix homepage broken /quote links to /store - Store page: sample kit cards, inline quote builder, mailing list opt-in
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "The Gyroscope"
|
||||
date: "2021-06-24"
|
||||
categories: ["All", "Guides"]
|
||||
categories: ["All", "Sensor Guides"]
|
||||
tags: []
|
||||
excerpt: "Learn what the gyroscope is and how to code it."
|
||||
featuredImage: "/images/resources/gyroscope.gif"
|
||||
---
|
||||
|
||||

|
||||

|
||||
|
||||
The gyroscope is one of the five sensor types on the Micromelon Rover. The gyroscope is a component built into the Rover’s PCB (printed circuit board). It’s only about 2.5mm x 3.0mm wide and 0.83mm tall. This component also includes another sensor, the accelerometer.
|
||||
|
||||
@@ -17,7 +17,7 @@ The gyroscope is a device designed to detect how fast the rover is rotating and
|
||||
|
||||
### History of the Gyroscope
|
||||
|
||||

|
||||

|
||||
|
||||
A Traditional Gyroscope
|
||||
|
||||
@@ -29,9 +29,9 @@ The spin axis & rotor are designed to spin at a height speed. As the spin axis &
|
||||
|
||||
**No Motion**
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
*Gyroscope footage above sourced from the YouTube channel ScienceOnline.*
|
||||
|
||||
@@ -41,11 +41,11 @@ As we can see, when the gyroscope components are not in motion, gravity causes t
|
||||
|
||||
The gyroscope on the Rover is something called a microelectromechanical system (MEMS). A MEMS gyroscope mechanically works a lot different to a traditional mechanical gyroscope like the one’s we’ve seen already. It doesn’t have a spinning rotor and gimbal rings. Although a traditional gyroscope and a MEMS gyroscope mechanically work different, the fundamental physics is the same. There is a lot of marvellous engineering that go into MEMS gyroscopes. We won’t explain that here as it’s a bit too complicated for one blog post.
|
||||
|
||||

|
||||

|
||||
|
||||
To simplify things, let’s imagine inside the rover there is a traditional mechanical gyroscope that is constantly in motion (so it will always stay straight even against gravity). Around the gyroscope is a protractor. When the rover is flat on the ground, the the protractor aligns the gyroscope with 0 degrees. Let’s breakdown how this helps our rover determine rotation.
|
||||
|
||||

|
||||

|
||||
|
||||
- The rover starts flat. The 0th degree of the protractor is aligned with the gyroscope. This means there is no rotation.
|
||||
|
||||
@@ -61,25 +61,23 @@ In our example we can see the rover rotating on its side. The rover could also r
|
||||
|
||||
Using the gyroscope, our Rover can detect it is rotating but it can also tell us specifically in which direction it is rotating. It doesn’t make sense if the rover starts telling us “*Hey I am spinning left*”. Unfortunately, this isn’t clear enough. We need a simple way for us to understand and communicate the Rovers direction of rotation. This is what the 3 axis of movement are for.
|
||||
|
||||

|
||||

|
||||
|
||||
**The 3 Axis, X Y and Z**
|
||||
|
||||
The 3 axis are specific directions the rover uses. The **X axis **runs from back to front of the rover. The **Y axis** runs across the rover middle from left to right. The **Z axis** down and up through the Rover’s middle.
|
||||
**The 3 Axis, X Y and Z** The 3 axis are specific directions the rover uses. The ** X axis** runs from back to front of the rover. The ** Y axis** runs across the rover middle from left to right. The ** Z axis** down and up through the Rover’s middle.
|
||||
|
||||
The rover can rotate around all 3 axis. Below is a demonstration of rotation along each axis.
|
||||
|
||||
**X Axis Rotation**
|
||||
|
||||

|
||||

|
||||
|
||||
**Y Axis Rotation**
|
||||
|
||||

|
||||

|
||||
|
||||
**Z Axis Rotation**
|
||||
|
||||

|
||||

|
||||
|
||||
### Gyroscope Calibration
|
||||
|
||||
@@ -89,11 +87,11 @@ This irregularity is unfortunately unavoidable for the Rover’s built in gyrosc
|
||||
|
||||
**How To Recalibrate the Gyroscope**
|
||||
|
||||

|
||||

|
||||
|
||||
- Open the Code Editor and connect to the Rover you want to calibrate. If you need a refresher on using the Code Editor, check out the [Getting Started With The Micromelon Rover](/resources/getting-started-with-the-micromelon-rover) post
|
||||
|
||||
- In the Code Editor’s program menu, click the **Rover **button to open the dropdown.
|
||||
- In the Code Editor’s program menu, click the **Rover** button to open the dropdown.
|
||||
|
||||
- Select the **Sensor Calibration** option.
|
||||
|
||||
@@ -109,9 +107,9 @@ Open up the Code Editor, connect to a Micromelon Rover and open up the sensor vi
|
||||
|
||||
In the sensor view dialog, the gyroscope values are located in the bottom right table. The second column of the table is the gyroscope values & the third column is the accumulated gyroscope values. We’ll get into the difference between gyro vs accumulated gyro later. Move the rover around and take note of how the X, Y and Z values change.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
**Gyroscope or Accumulated Gyroscope Value?**
|
||||
|
||||
@@ -134,21 +132,19 @@ We know that there are 3 axis the rover can rotate around but should we rotate t
|
||||
|
||||
Let’s write a simple program to make our Rover make sounds when it rotates. As it rotates faster the sound will be higher pitched.
|
||||
|
||||

|
||||

|
||||
|
||||
- Start with our **While True** loop as our program will have to be repeated to keep getting live data.
|
||||
|
||||
- Let’s create a variable. You can do this from the **Variables** category. I’ll call my variable *gyro*.
|
||||
|
||||
- Let’s set the *gyro* variable to the **Read From Gyroscope** block. Change the dropdown to the **Z Axis**. You can find this block in the **Sensors** category.
|
||||
- Let’s set the *gyro* variable to the **Read From Gyroscope** block. Change the dropdown to the ** Z Axis**. You can find this block in the** Sensors** category.
|
||||
|
||||
The python command for reading the Z axis is **IMU.readGyro(2)**
|
||||
The python command for reading the Z axis is **IMU.readGyro(2)**- The Rover’s buzzer cannot read negative numbers so we must check if the Rover’s Z axis gyroscope value is negative. Let’s use an** IF** block. In the condition check if the *gyro* variable is less than 0.
|
||||
|
||||
- The Rover’s buzzer cannot read negative numbers so we must check if the Rover’s Z axis gyroscope value is negative. Let’s use an **IF** block. In the condition check if the *gyro* variable is less than 0.
|
||||
- Inside the **IF** block, when the condition is successful and the gyroscope value is a negative number we will update the *gyro* variable to ***gyro x -1*** using a multiplication block. This will ensure the *gyro *variable is always positive.
|
||||
|
||||
- Inside the **IF **block, when the condition is successful and the gyroscope value is a negative number we will update the *gyro* variable to ***gyro x -1*** using a multiplication block. This will ensure the *gyro *variable is always positive.
|
||||
|
||||
- Next, we drag out a **Play Sound at Hz** block from the **Lights/Sounds **category. Inside this we will place our *gyro* variable multiplied by 10 with another multiplication block. We multiply this gyro value, so the sound is more pronounced.
|
||||
- Next, we drag out a **Play Sound at Hz** block from the ** Lights/Sounds** category. Inside this we will place our *gyro* variable multiplied by 10 with another multiplication block. We multiply this gyro value, so the sound is more pronounced.
|
||||
|
||||
- Press Play!
|
||||
|
||||
@@ -158,21 +154,19 @@ While this code is running our rover will be making sounds depending on how much
|
||||
|
||||
Let’s write a similar program as we did above but now using our accumulated gyroscope.
|
||||
|
||||

|
||||

|
||||
|
||||
- Start with our **While True** loop as our program will have to be repeated to keep getting live data.
|
||||
|
||||
- Let’s create a variable. You can do this from the **Variables** category. I’ll call my variable *gyro*.
|
||||
|
||||
- Lets set the *gyro* variable to the **Read From Accumulated Gyroscope** block. Change the dropdown to the **Z Axis**. You can find this block in the **Sensors** category.
|
||||
- Lets set the *gyro* variable to the **Read From Accumulated Gyroscope** block. Change the dropdown to the ** Z Axis**. You can find this block in the** Sensors** category.
|
||||
|
||||
The python command for reading the Z axis is **IMU.readGyroAccum(2)**
|
||||
The python command for reading the Z axis is **IMU.readGyroAccum(2)**- The Rover’s buzzer cannot read negative numbers so we must check if the Rover’s Z-axis gyroscope value is negative. Let’s use an** IF** block. In the condition check if the *gyro* variable is less than 0.
|
||||
|
||||
- The Rover’s buzzer cannot read negative numbers so we must check if the Rover’s Z-axis gyroscope value is negative. Let’s use an **IF** block. In the condition check if the *gyro* variable is less than 0.
|
||||
- Inside the **IF** block, when the condition is successful, and the gyroscope value is a negative number we will update the *gyro* variable to ***gyro* x -1** using a multiplication block. This will ensure the *gyro *variable is always positive.
|
||||
|
||||
- Inside the **IF **block, when the condition is successful, and the gyroscope value is a negative number we will update the *gyro* variable to ***gyro* x -1** using a multiplication block. This will ensure the *gyro *variable is always positive.
|
||||
|
||||
- Next we drag out a **Play Sound at Hz** block from the **Lights/Sounds **category. Inside this we will place our *gyro* variable. We don’t need to multiply this value like we did with the previous example because the numbers we will get out of this data are much larger.
|
||||
- Next we drag out a **Play Sound at Hz** block from the ** Lights/Sounds** category. Inside this we will place our *gyro* variable. We don’t need to multiply this value like we did with the previous example because the numbers we will get out of this data are much larger.
|
||||
|
||||
- Press Play!
|
||||
|
||||
@@ -181,213 +175,3 @@ While this code is running our rover will be making sounds. As you rotate the ro
|
||||
### Wrapping Up
|
||||
|
||||
Now that we’re familiar with what the gyroscope is, how it works and how to program it, it’s time to start doing some activities. Try these activities that require using the gyroscope.
|
||||
|
||||
Resources
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/micromelon-code-editor-283)
|
||||
|
||||
Jun 4, 2025
|
||||
|
||||
[Micromelon Code Editor 2.8](/resources/micromelon-code-editor-283)
|
||||
|
||||
Jun 4, 2025
|
||||
|
||||
[Read More →](/resources/micromelon-code-editor-283)
|
||||
|
||||
Jun 4, 2025
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/build-guide-bulldozer)
|
||||
|
||||
Feb 20, 2025
|
||||
|
||||
[Build Guide: Bulldozer](/resources/build-guide-bulldozer)
|
||||
|
||||
Feb 20, 2025
|
||||
|
||||
[Read More →](/resources/build-guide-bulldozer)
|
||||
|
||||
Feb 20, 2025
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/build-guide-ping-pong-shooter)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Build Guide: Ping Pong Shooter](/resources/build-guide-ping-pong-shooter)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Read More →](/resources/build-guide-ping-pong-shooter)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/how-to-use-i2c)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[How to use I2C](/resources/how-to-use-i2c)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Read More →](/resources/how-to-use-i2c)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/build-guide-roborave-line-follow)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Build Guide: RoboRAVE Line Follow](/resources/build-guide-roborave-line-follow)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Read More →](/resources/build-guide-roborave-line-follow)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/guide-to-roborave-line-follow)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Guide to RoboRave Line-Follow](/resources/guide-to-roborave-line-follow)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
[Read More →](/resources/guide-to-roborave-line-follow)
|
||||
|
||||
Dec 31, 2024
|
||||
|
||||
### Related Posts
|
||||
|
||||
Resources
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/creating-a-sumo-unit)
|
||||
|
||||
[All](/resources?category=All)
|
||||
|
||||
[Creating A Sumo Unit For Your Digital Technologies Class](/resources/creating-a-sumo-unit)
|
||||
|
||||
[All](/resources?category=All)
|
||||
|
||||
How to run a sumo unit in your digital technologies classroom.
|
||||
|
||||
[Read More →](/resources/creating-a-sumo-unit)
|
||||
|
||||
[All](/resources?category=All)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/ultrasonic-sensor)
|
||||
|
||||
[All](/resources?category=All), [Guides](/resources?category=Guides)
|
||||
|
||||
[The Ultrasonic Sensor](/resources/ultrasonic-sensor)
|
||||
|
||||
[All](/resources?category=All), [Guides](/resources?category=Guides)
|
||||
|
||||
Learn all about the ultrasonic sensor!
|
||||
|
||||
[Read More →](/resources/ultrasonic-sensor)
|
||||
|
||||
[All](/resources?category=All), [Guides](/resources?category=Guides)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/year-7-digital-tech-at-st-peters)
|
||||
|
||||
[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)
|
||||
|
||||
[Case Study: Year 7 Digital Tech at St Peters Lutheran College](/resources/year-7-digital-tech-at-st-peters)
|
||||
|
||||
[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)
|
||||
|
||||
See how Meg Foley at St Peters conducted a challenge for their Year 7s using Micromelon.
|
||||
|
||||
[Read More →](/resources/year-7-digital-tech-at-st-peters)
|
||||
|
||||
[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/robot-simulator)
|
||||
|
||||
[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)
|
||||
|
||||
[Getting Started With The Robot Simulator](/resources/robot-simulator)
|
||||
|
||||
[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)
|
||||
|
||||
How to get started with the Micromelon Robot Simulator.
|
||||
|
||||
[Read More →](/resources/robot-simulator)
|
||||
|
||||
[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/getting-started-with-the-micromelon-rover)
|
||||
|
||||
[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)
|
||||
|
||||
[Getting Started With The Micromelon Rover](/resources/getting-started-with-the-micromelon-rover)
|
||||
|
||||
[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)
|
||||
|
||||
Crash course on basic rover function, how and what to program and starter activities to attempt.
|
||||
|
||||
[Read More →](/resources/getting-started-with-the-micromelon-rover)
|
||||
|
||||
[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/prison-escape)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All)
|
||||
|
||||
[Activity: Prison Escape](/resources/prison-escape)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All)
|
||||
|
||||
Learn branching and iteration using the colour sensors and motors.
|
||||
|
||||
[Read More →](/resources/prison-escape)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All)
|
||||
|
||||
Reference in New Issue
Block a user