001 - Brickcell LCD I2C | MakeCode Microbit
Introduction
Brickcell Development Kit comes with an LCD module which is a 16x2 LCD module with an I2C interface.
It has an alphanumeric dot matrix display screen, an HD44780 display controller developed by Hitachi, and a PCF8574T I2C to GPIO expansion IC which converts parallel IO to I2C. The LCD module can be access through 0x20
I2C address.
Working Details
- The I2C interface, can only work with 4-bit mode (no 8-bit mode support).
- Register Select (RS pin):
- Data register - is a register that contains what is displayed in the LCD
- Instruction register - is a register that contains instruction for the display controller.
- Read/Write (R/W pin):
- Reading mode
- Writing mode
- Enable pin
- Data bus (8 bits, bi-directional) pin
Hardware Instruction
Let's explore how to connect the LCD I2C to a micro:bit microcontroller and utilize MakeCode for programming.
- Connect the LCD GND pin to microbit GND pin.
- Connect the LCD VCC pin to microbit VCC pin.
- Connect the LCD SDA pin to microbit pin 20.
- Connect the LCD SCL pin to microbit pin 19.
Software Instruction
Now, let's start into programming the micro:bit to utilize the NTC temperature sensor.
- Login to https://makecode.microbit.org/ using your Microsoft account.
- Create a new project by clicking the "New Project" button. You may name it anything you want, I suggest to name it with descriptive name such as "lcd-i2c-test".
- Click the "Extensions" block just under the "Math" block.
- Type https://github.com/gbantique/brickcell-lcd-i2c/ on the search bar.
- Select the "brickcell-lcd-i2c" from the search results. The "lcd i2c" block should appear under the "Brickcell" block.
- Copy the code provided below.
1let loopCount = 0
2Brickcell.init(0)
3Brickcell.ShowString("Brickcell", 0, 0)
4basic.forever(function () {
5 loopCount += 1
6 Brickcell.ShowNumber(loopCount, 0, 1)
7 basic.pause(1000)
8})
Or you make a copy of my created project in your MakeCode workspace.
https://makecode.microbit.org/S97995-99534-94247-46039/
Expected Result
If you carefully follow the provided instruction above, you should be able to view a text character displayed in first line, the word "Brickell" and on the second line is counter value that increases every 1000 milliseconds.
References And Credits
Posts in this series
- 016 - Brickcell 8x16 Dot Matrix Display | MakeCode Microbit
- 015 - Brickcell 8x8 Dot Matrix Display | MakeCode Microbit
- 014 - Brickcell CO2 SGP30 | MakeCode Microbit
- 013 - Brickcell Gesture APDS9960 | MakeCode Microbit
- 012 - Brickcell Rotary Encoder | MakeCode Microbit
- 011 - Brickcell RTC DS3231 | MakeCode Microbit
- 010 - Brickcell Gyro MPU6050 | MakeCode Microbit
- 009 - Brickcell TOF VL53L0X | MakeCode Microbit
- 008 - Brickcell Color TCS34725 | MakeCode Microbit
- 007 - Brickcell Pressure BMP280 | MakeCode Microbit
- 006 - Brickcell Weight HX711 | MakeCode Microbit
- 005 - Brickcell Fine Dust | MakeCode Microbit
- 004 - Brickcell Ultrasonic HCSR04 | MakeCode Microbit
- 003 - Brickcell NTC Temperature | MakeCode Microbit
- 002 - Brickcell DHT11 | MakeCode Microbit
No comments yet!