Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Wed Feb 20, 2013 3:20 pm

I have in mind a plan for a clock using the 16 x 24 red LED matrices sold as part no. 555 here.

Here's the thing. This is for my old "baba" (grandmother) who is nearly blind. I figure that each digit will use one display, so I will need (of course) four of these displays.

I have a few questions:
1) How much hardware will I need altogether? I already have an Arduino Uno, and I am planning on including a Chronodot. I figure that this will be accurate enough for Baba, and I know the Daylight Saving Time rules so I can program them in. I mention this because I imagine that the clock will remain within a very few minutes of the correct time for the rest of Baba's lifespan, so once it is assembled, there is no need ever for her to set the time. The alarm, though, is another matter. She should have one big button (arcade style is good) to stop the alarm. Family will need to be able to set alarm times, so I figure this plus one "hidden" button in the back of the clock will suffice. (Hidden so she doesn't mess up the alarm by accident.) And of course, some kind of buzzer or bell will be necessary (a mechanical bell would be perfect, I feel, but is not necessary).
2) How much juice will this thing need? Assume we have maximum display brightness, just in case she needs it that bright.
3) Assume I have the displays in "portrait" orientation. How will I program in my font? I mean, if I have something like this:
Code: Select all
@@@@............
@@@@............
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@......@@@@..
@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@
..........@@@@..
..........@@@@..
..........@@@@..
..........@@@@..
..........@@@@..
..........@@@@..
..........@@@@..
..........@@@@..

what sequence of bytes (or would it be 16-bit integers, or what?) would I program in to display this?
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by adafruit_support_bill on Wed Feb 20, 2013 3:43 pm

1) The UNO should be able to handle all the processing needed. You will need a bunch of interconnect cables to chain the displays. Check the product description for advice on how many interconnects you will need.

The chronodot is a good choice for a low-drift RTC. You may want to work out your alarm-setting logic before deciding on how many buttons you need. You might find that looking through the Monochron firmware is helpful.

Mechanical bells and buzzers are possible. You will likely need a transistor to drive them. Another alternative is a piezo buzzer. These can be driven direct from the UNO.

2) The displays will be the biggest current consumers. But the panels are multiplexed, so it is not as if you are driving all the LEDs simultaneously. Figure 16 LEDs @20 mA times 4 panels is 1280 mA. So the 5v 2A power supply should handle it.

3) For display, you can use our GFX library. You can draw the characters with either graphics primitives or the variable size text functions:
http://learn.adafruit.com/adafruit-gfx- ... primitives
User avatar
adafruit_support_bill
 
Posts: 25431
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Fri Feb 22, 2013 3:39 pm

adafruit_support wrote:1) The UNO should be able to handle all the processing needed. You will need a bunch of interconnect cables to chain the displays. Check the product description for advice on how many interconnects you will need.

The chronodot is a good choice for a low-drift RTC. You may want to work out your alarm-setting logic before deciding on how many buttons you need. You might find that looking through the Monochron firmware is helpful.

Mechanical bells and buzzers are possible. You will likely need a transistor to drive them. Another alternative is a piezo buzzer. These can be driven direct from the UNO.


Thank you for the advice. Really, I was thinking I only need one button, because I can use this scheme:

Show the hours using very large (24 pixels high by 16 wide) characters.
Show the minutes using smaller (20 high by 16 wide) characters.
Show the clock's seconds in tiny characters (5 pixels high by 4 wide) just below the minutes.

Hard-code a numeric password (the LOST numbers, for instance) into the code for the clock.
If you want to set the alarm, wait until the seconds are "04", then press the button; wait until the seconds are "08", then press the button again; wait until the seconds are "15", then press again; and similarly at "16", "23", and "42" seconds. Then you will find yourself in alarm set mode. The three alarm times would be shown one by one. If you wish to set an alarm, press the button when that alarm is showing. This will start the hours spinning ("00" to "23", then "OFF" to turn the alarm off, then back to "00"). Press the button to stop the spinning hours. Then, if you did not choose "OFF" for the hours, the minutes will spin ("00" to "55" by fives, then back to "00"). Press the button to stop the spinning minutes. Then the clock will say "OK", confirm that alarm time, then show the time of the next alarm (or "OFF" if that alarm is off), and so forth. If the clock scrolls through all three alarm times thrice without a button press, then it is back to normal time-display mode.

adafruit_support wrote:2) The displays will be the biggest current consumers. But the panels are multiplexed, so it is not as if you are driving all the LEDs simultaneously. Figure 16 LEDs @20 mA times 4 panels is 1280 mA. So the 5v 2A power supply should handle it.


What 5V 2A power supply? I see where Adafruit sells a 5V 1A power supply, but where is the 5V 2A power supply of which you speak?
Besides, how are the LEDs multiplexed? As 24 sets of 16 LEDs, or as 16 sets of 24 LEDs?

adafruit_support wrote:3) For display, you can use our GFX library. You can draw the characters with either graphics primitives or the variable size text functions:
http://learn.adafruit.com/adafruit-gfx- ... primitives


That does not in the least answer my question.
I have no interest in drawing circles, rectangles, etc. Also, as I said, I intend to use the displays in portrait orientation, so the text will come out sideways. As for the bitmaps, you don't say how they are to be arranged.
The "4" I showed you as an example, I chose because it was easy for me to draw immediately. A "5" or an "8" would not be so easy to draw, and no, I do not wish to use ugly, boxy, digital-clock digits; I would prefer to use digits that more closely resemble handwritten digits. This I have been working on using graph paper. I also understand the hexadecimal numeral system and would be able to convert the bitmaps to data for the Arduino, again, using pencil and paper.
Now. As for the "4" I gave as an example, would that start like this:
Code: Select all
0xF0, 0x00, 0xF0, 0x00, 0xF0, 0x3C, 0xF0, 0x3C, ...

or like this:
Code: Select all
0x00, 0x3C, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x3C, ...

or like this:
Code: Select all
0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x3F, 0xFF, 0xFF, ...

or how? The tutorial page gives no hint.
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by adafruit_support_bill on Fri Feb 22, 2013 3:57 pm

5v@2A: https://www.adafruit.com/products/276
Doing the same math for 16x24 or 24x16, 2A should be plenty.

And I think that you will find that the GFX library does indeed completely answer your needs. (If not the question as phrased). It has functions to rotate the display coordinates so you can do do portrait, landscape or even upside down if you want :D
User avatar
adafruit_support_bill
 
Posts: 25431
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Fri Feb 22, 2013 11:22 pm

adafruit_support wrote:5v@2A: https://www.adafruit.com/products/276
Doing the same math for 16x24 or 24x16, 2A should be plenty.

Sounds OK.

And I think that you will find that the GFX library does indeed completely answer your needs. (If not the question as phrased). It has functions to rotate the display coordinates so you can do do portrait, landscape or even upside down if you want :D

Does it use a 5x7 font or a 5x8 font?

Also, I see something funny here:
Code: Select all

void HT1632LEDMatrix::setPixel(uint8_t x, uint8_t y) {
  drawPixel(x, y, 1);
}
void HT1632LEDMatrix::clrPixel(uint8_t x, uint8_t y) {
  drawPixel(x, y, 0);
}

void HT1632LEDMatrix::drawPixel(uint8_t x, uint8_t y, uint8_t color) {
  if (y >= _height) return;
  if (x >= _width) return;

  uint8_t m;
  // figure out which matrix controller it is
  m = x / 24;
  x %= 24;

  uint16_t i;

  if (x < 8) {
    i = 7;
  } else if (x < 16) {
    i = 128 + 7;
  } else {
    i = 256 + 7;
  }
  i -= (x % 8);

  if (y < 8) {
    y *= 2;
  } else {
    y = (y-8) * 2 + 1;
  }

  i += y * 8;

  if (color)
    matrices[m].setPixel(i);
  else
    matrices[m].clrPixel(i);
}

So... drawPixel calls setPixel and clrPixel; and both setPixel and clrPixel call drawPixel... ??
How does this not end up in an infinite loop?

Again, I would like to use my own bitmaps for the digits, and I would prefer not to have to set each and every pixel individually.
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by adafruit_support_bill on Sat Feb 23, 2013 10:28 am

The standard font is 5x8 and can be scaled. You are free to replace it with your own font of any size. Or if you prefer, you can use the drawBitmap primitive.

http://learn.adafruit.com/adafruit-gfx- ... primitives

And there is no infinite recursion. SetPixel on the logical display object is not the same as setPixel on the display controller object.
User avatar
adafruit_support_bill
 
Posts: 25431
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Sat Feb 23, 2013 12:47 pm

adafruit_support wrote:The standard font is 5x8 and can be scaled. You are free to replace it with your own font of any size. Or if you prefer, you can use the drawBitmap primitive.

http://learn.adafruit.com/adafruit-gfx- ... primitives

Okay, this is starting to feel like a vaudeville sketch.

Tell me: at what part of my image (top left corner, or what?) is the bitmap data supposed to begin, and in which direction (up, down, left, or right?) do I start listing bits?

Also, what happens if the total number of bits in my image is not divisible by 8?
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by adafruit_support_bill on Sun Feb 24, 2013 7:24 am

Okay, this is starting to feel like a vaudeville sketch.

Yes, bt who iis the straight man? :D

Tell me: at what part of my image (top left corner, or what?) is the bitmap data supposed to begin, and in which direction (up, down, left, or right?) do I start listing bits?
Also, what happens if the total number of bits in my image is not divisible by 8?

Code: Select all
void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
               const uint8_t *bitmap, int16_t w, int16_t h,
               uint16_t color) {

  int16_t i, j, byteWidth = (w + 7) / 8;

  for(j=0; j<h; j++) {
    for(i=0; i<w; i++ ) {
      if(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) {
   drawPixel(x+i, y+j, color);
      }
    }
  }
}


Assuming no rotation, you would put them in row-major order rounded up to the next byte.
User avatar
adafruit_support_bill
 
Posts: 25431
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Mon Mar 11, 2013 11:37 pm

All right, I got the displays. I have done some work on the clock.

Here, you can see a video of the "minutes" part of the clock:
http://www.youtube.com/watch?v=Rrwj5QU5Dfw

I have some comments to make about the relevant software.
https://github.com/adafruit/HT1632
First, the adafruit library for these particular displays does not behave in the manner adafruit_support described. In particular:
* The drawBitmap function uses neither row-major nor column-major order, but rather splits the image into horizontal strips each 8 pixels high, and the pixels within each strip are taken care of in column-major order. If the height of the image is not an exact multiple of 8 pixels, some PROGMEM will be wasted.
* The setRotation function is missing.

I have modified the adafruit software as in the attachment. Also attached is what the Arduino is actually running.
Attachments
clock_minutes.zip
(4.89 KiB) Downloaded 45 times
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Sat Apr 20, 2013 10:58 pm

Since my last post, I have done more work on this clock.
rats_nest_clock.jpg
The clock, with all 4 displays in use
rats_nest_clock.jpg (159.25 KiB) Viewed 1042 times


As you can see, I have 4 displays working, and showing a "demo screen" with the date, weekday (ISO format) and time.

Based on a discussion I started on the Arduino forums, it seems I am having trouble with the power supply.
The discussion is here: http://arduino.cc/forum/index.php/topic,161684.0.html

Has Adafruit anything to add?
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by adafruit_support_bill on Sun Apr 21, 2013 6:14 am

Can you measure the actual current draw for your setup?
User avatar
adafruit_support_bill
 
Posts: 25431
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Sun Apr 21, 2013 10:17 am

adafruit_support_bill wrote:Can you measure the actual current draw for your setup?


How?

I hope I can get this solved.
If I can't, can I just take the whole thing, put it in a box, ship it to Adafruit, and receive either a refund or a replacement of defective components?
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by adafruit_support_bill on Sun Apr 21, 2013 10:44 am

If there are defective components we will replace them. But we need to determine the nature of the problem first. DIY projects do require some basic diagnostic skills like measuring current.

Set your multimeter to the high current (usually 10A) range and connect your leads to the common and the high-current connectors. Detach one side of your 5v supply and connect your meter in between the power supply and the circuit. See this guide for details: http://learn.adafruit.com/multimeters/current
User avatar
adafruit_support_bill
 
Posts: 25431
Joined: Sat Feb 07, 2009 9:11 am

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by odometer on Sun Apr 21, 2013 10:55 am

Okay, I think I know what the problem is.

I didn't do any measuring, but I did some more careful reading.

On the page at http://arduino.cc/en/Main/arduinoBoardUno I found this text:

The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
(emphasis mine)

So... it looks like the folks at the other forum were right about the power supply being inadequate. What they (and I) missed was that the problem isn't insufficient amps, but rather it is insufficient volts.

And all this time I was using the wrong voltage.
odometer
 
Posts: 98
Joined: Sun Aug 21, 2011 10:01 pm

Re: Using 4 pcs. of 16x24 red LED matrix (item no. 555)

by CJansen on Mon Apr 22, 2013 6:36 am

You might take a look at this page, It is all about 4 or 8 matrices and how to hook them up.
The bottom line of pictures is about 8 matrices and the connections.
It shows also the back of the panels, I din't remove any solder blobs at all.
They were lit up via the USB of the PC, I do not recommend it, but it worked on my PC so far.

http://www.cjansen.net/Cor/Fix-Things/4Matrices.htm

If you have any questions about it let me know, glad to be of any help.
If you never try anything, you get nowhere.
User avatar
CJansen
 
Posts: 36
Joined: Fri May 11, 2012 2:30 pm