Sharjah, UAE GST
Home/ Projects/ Lesson 4: Blind Zone & No Echo
Lesson 4 of 9 Sensing Beginner ◎ 25 min

Lesson 4: Blind Zone & No Echo

Find out where the sensor fails: too close, too far, too soft or at an angle. The LEDs and the Serial Monitor count each kind of reading.

Arduino Ultrasonic Distance & Parking Learning Kit
One of 9 projects in the Arduino Ultrasonic Distance & Parking Learning Kit — the parts below are from that kit.

Before you start

Time
25 min
Do these first
On your own
You can do this lesson on your own.

Exact parts

PartHow many
Wiring from Lesson 3 - nothing new
A book, a cushion or jumper, and a pencil (yours)

Not in the box

Nothing extra - just the kit and your computer.

What you build and learn

  • The blind zone right in front of the sensor
  • Why a missing echo is not the same as "nothing there"
  • Counting results with variables
  • Typing a command into the Serial Monitor

Very close up, the echo comes back before the sensor has finished sending, so the reading is wrong or missing. That is the blind zone.

No echo can mean the object is too far, too soft (fabric absorbs sound), too small, or tilted so the echo flies off to the side. It does NOT mean nothing is there.

In this lesson only, the LEDs mean something different: green = a good reading, yellow = too close (under 3 cm), red = no echo.

Three variables count each kind of reading. Type r and press Enter to set them back to 0 before each test.

New words

Blind zone
The space just in front of the sensor (about 2-3 cm) where it cannot measure properly.
Timeout
How long the code waits before giving up. Here 30 ms: after that we call it "no echo".
Variable
A named box that holds a number, such as goodCount. It can change while the sketch runs.

What this project uses

Every item is in the kit — nothing extra to buy.

Build this with

Arduino Ultrasonic Distance & Parking Learning Kit

All 9 parts in one box, with this project and 8 more to build from them.

AED 85.00 See the kit
Need only these parts? Order them loose · from AED 78.30
Used in this project tick what you still need
Also needed untick if you already have them
Selected parts AED 78.30

One of each part. Packs (resistor assortment, jumper wires) already hold more than a single build needs. red/yellow/green LEDs, Serial Monitor, the wiring from Lesson 3: included in the kit, ask us for it loose. Delivery is AED 20, free on orders AED 100+.

Connections

Unplug USB before you change any wire. Pin names are the labels printed on the board.

Lesson 4: Blind Zone & No Echo - connection diagram with labelled pins
Connection diagram, drawn from this lesson's pin plan - not a photo of a tested build. Tap to open it full size. The table below says the same thing in words.
Part / pinConnect toNote
No changesSame as Lesson 3LEDs 5, 6, 7 · buzzer 8 (kept silent) · TRIG 9 · ECHO 10

Step by step

One thing at a time. Tick nothing off until it matches the diagram.

  1. Upload the Lesson 4 code. No wiring changes are needed.
  2. Open the Serial Monitor at 9600 baud with "New Line" selected.
  3. Type r and press Enter. Hold a book 30 cm away for 10 seconds: green, and the good count goes up.
  4. Type r. Move the book right up to the sensor, 1-2 cm away. Watch for yellow (too close) or red - and wrong numbers.
  5. Type r. Point the sensor at a cushion or a soft jumper 30 cm away, then at a pencil, then at the book tilted to 45°.
  6. Type r. Point the sensor at an empty part of the room. Write down the counts after 10 seconds for each test.

Sketch for this project

Written for the board in the kit. Copy it into the Arduino IDE; change the pin numbers if you wire it differently.

lesson4_blind_zone.ino arduino
/*
  DIY KIT - Arduino Ultrasonic Distance & Parking Learning Kit
  Lesson 4 of 9: Blind Zone & No Echo

  WIRING: the sensor and LEDs from Lessons 1-3 (pins 5, 6, 7, 9, 10).
  The buzzer can stay connected - this sketch keeps it silent.

  IN THIS LESSON THE LEDs MEAN SOMETHING DIFFERENT:
    Green  = a good reading
    Yellow = too close (under 3 cm) - the sensor's "blind zone"
    Red    = no echo came back (too far, too soft, or angled away)
  The Serial Monitor (9600 baud) counts each kind of reading.
  Type r and press Enter to set the counts back to 0.
*/

const int RED_LED = 5;
const int YELLOW_LED = 6;
const int GREEN_LED = 7;
const int BUZZER_PIN = 8;
const int TRIG_PIN = 9;
const int ECHO_PIN = 10;

const int BLIND_CM = 3;                        // closer than this is the blind zone
const unsigned long ECHO_TIMEOUT_US = 30000;   // after 30 ms we call it "no echo"
const int MAX_CM = 400;

int goodCount = 0;
int blindCount = 0;
int noEchoCount = 0;

// Distance in cm, or 0 if no echo came back in time.
long readRawCm() {
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);
  unsigned long us = pulseIn(ECHO_PIN, HIGH, ECHO_TIMEOUT_US);
  if (us == 0) return 0;
  return us / 58;
}

void setup() {
  pinMode(RED_LED, OUTPUT);
  pinMode(YELLOW_LED, OUTPUT);
  pinMode(GREEN_LED, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(BUZZER_PIN, LOW);   // keep the buzzer quiet in this lesson
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  Serial.begin(9600);
  Serial.println("Lesson 4: Blind Zone & No Echo");
}

void loop() {
  // Type r + Enter to reset the counts.
  while (Serial.available() > 0) {
    char c = Serial.read();
    if (c == 'r' || c == 'R') {
      goodCount = 0;
      blindCount = 0;
      noEchoCount = 0;
      Serial.println("Counts reset");
    }
  }

  long cm = readRawCm();
  bool noEcho = (cm == 0 || cm > MAX_CM);
  bool blind = (!noEcho && cm < BLIND_CM);
  bool good = (!noEcho && !blind);

  digitalWrite(RED_LED, noEcho ? HIGH : LOW);
  digitalWrite(YELLOW_LED, blind ? HIGH : LOW);
  digitalWrite(GREEN_LED, good ? HIGH : LOW);

  if (noEcho) noEchoCount++;
  else if (blind) blindCount++;
  else goodCount++;

  Serial.print("cm=");
  if (noEcho) Serial.print("none");
  else Serial.print(cm);
  Serial.print("  good=");
  Serial.print(goodCount);
  Serial.print("  too_close=");
  Serial.print(blindCount);
  Serial.print("  no_echo=");
  Serial.println(noEchoCount);

  delay(200);
}
ℹCompiler-checked for Arduino UNO (0 warnings) and run in the kit simulator. Pins match the lesson diagram. Not yet bench-tested on the shipped parts.

Upload it

  1. Click Copy (or Download .ino and open the file).
  2. In the Arduino IDE choose File → New Sketch, select everything in it and paste.
  3. Check the bottom of the window says Arduino Uno and your port (Start here, step 5).
  4. Click Upload (the → arrow) and wait for Done uploading.

How the code works

In the codeWhat it does
const int BLIND_CM = 3;Readings closer than 3 cm count as "too close".
int goodCount = 0; ...Three counters. ++ adds one each time.
while (Serial.available() > 0)Reads anything you typed. If it is r, the counts go back to 0.
digitalWrite(BUZZER_PIN, LOW);Keeps the buzzer from Lesson 3 quiet in this lesson.

Change it and see

Change: Change BLIND_CM from 3 to 10.What happens: Yellow now comes on for anything closer than 10 cm.
Change: Change delay(200) to delay(50).What happens: The counts climb four times faster.

What you should see or hear

  • Green and climbing good counts with a flat book 30 cm away.
  • Right up close: yellow, red, or a number that is clearly wrong.
  • Soft, thin or tilted targets: more red (no echo), even though something is there.

If it doesn't work

ProblemWhat to check
Always redUnplug USB. Check VCC to the + rail, GND to the − rail, TRIG to pin 9 and ECHO to pin 10 - by the labels on the sensor, not their position. Point it at a big flat object 20-50 cm away.
Typing r does nothingClick in the box at the top of the Serial Monitor, type r, then press Enter. Check the speed is 9600 baud.
Yellow never lightsMany sensors give no echo rather than a small number when very close, so red is also a correct result.
The buzzer soundsUpload the Lesson 4 code again - it keeps pin 8 LOW.

Small experiment

Make a table: book, cushion, pencil, tilted book, empty room. For each, write good / too close / no echo after 10 seconds. Which target is hardest for the sensor?

Check what you learned

Does "no echo" mean nothing is in front of the sensor?

No. The object may be too far, too soft, too thin or tilted away.

Why can the sensor not measure 1 cm?

The echo comes back before the sensor has finished sending: that is the blind zone.

What do the LEDs mean in this lesson?

Green good reading, yellow too close, red no echo.

▶In the simulator: In the simulator every ping comes back unless the slider is past the sensor's range, so soft and tilted targets cannot be tried there - this lesson needs the real sensor.

Next

  • Lesson 5 measures exactly how accurate your sensor is, with a ruler and a spreadsheet.

Stuck?

Most problems are one wire in the wrong hole. Check these first:

  1. Unplug, then compare every wire with the lesson's diagram and table. One pin off is the most common problem.
  2. Sensor: are VCC, TRIG, ECHO and GND wired by their labels, with TRIG on 9 and ECHO on 10?
  3. LEDs: is the long leg on the resistor side?
  4. Is the − rail connected to a UNO GND pin, and the + rail to 5V?
  5. Serial Monitor: is it set to 9600 baud (and "New Line" when you type commands)?
  6. Upload problems: is Tools → Board set to Arduino Uno and Tools → Port to your UNO? (Start here, step 5.)
Still stuck? Ask us on WhatsApp. Send this message with a photo of your wiring - it tells us exactly where you are.
Hi DIY KIT, I'm stuck on the Arduino Ultrasonic Distance & Parking Learning Kit.
Lesson: __
Step number: __
What should happen: __
What happens instead: __
Error message (copied exactly): __
I'll attach a photo of my wiring.
Message us on WhatsApp

More from this kit

All projects →

Bot
ECHO
Online — usually replies instantly
Catalog assistant: verify final stock/price on the product page before checkout.