Introduction: Ever wondered how stores automatically count how many people walk in, or how a production line keeps track of items?
In this project, we’ll build an Object Counter using an Infrared (IR) sensor and a 16×2 LCD display.
The IR sensor detects when an object passes in front of it, and the LCD shows the running count.
This project is perfect for automation, inventory tracking, and security systems.
Learning Outcomes:
By the end of this project, you will:
- Understand how an IR sensor detects objects.
- Learn to interface a 16×2 LCD display with Bit-Z.
- Use variables to store and update counts.
- Build a simple automated counting system.
Components Needed:
- BBC micro:bit
- Bit-Z
- IR Sensor Module
- 16×2 LCD
Circuit Connection:
On the Bit-Z board, we’ll connect:
IR Sensor Module to P0/P1/P2 and 16×2 LCD to LCD pin of Bit-Z
Code:

Open Make Code for micro:bit and create a new project. Add Bit-Z extension.
First we have to initialize the LCD then make a variable. Here I named it counter, you can name it anything as per your logic.
In forever, there is a condition if IR sensor detects an object then it will give 0 else it will give us 1. So if an object is there then first clear LCD then change counter(variable) by 1 then print on LCD “Count:” and then print the value of an object and wait for 250 milliseconds.