Go Down

Topic: Library for many 7, 14 & 16 segment serial displays (Read 6974 times) previous topic - next topic

I added support for another HT16K33 based display:



This display supports displaying both decimal point and colon.


And the driver can now handle multiple HT16K33 displays on the same connections.

Added another HT16K33 display:



This display is fairly large with 1.2" or 3cm high digits, it would be fine for a wall clock. The display only has one colon, the 3 other dots are indicators.

I also added a TM1637 driver that supports indicators for colon for compatibility reasons.



See manual for full description: Manual and download

Paul__B

Care to cite where those last two displays are available?  I don't mind just playing with them if they are cheap.  Even better if other than red.

Care to cite where those last two displays are available?  I don't mind just playing with them if they are cheap.  Even better if other than red.
The first one is easy to find, use "ht16k33 module segment" as search on Ebay or Aliexpress, only in red.
For the other use "1.2 segment display" on Ebay, in red, yellow or green.


Paul__B

Hmmm.  Big one a bit pricey for my liking, but in the search I came across this:

Though it seems that particular seller does not want to ship it to most of the world!   :smiley-eek:

#20
Jun 25, 2019, 07:36 pm Last Edit: Jun 25, 2019, 07:45 pm by HKJ-lygte
.. but in the search I came across ...
I have that display on order from here, you can find it from many dealers. My library will not support it, it has 14 segments, not only 7. Depending on what I find of libraries, I may do another library for it, but that is a few months away (Ebay shipping time is that long).


I was a bit hasty saying my library would not support it. Looking a bit on the code it may not be that hard to do:
The segment data type must be moved to a #define, to be able to switch between byte and uint16_t.
It requires a new segment definition, I already have a couple of these.
The number, symbol and letter definition must switch to one for a 14 segment display, this is the only real work.

Then I, of course, need a driver to support the display, it may even use a chip I already know.

Paul__B

I have that display on order from here, you can find it from many dealers.
Better deal, but that crazy dealer won't send it to most of the world!

I may do another library for it, but that is a few months away (Ebay shipping time is that long).
Well, generally two to three weeks.

Then I, of course, need a driver to support the display, it may even use a chip I already know.
Lotsa luck, they're not telling!  :smiley-eek:

Better deal, but that crazy dealer won't send it to most of the world!
Search for "14 segment led module" maybe you get lucky with one of the dealers.


Well, generally two to three weeks.
Half of my parcels arrive after ebay have dropped them off the 60 days list.


Lotsa luck, they're not telling!  :smiley-eek:
It could be HT16K33, it is perfect for the job with up to 16 segment lines.

Paul__B

Search for "14 segment led module" maybe you get lucky with one of the dealers.
I have ordered a set of three (cheaper each) so will see how they go.  It seems (according to the descriptions) they are sold with different colours on the right and left digit (character) pair.  :smiley-eek:

Half of my parcels arrive after eBay have dropped them off the 60 days list.
That is a bit extreme.  You really must be "out in the sticks".

It could be HT16K33, it is perfect for the job with up to 16 segment lines.
Just as likely.

A new update of the library, with a few more displays included:


This display uses HC595 and just required a minor change in the HC595 driver



This is a large display (44mm) with static HC595 and a driver chip, due to the driver the data lines is inverted.


TM1638 displays also exist in a 4 digit version, I did not change anything to support this.

I have added a overview on how the software is build in the manual.

Manual and download

noiasca

it looks like you really dislike streaming or the Print.h ;-)

however I'll give it a try:
Some time ago I did a quick patch on the MAX7219 "Led Control Library" and enabled print (resp. write to be precise). I didn't make any "hardware" changes, so it uses the same bitbanging from the original library. My motivation came from the fact that I use 7 Segments also for displaying text (prompters for some numbers) and I wanted to have it consistent to "serial.print" or some LCD libraries.

The whole story can be found here http://werner.rothschopf.net/201904_arduino_ledcontrol_max7219.htm inkluding the library as ZIP.

Regarding:
Quote
clear();print(123);  // Display will flicker between clear and print, may or may not be visible
This is just a question of the implementation.
Also a lot of LCDs will "flicker" if you clear the content and reprint the same text over and over. Just do not clear and reprint the same content or give the user enough time to read (reduce refresh rate).

regarding:
Quote
setcursor(0,0);print(123);setcursor(0,0);print(56); // Display will show 563
use a pattern like:
 
Code: [Select]

lc.clearDisplay();lc.print(123);lc.clearDisplay();lc.print(56);


it will display 123 and afterwards 56 and NOT 563. (without flicker)

Yes, it will be left aligned - as any other text. If you need right aligned values you can
- do it old fashioned, print spaces if needed or use lc.setCursor(0,1)
- sprintf to a buffer and print the buffer
- implement a rightAlignedPrint (how ever - i would still to it based on write)
- implement printf

Using the Print.h makes it easy for beginners to print to displays in the same manner like they know already from Serial.print, from LCDs etc.

A minimalistic sketch (left aligned) looks something like
Code: [Select]

#include "NoiascaLedControl.h"

#define LEDCS_PIN             8       // LED CS or LOAD
#define LEDCLK_PIN            7       // LED Clock
#define LEDDATA_PIN           9       // LED DATA IN
#define LED_MODULES           2       // for best Demo you should use two modules witch 8 digits each

LedControl lc = LedControl  (LEDDATA_PIN, LEDCLK_PIN, LEDCS_PIN, LED_MODULES);

unsigned long delaytime = 250;

void setup() {
  Serial.begin(115200);
  Serial.println(F("Noiasca Led Control Example"));
  for (byte i = 0; i < LED_MODULES; i++)
  {
    lc.shutdown(i, false);
    lc.setIntensity(i, 8);
  }
  lc.clearDisplay();
  lc.print("Arduino");
  delay(delaytime*10);
}

void loop() {
  static uint32_t i;
  i=random(0,9999);
  lc.clearDisplay();
  lc.print(i);
  Serial.println(i);
  delay(delaytime);
}


Nevertheless, I must raise my hat to your efforts - your documentation is great

Signatur auf Pause

it looks like you really dislike streaming or the Print.h ;-)
Depends, it do not fit a 7-segment display where numbers are right adjusted and nearly always fit a fixed number of digits. There is also the point about 7-segments being mostly numeric, not alfanumeric. I wanted a library that could get the most from the digits with few calls.
There are many other places where streaming works perfectly.

But I did add a print function for people that really like to do stuff the cumbersome way.

One thing I did not check it with streaming libraries is how they handle a decimal point. I frequently use that on 7-segment display and my implementation of print handles it. I.e. places it on the previous digit, making decimal numbers show correctly.


Nevertheless, I must raise my hat to your efforts - your documentation is great
It is much easier to use a library when you have documentation. Here it is relevant for selecting display type and for the functions you can use.

noiasca

#28
Jul 11, 2019, 07:45 am Last Edit: Jul 11, 2019, 07:46 am by noiasca
One thing I did not check it with streaming libraries is how they handle a decimal point. I frequently use that on 7-segment display and my implementation of print handles it. I.e. places it on the previous digit, making decimal numbers show correctly.
agreed, support of decimal points essential.

admittedly it took me longer than expected, but in the end it's nothing more then a special character, which should activate the dot at the current position -1. An IF with three lines of code...
Signatur auf Pause

agreed, support of decimal points essential.

admittedly it took me longer than expected, but in the end it's nothing more then a special character, which should activate the dot at the current position -1. An IF with three lines of code...
That description may crash your program if you do: setCursor(0,0);print('.');
You need to be sure col>0 in your if statement.

My code looks like this:
Code: [Select]

  if (col > 0 && (c == '.' || c == ',')) {
    data[col - 1] |= digitDp;
    return 0;
  }


Go Up