Display the temperature and light intensity measured by Micro:bit on the SSD1306 display

Micro:bit 18-01-24
161 0

Tutorial plan

1- How does the Micro:bit card measure temperature and light intensity ?

2- The components needed to display temperature and light intensity on the SSD1306 display

3- Micro:bit board wiring diagram with SSD1306 display

4- Program the Micro:bit card with Makecode to display temperature and light intensity on the SSD1306 display

 

 

How does the Micro:bit card measure temperature and light intensity ?

The Micro:bit board measures temperature and light intensity using built-in sensors. Here's a brief overview of how each measurement is typically carried out:

1- Temperature Measurement:

The Micro:bit includes a temperature sensor known as a thermistor or a temperature-dependent resistor (TDR). This sensor exploits the fact that the electrical resistance of certain materials changes with temperature.

As the temperature changes, the resistance of the thermistor changes accordingly. The Micro:bit measures this resistance and converts it into a temperature value using a calibration algorithm or lookup table.

The temperature reading is typically provided in degrees Celsius.

2- Light Intensity Measurement:

The Micro:bit features a light sensor, often based on a phototransistor or a photodiode. These sensors respond to changes in light by altering their electrical characteristics.

As the ambient light changes, the resistance or current of the light sensor changes. The Micro:bit measures this change and converts it into a value representing light intensity.

The light intensity reading is usually provided as a numerical value, with higher values indicating brighter light conditions.

When programming the Micro:bit, you can access these sensors using the available programming environments such as MakeCode or MicroPython. These environments provide blocks or functions to read values from the temperature and light sensors, allowing you to incorporate these measurements into your projects. Keep in mind that the actual hardware implementation might vary between different Micro:bit models, but the general principles for temperature and light measurements remain similar.

The components needed to display temperature and light intensity on the SSD1306 display

Micro:bit board:

Micro:bit board

The Micro:bit board is a small, programmable microcontroller board designed for education and beginner-friendly coding projects. It was developed by the BBC, in collaboration with various partners, as a tool to introduce young people to programming and electronics.

The GPIO expansion card for the Micro:bit card

The GPIO expansion card for the Micro:bit card

The GPIO expansion board for the Micro:bit board expands the capabilities of the Micro:bit board by adding more input/output (GPIO) pins and additional functionality.

SSD1306 display:

The SSD1306 display is a type of OLED (Organic Light-Emitting Diode) display that uses the SSD1306 driver chip.

Jumper Wires:

Jumper wires

To make the physical connections between the components.

Breadboard:

Test plate

A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering .

Micro:bit board wiring diagram with SSD1306 display

Micro:bit board wiring diagram with SSD1306 displayMicro:bit board wiring diagram with SSD1306 display

Connect the SSD1306 Display to your Micro:bit as follows:

1- Connect the SDA (data line) of the SSD1306 display to P20 pin of the Micro:bit board.

2- Connect the SCL (clock line) of the SSD1306 display to P19 pin of the Micro:bit board.

3- Connect the VCC pin of the SSD1306 display to the 3.3V pin of the Micro:bit board.

4- Connect the GND pin of the SSD1306 display to GND pin of the Micro:bit board.

Program the Micro:bit card with Makecode to display temperature and light intensity on the SSD1306 display

To program the Micro:bit to display temperature and light intensity on the SSD1306 display using MakeCode, you can follow these steps:

1- Open the MakeCode editor for Micro:bit: https://makecode.microbit.org/.

2- Add the SSD1306 extension:

3- Look for "Extensions" and click on it.

4- In the search box, type "muselab-oled-v2" to find the OLED extension.

5- Write the code to measure temperature and light intensity:

Use the blocks from the "Input" category to measure temperature and light intensity. These blocks are usually labeled "temperature" and "light level" and can be found in the "Input" section.

Add blocks from the SSD1306 extension to initialize the display and show the measured values.

Here's a simple example of code that measures temperature and light intensity and displays them on the SSD1306 display:

Download program

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info