Sunday, July 19, 2009

Wise4Sure - Wise Clock with LED display from Sure Electronics

I was finally able to finish the "pre-prototype" of Wise4Sure, the version of Wise Clock that uses a 32x8 LED display from Sure Electronics. These LED matrices are single color (I have seen red, green and yellow so far), have a controller on board (Holtek1632) and can be bought for about US$10 (free shipping). Unbeatable. So, I could not resist the temptation of building Wise Clock around this display. Courtesy of Mr. Bill Westfield ("WestfW") who wrote the demo sketch (see here), displaying to the Sure LED matrix module becomes a trivial task. With a few small modifications (adaptations from the original 24x16 matrix to my 32x8), the sketch worked perfectly.

Another "improvement" is the introduction of the SD card. Previous versions of Wise Clock stored the text quotations in EEPROM, which had a few inconveniences:
- there was a limit of 32KB of storage;
- the process of loading the EEPROM was relatively complex and time consuming.

Replacing the EEPROM with an SD card solves these inconveniences and offers a few other advantages:
- quotations (or any message for that matter) can be changed/updated much easier, since it involves only the modification of a text file;
- quotations can be edited with a PC, directly on the SD card;
- there is no need to transfer the text, from a file on PC to Arduino, through serial port.

Integrating the SD card with Wise4Sure was the challenge. From h/w perspective, all SD solutions use the SPI (digital pins 10-13). As for the s/w, I opted for SDuFAT, from Arduino playground. It seems that this library is RAM hungry (I should mention that I did not look at the others, which may be as hungry). A big chunk of RAM, 512 bytes, is taken by the buffer that stores a sector after it is read from SD. (So, I assume that all other libraries should have this buffer as well).

After I eliminated some variables and functions which I did not use, everything (scrolling quotations) seemed to be working fine. Until I included the code for RTC (DS1307), when the returned time was consistently same bogus value. I narrowed the problem down to, again, memory (RAM) use. I adjusted my own text buffer a million times, until I got the RTC working. You may ask, as I did, what has the RTC got to do with the memory? Well, I can tell you, when the RAM is in "short supply", the time returned from RTC is just wrong (for example, "18:00" at all times). Keep in mind that RAM is consummed by the processor/program stack as well: the more functions are called, and the more parameters are passed, the more RAM is taken.

I said "pre-prototype" because, as SD card "shield", I used ladyada's Wave Shield. As for Arduino, I used my own Arduino clone, WiseDuino (just came up with the name, it used to be called Wise Clock, but this may lead to confusion). By the way, WiseDuino is now at revision 1.3 and the PCB is being manufactured by seeedstudio. I should be getting some boards soon and it seems that they will be also available for sale, under open source projects, from seeedstudio.com site.

In the end I got it working, so here it is in action (video).

The device is currently powered by 4 AA eneloop rechargeable batteries. The measured consumption is around 200 mA (as mentioned, using Wave Shield as SD card module). For practical purposes, this may require a wall wart power supply.

Next step is to build a real prototype, on perfboard, attached to the LED display board. Basically a whole Arduino, with an RTC and an SD card, with connectors for the LED display (pseudo) "shield".

8 comments:

  1. It looks great! Much easier to read long lines of text. I now have an 8x32 on it's way!
    I also like the idea of replacing an "EEPROM Loader" with a file on SD. Much easier to maintain.

    Along that line, I wonder if it will ever be possible to load a new sketch from the SD. I reckon you'd need something like SD -> Serial so the existing bootloader would work. Way beyond me though!

    Nice work!
    John

    ReplyDelete
  2. Thanks John.
    What you saw in the video is the most that can be done within the 2KB of RAM. I had a lot of trouble putting together SDuFAT and RTC/Wire libraries. Therefore, this version won't have IR remote control, menu options and other features (game of life, alarm etc) of the original Wise Clock. So much for using the SD library with Arduino.

    ReplyDelete
  3. Time for a Sanguino? (4K RAM)
    Yep, and it's the SD read ability that kills you - 512b sector read. The write-only libs are probably a lot smaller. Too bad you had to make so many cuts. How can one have feature bloat?

    ReplyDelete
  4. I think I should follow your suggestion and try the sanguino. I found a minimalist kit here: http://www.wulfden.org/TheShoppe/freeduino/rbfk.shtml, for only US$11. Fully compatible with the Arduino IDE.

    ReplyDelete
  5. I am playing with the same matrix as you and I would like to know you notice that when you are scrolling text some LEDS light up briefly, always leds that are near other leds that should be lighted up.

    If you don't have this "effect" I would be really interested if you could share your SRC as that would mean that I am doing something wrong in the communication.

    Thanks in advance

    ReplyDelete
  6. I noticed an effect similar to what you describe with some older displays from Sure, especially the red ones. Those may have problems.
    The ones I currently have work just fine with the code I wrote. (I always test the display before shipping it.)

    ReplyDelete
  7. Hello FlorinC!
    I've been following your work, along with the work of others you've mentioned here.

    I would totally buy your wise4sure kit, but due to some money limitations I have to keep it very low on the cost side. I was wondering if you could share the schematics with me. The display I'm working with is the 32x8. I basically would like to replicate your work with that implementation, but for that I need to learn how to work with the SD card from the quotes. I'm still using the ATmega168.

    Cheers from Honduras!

    ReplyDelete
  8. Rubens,
    You can find the schematic here:
    http://timewitharduino.blogspot.com/2011/01/wise-clock-2-now-with-redesigned.html

    Keep in mind that the board uses ATmega644. The software will not work on ATmega168 (nor ATmega328), because it is just too big.

    ReplyDelete