In this lesson, we will show you how to use the DHT11 sensor module to work with a micro bit and display the real-time value on the I2C 1602 LCD screen.
Connect the DHT11 to the micro bit breakout as below:
|Micro bit Breakout||DHT11 sensor|
Connect the I2C 1602 LCD to the breakout board as below:
|Micro bit Breakout||LCD1602|
If you are not familiar to make code, don’t worry. At first, you can enter this link: https://makecode.microbit.org/reference to get the reference of microbit block.
Either copy and paste, or re-create the following code into your own MakeCode editor by clicking the open icon in the upper right-hand corner of the editor window. You can also just download this example by clicking the download button in the lower right-hand corner of the code window.
Overhere, the I2C address of this device is “0x27”, so we type “39” in the address bar.If your device I2C address is “0x3F”, please enter “63” to the address bar.About how to use the micropython with this display, please check https://github.com/shaoziyang/microbit-lib/tree/master/lcd/I2C_LCD1602.
After downloaded this code to your micro bit, pull out the USB line and insert the USB line to the expansion board, you will see “OSOYOO DHT 11” on the LCD screen, then you will see the real-time humidity and temperature data displayed on the LCD.
If the screen is not bright, please check the wires. If the screen is bright, but you do not see the above results, please check you I2C address.
Micro bit lesson — Using the I2C LCD 1602 Display: https://osoyoo.com/2018/09/19/micro-bit-lesson-using-the-i2c-lcd-1602-display/
Micro bit lesson — Using the DHT11 Sensor: https://osoyoo.com/2018/09/18/micro-bit-lesson-using-the-dht11-sensor/
DownLoad Url osoyoo.com