====== lamaPLC: HT16K33 display controller ====== {{ :sensor:ht16k33_1.png?120|HT16K33 7-segment display}} The **HT16K33** is a memory-mapped, multi-function LED controller driver. The device supports a maximum of 128 display segments (16 segments and 8 commons) and a 13×3 Maximum matrix key scan circuit. The software-configurable features of the HT16K33 make it suitable for a wide range of LED applications, including LED modules and display subsystems. The HT16K33 is compatible with most microcontrollers and communicates via a two-line bidirectional [[com:basic_i2c|I²C]] bus. ===== HT16K33 IC Feature ===== * Operating voltage: **4.5V–5.5V** * Integrated RC oscillator * I²C-bus interface * 16×8-bit RAM for display data storage * Max. 16×8 patterns, 16 segments, and eight commons * R/W address auto-increment * Max. 13×3 matrix key scanning * 16-step dimming circuit * Supports 20/24/28-pin SOP package types |{{ :sensor:ht16k33_2.png?220|HT16K33 7-segment display}}|{{ :sensor:ht16k33_4.png?220|HT16K33 dot matrix display}}|{{ :sensor:ht16k33_5.png?220|HT16K33 dot matrix display}}| ===== I²C addressing ===== The base I²C address for an HT16K33 is **0x70**, but it can be changed to one of seven other addresses by setting the four address pins (**A0-A3**) via hardware. Each HT16K33 chip can have a unique address from **0x70** to **0x77**. If multiple HT16K33 devices are used on the same bus, each must have a distinct address, and if you use more than one, their addresses must be sequential, such as **0x70**, **0x71**, **0x72**.  {{page>:tarhal}} ===== Schema ===== 12*8 display application: (No INT pin function and 10*3 key function): {{:sensor:ht16k33_3.png|12*8 display application: (No INT pin function and 10*3 key function)}} ===== ==== Arduino Wiring Diagram ==== The HT16K33 uses standard I²C pins. Connect your display as follows: ^HT16K33 Pin^Arduino Uno Pin^Arduino Mega Pin^Description| ^VCC|5V|5V|Power (4.5V–5.5V)| ^GND|GND|GND|Ground| ^SDA|A4|20|Serial Data| ^SCL|A5|21|Serial Clock| ==== Required Libraries ==== You will need two libraries from Adafruit: * Adafruit LED Backpack Library * Adafruit GFX Library Install these via the Arduino Library Manager (//Tools > Manage Libraries...//). ==== Arduino Example Code ==== This sketch demonstrates basic numeric display and colon control using the [[https://github.com/adafruit/Adafruit_LED_Backpack|Adafruit_LED_Backpack]] library. #include #include #include "Adafruit_LEDBackpack.h" // Create the display object (Default I2C address is 0x70) Adafruit_7segment matrix = Adafruit_7segment(); void setup() { matrix.begin(0x70); // Initialize with I2C address matrix.setBrightness(10); // Set brightness from 0 to 15 } void loop() { // 1. Display a whole number matrix.print(1234, DEC); matrix.writeDisplay(); delay(2000); // 2. Display a floating point number matrix.print(12.34); matrix.writeDisplay(); delay(2000); // 3. Simple Counter with blinking colon for (uint16_t counter = 0; counter < 100; counter++) { matrix.println(counter); matrix.drawColon(counter % 2 == 0); // Blink colon every other tick matrix.writeDisplay(); delay(200); } } https://docs.arduino.cc/libraries/simple-ht16k33-library/ ===== Sources ===== https://www.digikey.com/htmldatasheets/production/2070902/0/0/1/ht16k33.html ===== I²C topics on lamaPLC ===== {{topic>i2c}} \\ \\ {{tag>i2c 7-segment_display display HT16K33 Arduino }} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}