Build Your Kit page and full Micromelon website

Complete website build including:
- Build Your Kit store page with cart system, sectioned layout
  (Hardware, Software, Attachments, Spare Parts), inline quote
  request form, and sticky sidebar summary
- 16+ pages: Education, Platform, Resources, News, About Us,
  Download, Contact, Rover, Code Editor, Robot Simulator, etc.
- 89+ MDX resource articles and 18 news posts
- Store product images scraped from micromelon.com.au
- Quote request API route with Airtable integration
- Dynamic back links and cover photos on resource pages
- Redesigned downloads page
- Fixed corrupted MDX code blocks
This commit is contained in:
Tim Hadwen
2026-02-28 19:00:42 +10:00
parent 5233233662
commit 707c49dd3f
320 changed files with 22333 additions and 107 deletions

View File

@@ -0,0 +1,286 @@
---
title: "The Ultrasonic Sensor"
date: "2021-07-21"
categories: ["All", "Guides"]
tags: []
excerpt: "Learn all about the ultrasonic sensor!"
featuredImage: "/images/resources/ultrasonic-sensor.png"
---
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623914345952-12B4TG3EF3AT2EJMK5UW/the+ultrasonic+sensor.png)
The ultrasonic sensor is one of the fives types of sensors on the Micromelon rover.
**What Is It Used For?**
The ultrasonic sensor is used to detect the distance to the closest object in front of the sensor. The sensor is placed on the front of the rover, so we can detect if any obstacles (like walls) are in front of the rover, and how far away they are.
### **How The Ultrasonic Sensor Works**
To detect objects, the ultrasonic sensor uses sound. Ultrasonic sound is defined as sound waves at a frequencies higher than 20kHz. How does it detect objects by using sound? Simply by following the steps below.
**Ultrasonic Distance Sensing**
- The sensor makes the high pitched sound.
- The sound waves travel outwards from the sensor towards objects or surfaces in front.
- The sound waves hit and reflect off the object or surface back towards the sensor.
- The sound waves travel back towards the sensor.
- The sensor detects the returning sound waves.
**Based on how long it took the sound to bounce back, the sensor calculates how far away the object is using the speed of sound.**
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623904065305-QUNCZV7C94455QROTLIH/ultrasonic+animation.gif)
**The Parts That Make It Work**
The sensor is made up of two different components, **the transmitter** and **the receiver**. These are called transducers. The transmitter is making the ultrasonic sound and the receiver is listening for the reflected sound waves. Some ultrasonic sensors use a single transducer as both the transmitter and receiver.
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623894690691-R11ZI31O4Z1X6L6E55LF/sensor+detector.png)
**Why Cant Humans Hear The Sound?**
Ultrasonic sensors typically use frequencies between 30kHz and 500kHz. In the case of the Micromelon Rover, the sensor uses approximately 40kHz. In general, humans can only hear sounds up to 20 kHz.
Wanna know something cool though? If you take a video of the ultrasonic sensor when it is running, the cameras microphone will hear it. We can hear it playing back in the video. An example of this is on the right. Hear the ticking sound when the sensor is pointed at the microphone?
**Ultrasonic Sensors Exist in Nature!**
Echo location is another name for ultrasonic sensing. Bats and dolphins are just two examples of animals who use ultrasonic sensing to detect where they are going and where to find food.
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623905583690-XQDI2RJE7N1YWLH1DJD9/micromelon+dolphin.png)
Finley (above) works in Micromelon marketing
Finley (pictured) uses ultrasonic sensing to detect where pods of fish are in the sea when on lunch break. Unfortunately when I start yelling at lunch trying to find food, people get annoyed with me.
### **Ultrasonic Problems & Limitations**
**Sound Waves Reflected Away Or Absorbed**
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623911322898-F9S4N4COR6WB7NXCBLV9/incorrect+bounce+animation.gif)
When the emitted sound waves dont reflect back to our sensor we wont be able to get an accurate reading. This will happen when trying to detect angled or curved surfaces. Soft or textured surfaces can absorb the sound waves and reduce the range of the sensor.
To ensure you are able to get consistent readings, make sure the ultrasonic is pointed at flat, hard surfaces. A wide variety of surfaces will still be detected, but may be unreliable.
**Rover Ultrasonic Range Is Limited To Approximately 1m**
The further the sound waves need to travel, the quiter the echo becomes. If the echo becomes too quiet, the robot can no longer hear it and cant detect the object. In order for the sensor to detect more and more distant objects, the Rover needs to emit a louder sound, which requires more power.
### Programming The Ultrasonic Sensor
To write some code that uses the ultrasonic sensor, open the Micromelon Code Editor and connect Rover. You can use sensor view to see what the ultrasonic sensor is detecting. To open sensor view, click the ROVER button next to your Rovers name.
In the sensor view dialog, the ultrasonic value is located at the top of the rover diagram. The CM next to the value indicates centimetres. Point the ultrasonic sensor at different objects and watch this value to measure how far away they are.
**What does 255cm mean?**
255 is the returned value when the sensor is unable to detect an object. If you are seeing 255 it means you may be attempting to detect objects further away than 1m or because the sound waves are being absorbed or reflected away from the sensor.
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623908456123-SFLGD6EJY3YZD9ICDIIR/opening+sensor+view.gif)
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623909040619-5ZA8CEZZL843FDH8KQAA/using+sensor+mode+small+small.gif)
**Using The Ultrasonic In Code**
Lets write a simple program to print our ultrasonic sensor value every second.
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1623913882276-KLKLEA7H45FMUZPU3W9N/example+code.gif)
- Start by adding a **Print **statement. You can find this block in the **Utilities **category.
- Place our ultrasonic sensor read inside the print statement.
You can find the **Read Ultrasonic **block in the **Sensors** category. The Python command is **Ultrasonic.Read()**.
- Wrap this Print statement in a **While True Loop**.
- Add a **Delay For 1 Second** block so this loop waits 1 second before running again.
- Press Play!
While this is running we will see our ultrasonic value every second.
- You can now write other code that makes decisions based on the ultrasonic sensor.
### Wrapping Up
Now that were familiar with what the ultrasonic is, how it works, and how to program with it, its time to start doing some activities that use the ultrasonic sensor.
Resources
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1647214830941-XGY83MWLD0GDNDSCOF33/driving+school.png)
](/resources/driving-school-basics)
[Driving School Basics](/resources/driving-school-basics)
Learn the basics of rover motors and sensors while navigating Duck City.
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1645597438165-KTLM6ETLCY694N7E59ZV/spike-drop.png)
](/resources/spike-drop)
[Activity: Spike Drop](/resources/spike-drop)
Simulator activity for learning ultrasonic, colour sensor and iteration.
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1707816086925-3340QDPKLWEWZY20T5HC/maze.png)
](/resources/maze)
[Activity: Maze](/resources/maze)
Learn branching, iteration, algorithm design, and how to use the Rovers motors, ultrasonic, colour, and IR sensors.
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1707816124090-JAEYY3E5NGRDOMCLXOXE/Lane+guidance.png)
](/resources/lane-guidance)
[Activity: Lane Guidance](/resources/lane-guidance)
Learn iteration, branching, algorithm design, maths, and how to use the motors, ultrasonic, and IR sensors.
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1707816196956-OB33L2YRHUKHVQFOQE0D/puppy+bot.png)
](/resources/puppy-bot)
[Activity: Puppy Bot](/resources/puppy-bot)
Branching and looping with the ultrasonic sensor.
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1622686877131-P5FU2IDAB8U05PX8M98Z/sumo.png)
](/resources/sumo)
[Activity: Sumo](/resources/sumo)
Learn branching, iteration, algorithm design, and how to use the Rovers motors, colour, ultrasonic, and IR sensors.
### Related Posts
Resources
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1639455538805-9NI7CPKR7IYG6D4RBKAN/high+quality+sumo.png)
](/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)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464845856-BBPD7GTIIHHOSJCFORWF/the+ultrasonic+sensor.png)
](/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)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1625616494179-LZHZP5MUA0E0MQKEB7HC/cropped+image+4.png)
](/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)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464675848-K9YEOYK65IWRFRX4QJ1R/blog+header+image+.png)
](/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)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1626837419969-WBB4D85KQIXSOP750N5M/resized+banner+%281%29.png)
](/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)
[
![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1622691207784-0X6JV7RYRQXZAFRG712S/pisonescape.png)
](/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)