Connection
O2 sensor – micro:bit
- Blue wire: Connect the sensor signal output to pin P0 on the micro:bit.
- Green wire: Connect the sensor signal output to pin P1 on the micro:bit.
- Red wire: Connect the power wire to the white strip. The sensor requires 3,3 V for proper operation.
- Black wire: Connect the ground (GND) to GND.
LCD display – micro:bit
- VCC: Connect the 3V3 output of the micro:bit - it provides power to the display.
- GND: connect to the ground pin of the micro:bit (GND).
- SCL: connect to the SCL pin of the micro:bit – this is the clock signal for communication over the I2C bus.
- SDA: connect to the SDA pin of the micro:bit – it is used to transfer data between the micro:bit and the display.
Always make sure the micro:bit is disconnected from power before connecting any devices to avoid damaging the electronics.
Program
Display of the measured quantity on the LCD display
After correct programming, the measured value from the O2 sensor will appear on the display.
- In the program we use the I2C interface to communicate with the sensor
- The correct measured value, after successful reading from the sensor, is stored in the variable Con2. We can work with this variable further
- The oxygen concentration is displayed on the connected LCD display and at the same time the information is sent via the serial interface to the PC. This data can be displayed using a suitable application.
- In the program, it is possible to change the display, for example using an LED display segment or another display element that allows us to display the measured quantity.




