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,7 +1,7 @@
|
||||
---
|
||||
title: "The Colour Sensor"
|
||||
date: "2021-06-30"
|
||||
categories: ["All", "Guides"]
|
||||
categories: ["All", "Sensor Guides"]
|
||||
tags: []
|
||||
excerpt: "Learn what the colour sensor is and how to code it."
|
||||
featuredImage: "/images/resources/colour-sensor.gif"
|
||||
@@ -15,15 +15,15 @@ The Rover is designed to have three sensors to make it possible to attempt more
|
||||
|
||||
The colour sensors are designed to detect what colour they are currently facing. They are located on the underside of the rover so we can determine what colour the surface is that the Rover is driving over.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
### What Exactly is Light & Colour?
|
||||
|
||||
Before we learn about how the colour sensors work, let’s learn a bit more about what colour is. Colour as we see it on things around us like green in grass and brown in wood is produced by light. The visible light emitted by the sun or a light bulbs reflecting off of objects which makes it possible for us to see what colour they are. Light is actually made up of electromagnetic waves. The science behind electromagnetic waves and how we see them is complicated, for now all we need to know is they are types of light. Electromagnetic waves vary in length, similar to how there are big waves and small waves at the beach. The size of the electromagnetic wave determines what colour that light will be. All visible light we see with our eyes ranges from about 380nm (nanometres) to 750nm. Below is a diagram of the visible light spectrum.
|
||||
|
||||

|
||||

|
||||
|
||||
As we can see in our light spectrum, violets and blues are shorter electromagnetic waves at around 380-485nm and orange and reds have longer wave lengths at around 590-750nm.
|
||||
|
||||
@@ -31,7 +31,7 @@ As we can see in our light spectrum, violets and blues are shorter electromagnet
|
||||
|
||||
White is a colour but why is white on the colour spectrum? The reason it’s not there is because white light is actually what we are seeing when we see all coloured light at once. White light is the kind of light emitted from the sun.
|
||||
|
||||

|
||||

|
||||
|
||||
**White Light Becomes the Colour We See in Objects**
|
||||
|
||||
@@ -41,9 +41,9 @@ When white light is produced it travels outwards and hits things in the world. W
|
||||
|
||||
To detect what colour the colour sensor is facing, all the colour sensor has to do is detect what coloured light is being reflected off of that surface. Each colour sensor has 4 LEDs and a light detector. Let’s breakdown how these components work together to detect surface colour.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
- The colour sensor LEDs illuminate with white light (white light consists of all coloured light from the visible light spectrum).
|
||||
|
||||
@@ -51,9 +51,9 @@ To detect what colour the colour sensor is facing, all the colour sensor has to
|
||||
|
||||
- The reflected light travels away from the surface.
|
||||
|
||||
- The sensor detects the returning reflected coloured light.** **
|
||||
- The sensor detects the returning reflected coloured light. ** **
|
||||
|
||||
**The colour sensor determines what colour it is facing by detecting what coloured light is reflected off of the surface. **
|
||||
**The colour sensor determines what colour it is facing by detecting what coloured light is reflected off of the surface.**
|
||||
|
||||
### Colour Sensor Problems & Limitations
|
||||
|
||||
@@ -77,25 +77,23 @@ Open the Code Editor, connect to a Micromelon Rover and open up the sensor view.
|
||||
|
||||
In the sensor view dialog, the colour sensor values are located in the top right table. The table has a range of colour values. The top row contains the approximated colour the Rover colour sensors see.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
**Understanding The Values**
|
||||
|
||||
Unlike the ultrasonic sensor or IR sensor that have one default value, the colour sensors report to use a range of different values we can use in different scenarios. The left, middle and right sensor all return the same type of data. Each sensor has a **hue, red, green, blue **and **brightness** values. Let’s breakdown and understand the values that the sensors return.
|
||||
**Understanding The Values** Unlike the ultrasonic sensor or IR sensor that have one default value, the colour sensors report to use a range of different values we can use in different scenarios. The left, middle and right sensor all return the same type of data. Each sensor has a ** hue, red, green, blue** and ** brightness** values. Let’s breakdown and understand the values that the sensors return.
|
||||
|
||||
**Hue**
|
||||
|
||||
Hue is a way to define colour based on a range of 0 to 360. This range is based on the 360 degrees of a colour wheel. All colours that humans perceive are represented on a degree of the wheel. But where exactly are black and white? Hue is one component of the HSV (hue, saturation, value) colour model. The saturation and value components of the HSV colour spectrum help us demonstrate black and white. Our Rover only communicates the hue of a colour and not the saturation or value.
|
||||
|
||||

|
||||

|
||||
|
||||
**Red, Green & Blue (RGB)**
|
||||
|
||||
The red, green and blue values are in the range of 0 to 255. The red values show the amount of red light the sensor detects, blue values for blue light and green values for green light. A sensor facing a pure red surface will show a high red value and low green and blue values. A sensor facing a pure yellow surface will show a high red & green value but low blue value. This follows the logic of the RGB colour model where combining colours creates new colours. You can use the RGB values to determine what colour you are looking at.
|
||||
|
||||

|
||||

|
||||
|
||||
**Brightness**
|
||||
|
||||
@@ -105,17 +103,17 @@ Brightness is a value in the range of 0 to 255. The brightness value shows how m
|
||||
|
||||
Let’s write a simple program to make our Rover set its LED colour to the colour it currently sees from the middle colour sensor.
|
||||
|
||||

|
||||

|
||||
|
||||
- Start with our **While True** loop as this program will need to be repeated many times in order for the sensor to keep gathering data.
|
||||
|
||||
- Let’s get a **Set All LEDs** block from the **Lights/Sounds** category.
|
||||
- Let’s get a **Set All LEDs** block from the ** Lights/Sounds** category.
|
||||
|
||||
This block takes a colour block. We need a way to translate our colour sensor value to a colour block.
|
||||
|
||||
- In the **Colour **category there is a **Hue Colour** block. This will translate a hue value to a colour block. Place the **Hue Colour** block in the **Set All LEDs **block.
|
||||
- In the **Colour** category there is a ** Hue Colour** block. This will translate a hue value to a colour block. Place the ** Hue Colour** block in the ** Set All LEDs** block.
|
||||
|
||||
- Now we just get a hue value of our middle sensor and attach it to our **Hue Colour **block. In the **Sensors** category, grab the **Read Hue From Middle Colour Sensor** block and attach this to the **Hue Colour** block.
|
||||
- Now we just get a hue value of our middle sensor and attach it to our **Hue Colour** block. In the ** Sensors** category, grab the ** Read Hue From Middle Colour Sensor** block and attach this to the ** Hue Colour** block.
|
||||
|
||||
- Press Play!
|
||||
|
||||
@@ -124,213 +122,3 @@ While this code is running our rover will be changing its LEDs to match the colo
|
||||
### Wrapping Up
|
||||
|
||||
Now that we’re familiar with what the colour sensor is, how it works and how to program it, it’s time to start doing some activities. Try these activities that require using the colour sensors.
|
||||
|
||||
Resources
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/activity-rover-theremin)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Activity: Rover Theremin](/resources/activity-rover-theremin)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Read More →](/resources/activity-rover-theremin)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/line-following-h433h-89p7d-capak-lpsxl)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Activity: Seed Planter](/resources/line-following-h433h-89p7d-capak-lpsxl)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Read More →](/resources/line-following-h433h-89p7d-capak-lpsxl)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/activity-pingpong-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Activity: Ping-Pong Shooter](/resources/activity-pingpong-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Read More →](/resources/activity-pingpong-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/activity-forklift-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Activity: Forklift Attachment](/resources/activity-forklift-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Read More →](/resources/activity-forklift-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/activity-claw-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Activity: Claw Attachment](/resources/activity-claw-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Read More →](/resources/activity-claw-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[
|
||||
|
||||

|
||||
|
||||
](/resources/activity-digger-and-tipper-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Activity: Digger and Tipper](/resources/activity-digger-and-tipper-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
[Read More →](/resources/activity-digger-and-tipper-attachment)
|
||||
|
||||
[Activities](/resources?category=Activities), [All](/resources?category=All), [Simulator Activities](/resources?category=Simulator+Activities)
|
||||
|
||||
### 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