Display temperature and humidity measured by DHT11 connected to Micro:bit on I2C LCD display

Micro:bit 27-01-24
127 0

Tutorial plan

1- How does the Micro:bit card receive the data measured by the DHT11 sensor ?

2- The components required to use  the DHT11 sensor and the I2C LCD display by Micro:bit board

3- Mounting the Micro:bit board with the DHT11 sensor and the I2C LCD display

4- Program the Micro:bit board with Makecode to display the temperature and humidity measured by the DHT11 sensor on the I2C LCD display

 

 

How does the Micro:bit card receive the data measured by the DHT11 sensor ?

The Micro:bit is a small, programmable computer that includes a variety of sensors and features, including a built-in accelerometer and magnetometer. However, it does not have a native input for the DHT11 sensor, which is a sensor commonly used for measuring temperature and humidity.

If you want to connect a DHT11 sensor to a Micro:bit, you would typically use one of the Micro:bit’s general-purpose input/output (GPIO) pins. The DHT11 sensor has three pins: VCC (power), GND (ground), and a data pin. You would connect the VCC and GND pins of the DHT11 to the appropriate power and ground pins on the Micro:bit, and the data pin to one of the Micro:bit’s GPIO pins.

Once connected, you can use the Micro:bit’s programming environment, such as the Microsoft MakeCode editor or MicroPython, to read data from the DHT11 sensor. The DHT11 sensor communicates using a simple one-wire protocol, and you would need to implement the necessary code to read data from the sensor through the connected GPIO pin.

To display data measured by a DHT11 sensor on an I2C LCD display with a Micro:bit, you need to follow a few steps:

Connect the Hardware:

Connect the DHT11 sensor to the Micro:bit using appropriate GPIO pins (VCC, GND, and the data pin).

Connect the I2C LCD display to the Micro:bit.

Write Makecode Code:

Use the Makecode language to write code that reads data from the DHT11 sensor and displays it on the I2C LCD display.

The components required to use  the DHT11 sensor and the I2C LCD display by Micro:bit board

To display the temperature and humidity readings from the DHT11 sensor on I2C LCD display using the Micro:bit, you’ll need the following components:

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.

DHT11 Temperature and Humidity Sensor

The DHT11 is a basic, low-cost digital temperature and humidity sensor.

LCD I2C 1602 Display:

The LCD I2C 1602 display is a type of liquid crystal display (LCD) that utilizes the I2C (Inter-Integrated Circuit) communication protocol to interface with microcontrollers or other devices.

This display is used for displaying the temperature and humidity from the DHT11 sensor .

Jumper Wires:

Jumper wires

For making temporary connections and wiring between components.

Breadboard:

Test plate

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

Mounting the Micro:bit board with the DHT11 sensor and the I2C LCD display

Mounting the Micro:bit board with the DHT11 sensor and the I2C LCD displayMounting the Micro:bit board with the DHT11 sensor and the I2C LCD display

Mounting the Micro:bit board along with the DHT11 sensor and I2C LCD display can be done in various ways based on the preferences for the project’s permanence, aesthetics, and convenience. Here’s a suggestion on how to mount them:

Attaching the I2C LCD Display :

– connect the VCC pin of the display to 3.3V pin of the Micro:bit board

– connect the GND pin of the display to GND pin of the Micro:bit board

– connect the SDA pin of the display to P20 pin of the Micro:bit board

– connect the SCL pin of the display to P19 pin of the Micro:bit board

Mounting the DHT11 Sensor:

– connect the VCC pin of the DHT11 Sensor to 3.3V pin of the Micro:bit board

– connect the GND pin of the DHT11 to GND pin of the Micro:bit board

– connect the DATA pin of the DHT11 to P1 pin of the Micro:bit board

Program the Micro:bit board with Makecode to display the temperature and humidity measured by the DHT11 sensor on the I2C LCD display

Here are the general steps:

1- Add the Necessary Extensions:

Open the MakeCode editor (https://makecode.microbit.org/).

Click on the “Extensions” category in the toolbox.

Search for and add the “DHT11” extension to your project.

Search for and add the “LCD I2C” to find the I2C LCD extension.

2- Initialize the DHT11 Sensor and I2C LCD Display:

Use the “DHT11 initialize” block to set up the DHT11 sensor on a specific pin.

Use the “I2C LCD initialize” block to set up the I2C LCD display.

3- Read Data from DHT11 and Display on I2C LCD:

Use a loop to continuously read data from the DHT11 sensor.

Use the “DHT11 read data” block to obtain temperature and humidity values.

Use the ” show number” block to display the values on the I2C LCD display.

Here’s a simple example using MakeCode blocks:

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