Ultrasonic Brick


Pictured with an HC-SR04 sensor fitted in its socket.
Smart Bricks · SKU TP-B03
HC-SR04 distance sensor made safe and simple – distance in mm over one cable.
₹499
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
- Socket for HC-SR04 (or 3.3 V RCWL-1601)
- Own 5 V booster for the sensor - no extra wiring
- Safe 5 V echo input, nothing can damage the board
- Distance in millimetres, up to 10 readings per second, median filter
- Temperature correction for the speed of sound
- I2C 0x36 / 0x37
Specifications
| Size | 56 x 32 mm |
|---|---|
| Range | 2 cm - 4 m (HC-SR04) |
| Voltage | 3.3 V in, 5.1 V for the sensor |
| Interface | I2C 0x36-0x37 |
| Brain | CH32V003 + MT3608 boost |
How to use it with TinkerPie
- Connect the brick’s BUS IN to any TinkerPie SENSOR 1-4 port with a 4-pin JST-PH cable.
- More bricks? Plug the next one into BUS OUT (or use the I2C Hub).
- 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 BrickTP-B01Connect any analog or digital sensor to TinkerPie – 4 ports, each analog, digital or PWM.₹499Pre-order
Line Follower 5TP-B02Five IR sensors in one bar – build a fast line-following robot in minutes.₹499Pre-order
5V Sensor BrickTP-B04For the 5 V parts: gas sensors, 5 V PIR, relays and fans – powered from a servo port.₹499Pre-order
Servo-16 BrickTP-B05Drive 16 servos for robot arms, legs and animatronics.₹499Pre-order