top of page

Micro:Bit Distance Detection With Ultrasonic Sensor and OLED

  • Mar 25
  • 2 min read


OLED Display

What it is: A small screen that displays text, graphics, or simple animations.

OLED = Organic Light-Emitting Diode.


Pins:

  • VCC/VDD - Power (3.3V or 5V)

  • GND - Ground

  • SCL - Clock signal (for I2C communication)

  • SDA - Data signal (for I2C communication)


Use case: Display sensor readings, status messages, menus, or simple graphics.


I2C (Inter-Integrated Circuit)

What it is: A communication protocol that allows multiple devices to talk to a microcontroller using only 2 wires.

How it works:

  • SCL (Serial Clock) - Timing/synchronization wire

  • SDA (Serial Data) - Data transfer wire

  • Multiple devices share the same 2 wires

  • Each device has a unique address (like 0x68 for MPU6050, 0x3C for OLED)

Advantage: You can connect many devices (OLED, sensors, etc.) using just 2 pins instead of needing separate pins for each device.



Ultrasonic Sensor (HC-SR04)

What it is: A distance sensor that uses sound waves (like sonar or bat echolocation) to measure how far away objects are.

Pins (typically 4):

  • VCC - Power (5V)

  • GND - Ground

  • TRIG (Trigger) - Send signal to start measurement

  • ECHO - Receives signal when sound bounces back

How it works:

  1. Sends out ultrasonic sound pulse

  2. Sound bounces off object

  3. Measures time for echo to return

  4. Calculates distance = (time × speed of sound) / 2

Range: Typically 2cm to 400cm


Micro:bit Breakout Board

What it is: An adapter board that makes it easy to connect the BBC micro:bit to other components.

Features:

  • Edge connector pins broken out - All micro:bit pins available as standard headers

  • Screw terminals or pin headers - Easy wire connections (no soldering needed)

  • Voltage regulation - Some boards provide 3.3V and 5V outputs

  • I2C pins clearly labeled - Easy to find SCL and SDA

  • Extra GND and power pins - Multiple devices can share power

 
 
 

Comments


bottom of page