Sunday, July 12, 2015

Experimenting with MAX6955

MAX6955 is an interesting LED driver chip. It is the primordial charlieplexing device, being the materialization of a technique invented by Charlie Allen of Maxim Integrated. Without understanding how charelieplexing works, it is actually counter-intuitive to wire multiple (up to 8) 16-segment displays to such a driver chip. Fortunately, Maxim has great documentation on how to do it.


My experimenting actually started with MAX6954. After many failed tries due to SPI issues (Maxim uses a special interpretation of the protocol, I read), I switched to MAX6955.

MAX6955 is the I2C sibling of MAX6954 (which uses SPI). They both have identical LED driving abilities, only the microcontroller interface part of the chips differ. Once, both chips were available in DIP-40 package. Now, MAX6955 only comes in SSOP-36 (MAX6954 is still available in DIP-40). Luckily, the pin configurations for the two chips are compatible, which allows for easy swap. For this reason, I designed a breakout board (shared at oshpark), so I can use the same setup I built for MAX6954.


Beside Maxim's, there isn't much documentation on how to control these chips. One of the reasons they are rarely used by hobbyists is probably their price (about $20 at digikey), although in the same range as the wildly popular MAX72xx LED driver (available at around $10 from digikey). In "reality", for some reason, MAX72xx could be had for $1 or less on ebay, unlike MAX6954/6955. Therefore, a hobby kit designed around MAX6955 would be "extremely" expensive compared with others using different LED driving chips (e.g. MAX72xx).

MAX6954/6955 was designed to drive common cathode LED displays, like MAX72xx. But unlike MAX72xx, it cannot be used for displays with common segments (which require multiplexing), like the ones below (and used here). MAX6954/6955 requires the 14/16-segment displays to be single digit/character, because not all segments will be wired together.


Below is the Arduino sketch I wrote that works very well with MAX6955. Although it uses a minimal set of commands, it is capable of displaying a character at a given position, light up the dot, and even scroll a long message.

A nice feature of the chip is that the fonts are predefined, this making it an "intelligent" display driver, like Avago's HDSP-2534. To display a character, only its ASCII code needs to be supplied.

#include "Wire.h"

#define ID_MAX6955 B1100000 
#define NUM_DISPLAYS 6

#define max6955_reg_decodeMode      0x01
#define max6955_reg_globalIntensity 0x02
#define max6955_reg_scanLimit       0x03
#define max6955_reg_configuration   0x04
#define max6955_reg_displayTest     0x07
#define max6955_reg_digitType       0x0C

int writeMAX6955(char command, char data)
{
    Wire.beginTransmission(ID_MAX6955);
    Wire.write(command);
    Wire.write(data);
    Wire.endTransmission();
}

void initMAX6955()
{
    Wire.begin();
    // ascii decoding for all digits;
    writeMAX6955(max6955_reg_decodeMode, 0xFF);
    // brightness: 0x00 =  1/16 (min on)  2.5 mA/seg;
    // 0x0F = 15/16 (max on) 37.5 mA/segment
    writeMAX6955(max6955_reg_globalIntensity, 0x07);
    // active displays: 0x07 -> all;
    writeMAX6955(max6955_reg_scanLimit, 0x07);
    // set normal operation;
    writeMAX6955(max6955_reg_configuration, 0x01);
    // segments/display: 0xFF=14-seg; 0=16 or 7-seg;
    writeMAX6955(max6955_reg_digitType, 0x00);
    // display test off;
    writeMAX6955(max6955_reg_displayTest, 0x00);
}

void setup()
{
  // set D8 and D9 to GND (for I2C address);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);

  initMAX6955();
  delay(100);
  clear();
//  writeDisplay("HI");
//  writeChar(0, 'A', true);
//  scrollDisplay("     HELLO WORLD", 300);
  writeTime(15, 24, 39);
}

void loop()
{
}

void writeDisplay(char* msg)
{
  for (byte i=0; i < NUM_DISPLAYS; i++)
  {
    if (i < strlen(msg))
      writeMAX6955(0x25-i, msg[i]);
    else
      writeMAX6955(0x25-i, ' ');
  }
}

void writeChar(byte pos, char letter, boolean dotLit)
{
  writeMAX6955(0x25-pos, (dotLit? 0x80 : 0) | letter);
}

void clear()
{
  for (byte i=0; i < NUM_DISPLAYS; i++)
    writeMAX6955(0x25-i, ' ');
}

void scrollDisplay(char* msg, int delayMs)
{
  for (int i=0; i<=strlen(msg); i++)
  {
    writeDisplay(msg+i);
    delay(delayMs);
  }
}

void writeTime(int hours, int minutes, int seconds)
{
  char h1 = (hours/10)? '0' + hours/10 : ' ';
  writeChar(0, h1, false);
  char h2 = '0' + (hours%10);
  writeChar(1, h2, true);
  char m1 = '0' + (minutes/10);
  writeChar(2, m1, false);
  char m2 = '0' + (minutes%10);
  writeChar(3, m2, true);
  char s1 = '0' + (seconds/10);
  writeChar(4, s1, false);
  char s2 = '0' + (seconds%10);
  writeChar(5, s2, false);
}

The I2C address of B1100000 was set by grounding AD0 and AD1 (see table 5 in the datasheet on how to change that address). In my setup, these 2 pins are connected to D8 and D9. Don't forget to pull-up SDA and SCL with 4k7-10k resistors.

The left-most digit is at position 0, accessible at address 0x25. "Digit 1" is the second from left, accessible at address 0x24, and so on. This is determined by the wiring. In my case, "CC0" (in the table 1 of this application note) represents the right-most display, and it is accessible at address 0x20.

Wednesday, July 8, 2015

LED driver chips

After looking at the many options for driving LED displays (5x7/8x8 matrix, 7/14/16/25 segment, common anode/cathode, single/bi-color/RGB), I put together this list of commonly used LED driver chips, to have a better picture of possible combinations, and use it as reference for future projects.


The bottom 5 rows are not actually LED drivers, just substitutes (require current limiting resistors).

Some of the driver chips (e.g. "8x8" in the "channels" column) provide internal multiplexing, being designed specifically for driving array of LEDs. The others, where "channels" is just one number, would require extra circuitry (e.g. transistors) and logic (micro controller code) for multiplexing.

The "CA" column indicates "common anode", "CC" stands for common cathode.

There seem to be more options for driving common anode LED displays, probably because sinking current (by the chips' LED outputs) allows for higher currents and also for using a separate power source (usually higher voltage) for the LEDs.


Tuesday, July 7, 2015

Wise Clock 4 with the new 3mm 3216 LED display from Sure

My inventory of "old" 3216 3mm displays from Sure Electronics is now depleted. As everybody already knows by now, Sure redesigned the display to be powered with 12V instead of 5V (plus a few other cosmetic changes).
The Wise Clock 4 board cannot be plugged into the new display's connectors anymore, since they are now different (10 pins instead of 16), and the assignment of signals to pins has changed as well.

Making a seamless Wise Clock 4 with the new display is still possible, with a little more soldering work. The board will be connected to the display using the ribbon cable provided. To do this, cut one connector off the ribbon cable, then solder 5 wires (4 signal + ground) from the cut end of the ribbon, in the place of the header, as shown in the photo below.


The 5V power line from the clock's board (red wire in the photo) will be soldered separately from the ribbon cable, bypassing the display's 5V regulator, as shown in the next photo.


The new display is "top heavy", that is, it has the connectors and the 5V regulator (with large capacitors and inductors) at the top. These may interfere with the clock's buttons and the SD card. To avoid touching them accidentally, it is better to position the display upside down, as shown in the next photo.


For this reason, the sketch needs a little tweaking: all pixel-related functions in HT1632.cpp file will have to change the coordinates, like this:

void ht1632_plot (coord_t x, int8_t y, byte color)
{
#ifdef WANT_UPSIDE_DOWN
  x = X_MAX-1 - x;
  y = Y_MAX-1 - y;
#endif
...
}

The macro WANT_UPSIDE_DOWN is defined in UserConf.h.

Also notice that the Wise Clock 4 board is now mechanically  fixed to the back panel (because it's not plugged in the display's connectors anymore).
Needless to say that the laser-cut plates for the two version of the displays are not compatible, since the displays' dimensions are different.


I will continue to provide a "complete kit" that includes the new display, the 2 plates, and the screws + standoffs. The back plate won't have the 2 holes (for the board) drilled though. This "complete kit" may not have the two 2x8 female headers (since they are not needed, and will even be detrimental). In case the headers are in the kit, DO NOT SOLDER THEM if you use the new display.
The processor in the "complete kit" will be loaded with the sketch for the new display, with the software modification mentioned above.

Monday, July 6, 2015

My impression of Akafugu Nixie Modular Clock

You are reading the first ever "review" of the Akafugu Nixie Modular Clock, a product yet to be released at the time of writing. Per, of Akafugu, generously offered to sell me the PCBs for this Nixie clock; the parts were sourced by myself.


The Nixie Modular Clock shares a big chunk of the schematic with its older sibling, the Akafugu Nixie Clock. The goal of this latest design is, I assume from the name, the "modularity". Similar to the VFD Modular Clock, "shields" for various types and numbers of Nixie tubes will probably be developed soon.

The hardware
This Nixie Modular Clock is an Arduino-based, open source project, designed around ATmega328 running on internal oscillator at 8MHz. Like the Akafugu Nixie mk3, the high voltage source (180-200V) uses the MC34063 DC-DC converter, and the driver for Nixies is HV5812. There are 3 buttons: 2 in the back, for setting up the time and alarm time, and another long-stem, protruding through the top board, for enabling/disabling the alarm. An orange LED in the front indicates if the alarm is active or not.
The PCB for the commercial version will be red, I was told (as shown below :).


Assembly
Building the clock is straightforward (as long as all parts are in hand, which will be the case when the kit becomes available). The assembly instructions are easy to follow and very clear, with lots of details and helpful photos. Some of the parts I picked (electrolytic capacitors, inductor) were a little too high, so I had an issue with the clearance between the 2 boards. I was able to "correct" that (meaning increase the distance between boards) by using long-legged headers lifted on male-headers plastic insulators (see the photo below).


I did not install the lamp between the hours and minutes. I was surprised to see that the unit-hours tube (second from left) blinks its decimal point!
The clock has also support for "background" LEDs (blue recommended), but I did not solder those either.

The software..
..is also open source and available here. A nice feature that every programmer will love is that it covers both Nixie Clock and Nixie Modular Clock (plus variants of the latter, like 6-tube clock) by using macro definitions. Not to mention that the code compiles and works without a glitch. It also has support for GPS.

Enclosure
Although I like the elaborate enclosure that Akafugu designed, I tried my own, by using simple plates to cover the exposed soldered pins, on both top and bottom. To me, the open sides are ok as long as small children don't stick their fingers (or grownups screwdrivers) in there :)
My suggestion is to make the top plastic plate of the enclosure (shown in akafugu's photo of the clock) transparent, rather than opaque black, which hides the elaborate design/silkscreen of the tube PCB.

Conclusion
I think that the Modular Nixie Clock will be another success. Its aesthetics, compact size and feature-rich software set a new standard in the world of Nixie clocks. Remember, most of the Nixie clocks one can buy on etsy, ebay or other sites, are non hack-able hardware or software. If you want one to tinker with, then Akafugu Modular Clock is for you.

Sunday, July 5, 2015

Introducing wsduino

This project is actually a revisit of my old Wiseduino, with the same goal: an Arduino-compatible with on-board Real Time Clock, and some extras (in this case, an XBee-like device, e.g. BTBee, GPSBee, WiFly). I renamed it "wsduino", although the pronunciation should remain the same :)

I redesigned wsduino mainly for the Axiris IV3 clock, whose enclosure allows for only 2 boards (Arduino + IV3 shield), with openings for power socket, USB, and no accessible buttons. Essentially, wsduino saves you an extra shield, which would have hosted the RTC (+backup battery) and the XBee.

 US$27 - free shipping to North America

wsduino is now available as a kit, as shown in the photo below.


The wsduino kit includes:
  • PCB
  • ATmega328 processor with bootloader
  • 28-pin socket
  • 16MHz crystal
  • 2 x 22pF capacitor
  • power jack
  • 7805 voltage regulator
  • 1N4001 diode
  • USB miniB socket
  • DS3231 RTC (SMD)
  • A1117 3V3 regulator (SMD)
  • CR1220 battery + holder
  • 4 x 10k resistor
  • 4k7 resistor
  • 3 x 100nF capacitor
  • 47uF/25V capacitor
  • 47uF/16V capacitor
  • 470uF/10V capacitor
  • 2 x 10-pin 2mm female header for XBee
  • 40-pin 0.1" female header
  • 3-pin header + jumper (selection of power source)

An FTDI breakout is required to upload sketches.

Although the assembly is quite trivial, I enumerate below the steps, for the detail-oriented :)
  1. solder the DS3231 SMD chip on the bottom of the PCB, making sure the chip orientation is correct;
  2. solder the A1117 chip, also on the bottom of the PCB;
  3. solder the resistors R1-R4 (their values are shown in silkscreen);
  4. solder the IC socket, with the correct orientation of the notch; then insert the ATmega328 chip (after you bent the two sides of pins on a flat surface, one side at a time, to become parallel);
  5. solder the crystal (orientation does not matter)
  6. solder the USB miniB socket;
  7. solder the 7805 voltage regulator to match its shape in silkscreen;
  8. solder the ceramic capacitors (orientation does not matter);
  9. solder the 3 electrolytic capacitors, paying attention to their orientation;
  10. solder the diode, also paying attention to its orientation;
  11. solder the power jack;
  12. solder the 2 XBee headers;
  13. cut, then solder, the extension headers;
  14. solder the battery holder, then insert the battery.
Schematic and board layout are shown below.



Here are some photos of the assembled board.

A  minimal wsduino is shown below, with the ATmega328 running on the internal oscillator at 8MHz, powered directly through the USB miniB socket.


The RTC (DS3231) and 3V3 voltage regulator are soldered on the bottom.


Perfect Arduino-compatible to quickly build a clock. Just add a display shield :)



Friday, July 3, 2015

Wiseduino Next Generation

You have a "tube shield" like the Axiris IV3 shield or the Nixie shield and you want to make a clock. You will definitely need an Arduino. You can either program it to (roughly) count the seconds, minutes, hours, or you can add an extra RTC, specialized in (accurate) time keeping, and program your Arduino to just get the time from RTC. The latter is Wiseduino, the first board I ever designed (also discontinued a long time ago). I badly needed one to finish the Axiris IV3 clock, since neither the software solution (second-counting) nor the hardware solution (adding a second RTC shield) was suitable. And so I re-designed it, improved on existing features (power, RTC) and added new ones (support for XBee/BTBee/GPSBee). This new version, spelled "wsduino" (but still pronounced "wiseduino") is shown below, next to the Axiris IV3 shield.


The wsduino board has an Arduino-compatible footprint, so it fits perfectly in the Axiris-designed-and-made enclosure (which I got as a gift from Nick :).


As you notice from the photo, the crystal is optional. Lately, I prefer to run the ATmega328 processor with the internal oscillator at 8MHz. The fewer the parts, the fewer the points of failure (and also cheaper). The wsduino board can be powered from either the USB miniB connector, or from the barrel connector, through a 7805 voltage regulator, selectable with a jumper. The board also has a 500mA 3V3 regulator, soldered on the bottom.

The DS3231 RTC is also soldered on the bottom. An XBee-footprinted serial device is connected to Rx/Tx of ATmega328, with voltage-divider level-shifting for Tx (pin D1). For the Axiris clock, I used the BTBee as a way to set the time and date, since the enclosure was not designed with buttons in mind. The sketch can be found here.


The photo below shows a couple of wsduino bare boards, top and bottom.


wsduino kit can be purchased here.