TINKER PiEDESIGN IN INDIA

Ultrasonic Brick

Smart Bricks · SKU TP-B03

HC-SR04 distance sensor made safe and simple – distance in mm over one cable.

₹499

Pre-order

Works with TinkerPie V1 · same JST-PH cables as the board · Delivery across India: ₹100, 3–7 days · 7-day replacement for damaged or defective kits

About this kit

The Ultrasonic Brick makes the popular HC-SR04 distance sensor plug-and-play on TinkerPie. It has its own 5 V booster for the sensor and a safe 5 V echo input, measures in millimetres up to 10 times per second with a median filter and temperature correction, and sends the distance over a single TinkerPie cable.

Features

Specifications

Size56 x 32 mm
Range2 cm - 4 m (HC-SR04)
Voltage3.3 V in, 5.1 V for the sensor
InterfaceI2C 0x36-0x37
BrainCH32V003 + MT3608 boost

How to use it with TinkerPie

  1. Connect the brick’s BUS IN to any TinkerPie SENSOR 1-4 port with a 4-pin JST-PH cable.
  2. More bricks? Plug the next one into BUS OUT (or use the I2C Hub).
  3. Install the TinkerPie and TinkerPieBricks Arduino libraries, open the sketch below, choose the board ESP32S3 Dev Module and upload.

Libraries: TinkerPie and TinkerPieBricks (Arduino IDE: Sketch → Include Library → Add .ZIP Library). Full guide: getting started with TinkerPie Bricks.

Quick start

Upload this, open the Serial Monitor at 115200 baud and watch the TinkerPie matrix.

Quick-start sketch (Arduino C++)
// Ultrasonic Brick (TP-B03): quick start
// Reads the brick and shows the value on the TinkerPie matrix and in the Serial Monitor (115200 baud).
#include <TinkerPie.h>
#include <TinkerPieBricks.h>
using namespace tinkerpie;

tpb::Ultrasonic sonar;

void setup() {
  Serial.begin(115200);
  tinkerpie::begin();            // also starts the SENSOR ports (I2C bus Wire1)
  if (!sonar.begin()) Serial.println("Ultrasonic Brick not found at 0x36: check the cable to SENSOR 1-4");
}

void loop() {
  uint16_t mm = sonar.mm();          // 0xFFFF = nothing in range
  if (mm == tpb::Ultrasonic::NONE) Serial.println("nothing in range");
  else { Serial.printf("%u mm\n", mm); led::plotBarGraph(mm, 1000, Colors::Cyan); }
  basic::pause(100);
}

Project: Parking sensor

Beeps faster as an object gets closer, like a car parking sensor. Under 10 cm the matrix turns red.

Parking sensor (Arduino C++)
// Parking sensor: Ultrasonic Brick (TP-B03)
// Beeps faster as an object gets closer, like a car parking sensor. Under 10 cm the matrix turns red.
#include <TinkerPie.h>
#include <TinkerPieBricks.h>
using namespace tinkerpie;

tpb::Ultrasonic sonar;

void setup() {
  Serial.begin(115200);
  tinkerpie::begin();            // also starts the SENSOR ports (I2C bus Wire1)
  if (!sonar.begin()) Serial.println("Ultrasonic Brick not found at 0x36: check the cable to SENSOR 1-4");
  sonar.rate(15);
}

void loop() {
  float cm = sonar.cm();                  // -1 = nothing in range
  if (cm < 0 || cm > 100) { basic::clearScreen(); basic::pause(100); return; }
  led::plotBarGraph(100 - cm, 100, cm < 10 ? Colors::Red : Colors::Green);
  music::playTone(cm < 10 ? 1500 : 900, 60);
  basic::pause(cm * 8);                    // closer = shorter gaps
}

More TinkerPie Bricks

IO-4 Smart Brick (TP-B01)IO-4 Smart BrickTP-B01Connect any analog or digital sensor to TinkerPie – 4 ports, each analog, digital or PWM.₹499Pre-orderLine Follower 5 (TP-B02)Line Follower 5TP-B02Five IR sensors in one bar – build a fast line-following robot in minutes.₹499Pre-order5V Sensor Brick (TP-B04)5V Sensor BrickTP-B04For the 5 V parts: gas sensors, 5 V PIR, relays and fans – powered from a servo port.₹499Pre-orderServo-16 Brick (TP-B05)Servo-16 BrickTP-B05Drive 16 servos for robot arms, legs and animatronics.₹499Pre-order

See all 53 TinkerPie Bricks