Display - 7-segment display

.

Plugin details

Type: Display

Name: 7-segment display

Status ESP32: NORMAL CLIMATE

Status ESP8266: NORMAL CLIMATE

GitHub: P073_7DGT.ino

Maintainer: .

Used libraries: .

Description

The 7 segment display plugin allows to display date, time, temperatures, numbers, text and self-created shapes on a 7 segment LED display, using a TM1637, MAX7219 or 74HC595 driver.

Depending on the available space in the release, some features may not be available.

Currently 3 fonts are available for presenting text on the display, where the character shapes are somewhat different, and a choice can be made on what font is the most appropriate for the intended purpose. The numbers in the fonts are all equal.

When text to be displayed can’t fit on the width of the display (2, 3, 4, 5, 6, 7 or 8 digits), scrolling text can be used so longer messages are shown like a ticker-tape display. Scrolling is always from right to left, and optionally starts with an empty display, so text can be read as it scrolls in.

Optionally, periods in text can be shown on the dots of the display, when available (not all 7 segment display have dots).

For temperature display commands, 7dt,<temp> and 7ddt,<temp1>,<temp2>, the degree symbol after the temperature can be turned off so there’s room for 1 more digit of temperature on the display. The degree symbol is always turned off for 2 and 3 digit displays.

Configuration

../_images/P073_DeviceConfiguration.png
  • Name: In the Name field a unique name should be entered.

  • Enabled: When unchecked the plugin is not enabled.

  • 1st/2nd/3rd GPIO: How the display is connected can be configured here. Description per module type is in the Notes below the GPIO fields.

For the MAX7219 and 74HC595 displays, the DIN/SDI/DIO-Pin and (S)CLK-Pin can be shared when multiple displays are connected, but each display’s CS/LOAD/RCLK-Pin must be connected to a unique GPIO of the unit.

For TM1637 display possibly the DIN-Pin GPIO’s can be shared, but that’s untested, so it is more safe to use separate GPIOs for each display.

  • Display Type: Select the type of display that’s connected. 5 models are supported:

../_images/P073_DisplayTypes.png
  • Nr. of digits: If the Display Type 74HC595 is selected, and the page is submitted, this setting is made visible to select the number of digits available in the display used. These are the available options:

../_images/P073_NrOfDigitsOptions.png
  • 2: 2 digits, the smallest supported display

  • 2+2: 2 displays using 2 digits connected sequentially (SDO of first display to SDI of second display), making a total of 4 digits.

  • 3: 3 digits. The 2 and 3 digits displays use 2 or 3 74HC505 chips sequentially, to control a single digit per chip.

  • 4 multiplexed: 4 digits. The 4, 6 and 8 digit display use a multiplexed setup, using 2 74HC595 chips per board, 1 controlling the digit leds, and 1 controlling the digit selected. These multiplexed displays need to be refreshed continuously to properly display the intended data, causing some extra load on the ESP.

  • 2+3 / 3+2: 2 displays with 2 and 3 digits or 3 and 2 digits connected sequentially (SDO to SDI), effectively giving a usable display of 5 digits.

  • 6 multiplexed: 6 digits, multiplexed display.

  • 3+3: 6 digits, 2 boards with 3 digits connected sequentially (SDO to SDI).

  • 3+4 / 4+3: 7 digits, 2 boards with 3 and 4 digits connected sequentially (SDO to SDI).

  • 4+4: 8 digits, 2 boards with 4 digits connected sequentially (SDO to SDI).

  • 8 multiplexed: 8 digits, multiplexed display. This display, and the 4+4 combination, also supports the 7ddt command for displaying dual temperatures.

  • Display Output: Here the type of output can be selected:

../_images/P073_DisplayOutput.png

Manual: The content can be set from rules by using the commands available (see below)

Clock 24h - Blink: Displays the current time in 24h format, with a blinking colon or dot.

Clock 24h - No Blink: Displays the current time in 24h format.

Clock 12h - Blink: Displays the current time in 12h format, with a blinking colon or dot.

Clock 12h - No Blink: Displays the current time in 12h format.

Date: Displays the current date.

NB: Clock and Date outputs assume a time-source is available, f.e. the via NTP or External Time Source settings in Tools/Advanced, by connecting a GPS module, or via the ESPEasy P2P network.

The Clock and Date outputs are updated every second, and the blinking selections are 1 second on then 1 second off.

Clock and Date formats are optimized for each Display Type to fill the display efficiently, but won’t properly fit on the 2 and 3 digit displays.

  • Brightness: The brightness level of the display can be set here. 0 is ‘Default’ brightness, 1..15 from low to high brightness. Displays using 74HC595 ignore this Brightness setting!

  • Font set: Select the font set from this list:

../_images/P073_FontSet.png

Default: The original font as initially included in the plugin. Includes digits 0..9, special characters: space, dash, degree (when using a ^), equal sign, slash, underscore and letters A..Z. Uppercase and lowercase characters are shown exactly the same, but as the possible shapes are quite limited, some can be somewhat hard to recognize at first.

Siekoo: The character set as documented here Fakoo.de: Siekoo alphabet (See below for the extra special characters supported)

Siekoo with uppercase ‘CHNORUX’: This font is the same as the normal Siekoo character set, but supports uppercase versions for characters ‘CHNORUX’, even though they duplicate other characters in the set.

dSEG7: the character set as documented here Keshikan.net: dSEG7 special characters: space, dash, degree (when using a ^), equal sign, slash, underscore and letters A..Z. (Again single-case, like the default font)

Siekoo:

../_images/P073_SiekooSet.png

The four marked characters, Ä, Ö, Ü and ß, are not included, as they can not reliably be sent to the unit because of conversion issues from ASCII/UTF-8/ISO charactersets. And they are possibly not often used, except in German, and some closely related, languages.

dSEG7:

../_images/P073_dSEG7Set.png

The ^ character is again used to display the degree symbol, and the degree symbol is not recognized!

Options

  • Text show periods as dot: Enables the use of the display dots when periods are included in 7dtext,<text> command.

  • Hide ° for Temperatures: Will leave out the degree symbol from the display for temperature commands 7dt,<temp> (and 7ddt,<temp1>,<temp2> when available), allowing 1 more digit for actual temperature display. This option is enabled by default on 2 and 3 digit displays.

  • Suppress leading 0 on day/hour: When enabled, will show the hours of the time and days of the date without a leading 0 when < 10. (Not available in all builds for size reasons)

  • Use decimal dot for blink: When enabled will use the decimal dot on the second digit for blinking, when no colon is available. Not applicable for MAX7219 and TM1637 6-digit displays, as they already use alternative blink options.

  • Scroll text > display width: Normally the 7dtext,<text> command only show the left n characters the display can hold. This option enables the Scroll Text feature, that will scroll text sent using the 7dtext command (or 7dbin command when available) from right to left when the content is longer than the display can show at once.

  • Scroll text in from right: Normally the Scroll Text feature starts with the display filled with the left part of the text to scroll, with this option enabled, the display starts empty and the text is scrolled in from the right side of the display to the left, until all text is scrolled off. Then the scrolling restarts.

  • Scroll speed (0.1 sec/step): Determines the speed of scrolling the text. Default value is 10, so 1 character per second.

(The Scroll options and feature are not included in the Collection builds for size reasons)

Options for 8 digit displays (MAX7219/74HC595)

  • Right align Temperature (7dt): By default the temperature display on the 8 digit displays, is shown 1 position from the right side. This option enabled right-aligns the temperature.

Commands available

Command

Extra information

7dn,<number>

Example:

7dn,[BME280#Humidity] to display the humidity measured by a BME280 sensor.

Displays a numeric value on the display, with 1 decimal position if space allows.

7dt,<temperature>

Example:

7dt,[BME280#Temperature]

To display the temperature measured by a BME280 sensor. By default includes a ° symbol, unless option ‘Hide ° for Temperatures’ is enabled.

7ddt,<temperature1>,<temperature2>

Example:

7ddt,[BME280#Temperature],[DS18b20#Temperature]

To display two temperatures measured, f.e. by a BME280 sensor and a DS18b20 sensor. Applicable for the MAX7219 and 74HC595 8 digit displays, as the other devices don’t have enough digits to show 2 temperatures.

7dst,<hh>,<mm>,<ss>

Example:

7dst,%syshour%+6,%sysmin%,%syssec%

To display the time for a different time zone.

Can also be used to f.e. set the next appointment time externally.

7dsd,<dd>,<mm>,<yy>

To display a date.

7dtext,<text>

Examples:

7dtext,OUT [BLK#Temperature#d2.1]^

7dtext,HU. [BLK#Humidity#d2.1]^o Will result in ‘HU. 57.2°o’ being displayed (MAX7219 display and Siekoo with uppercase ‘CHNORUX’ font)

To display a text on the display. Any variable can be used. Unsupported characters (like accented letters) will show as a space (empty digit).

With the Scroll Text option disabled, the first n characters the display can show are displayed, if the Scroll Text option is enabled, longer texts will scroll from right to left across the display, at the set speed.

7dfont,<font>

Select a different font, either by name: Default or 7dgt for the original font (0), Siekoo for standard Siekoo font (1), Siekoo_Upper for the Siekoo font with uppercase ‘CHNORUX’ characters (2), and dSEG7 for the dSEG7 font (3). Numbers can also be used, 0, 1, 2, or 3 as noted. Fontnames are not case-sensitive.

7dbin,<byte>,...

Example:

7dbin,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x80

To display any bit pattern on the display.

The example shows each digit with a different segment on, including the dot/colon, and assuming either a MAX7219 - 8 digit, or Scroll Text enabled.

See explanation on how the bits map to segments, below.

7don

Turn the display on.

7doff

Turn the display off.

7db,<0..15>

Set the brightness to the provided level.

7output,<0..5>

Change the Display Output setting, available options:

  • 0 - Manual

  • 1 - Clock 24h - Blink

  • 2 - Clock 24h - No Blink

  • 3 - Clock 12h - Blink

  • 4 - Clock 12h - No Blink

  • 5 - Date

Bit to segment mapping for 7dbin command

The 7dbin command allows to show any combination of segments on the display according to a (sequence of) bit pattern(s).

../_images/P073_7Segments.png

The mapping from bits to segments is: 0Bhabcdefg (Based on the segment mapping for MAX7219 driver, for TM1637/74HC595 the pattern is converted into the correct bit-order)

ESPEasy allows decimal, hexadecimal and binary notation for numbers. This makes creating the desired display pattern easy when using the binary notation (starting with 0B or 0b).

Switching on all horizontal segments for a digit can be done by the command 7dbin,0b01001001. This can also be entered in hexadecimal notation: 7dbin,0x49

Change log

Changed in version 2.0:

added Major overhaul for 2.0 release.

added Display periods as dot option.

added Optional disable degree symbol for temperature display.

added 7ddt command.

added Select fonts to use for 7dtext command.

added Scroll Text option with configurable scroll speed.

added 7dbin command.

added 2021-10-05: 7output command.

added 2023-03-29: Optional suppressing of leading 0 for Hour and Day in Time and Date.

added 2024-07-26: Support for 74HC595 displays.

Added in version 1.0:

added Initial release version.