Display - 7-segment display

.

Plugin details

Type: Display

Name: 7-segment display

Status: NORMAL

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 either a TM1637 or MAX7219 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 (4, 6 or 8 digits), scrolling text can be used so longer messages are shown like a ticker-tape display.

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.

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 displays, the DIN-Pin and CLK-Pin can be shared when multiple displays are connected, but each display’s CS-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. 4 models are supported:

../_images/P073_DisplayTypes.png

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 the NTP option is enabled in Tools/Advanced.

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.

Brightness The brightness level of the display can be set here. 0 is ‘Default’ brightness, 1..15 from low to high brightness.

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 dots 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.

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.

Options for MAX7219 - 8 digit

Right align Temperature (7dt) By default the temperature display on the MAX7219 - 8 digit display, 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 by a BME280 sensor and a DS18b20 sensor. Only applicable for the MAX7219 - 8 digit display, 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.

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 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 fot 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.

New in version 1.0:

added Initial release version.