Close

Competition

A project log for D1 Mini Matrix Shield

A shield for the D1 Mini ESP8266 board with HT16K33 chip and 8x8 mini LED matrix.

deʃhipudeʃhipu 05/28/2017 at 01:575 Comments

As they say, be careful what you are wishing for, you might get it. My main motivation for making all those D1 Mini shields and selling them is to make this functionality available -- first from my @Tindie shop, and then, hopefully, from Aliexpress and eBay, as it gets cloned and manufactured cheaply.

Recently WeMos, the very company that makes the D1 Mini boards, has introduced a new product -- a 8x8 LED matrix shield similar to what I have been making here. Here's a link: https://www.aliexpress.com/store/product/Matrix-LED-Shield-V1-0-0-for-WEMOS-D1-mini/1331105_32812932291.html -- thanks to @davedarko for the tip!

However, this is not a clone of my shields. It's a complete re-make of the idea, with a different chip on board, using different pins and protocol for communication, and not software compatible. As far as I can tell there are not libraries or code examples for it.

I ordered one out of curiosity and will experiment with it, but for now let's see what I we can infer from the photos. The chip used is AIP1640, which seems to be a cheap clone of the TM1640 LED driver, produced by http://titanmec.com/. There seem to be no English datasheets for it, but there is one in Chinese available from http://titanmec.com/index.php/product/view/id/305/typeid/59.html

This chip can drive up to 8x16 LEDs, so only half the outputs are used for driving the 8x8 matrix -- you could drive a double or bi-color matrix with it (like this one: https://www.aliexpress.com/item/8x8-LED-Red-Green-Dual-Color-Dot-Matrix-Display-Module-TM1640-for-Arduino/32476051733.html). The inputs are connected to D1 Mini's MOSI and SCK pins through transistors, because it's a 5V device. The protocol it uses for communication is a weird mix of SPI and I²C: you send serial data, but because there is no chip-select pin, you denote start of transmission with I2Ć-like start condition. There are no addresses, though -- the device basically owns the pins it is connected to all the time. The driver does support PWM, but you can only change the brightness of the whole matrix, and not individual pixels.

There seems to be an Arduino library for the TM1638, that also supports TM1640, but it seems to be only for 7-segment displays. The library can be found here: https://github.com/rjbatista/tm1638-library

Speaking of the TM1638, I can't understand why they didn't use that chip, or one of the other LED driver chips manufactured by Titanmec (they have quite an interesting offer, see http://titanmec.com/index.php/product/lists/typeid/59.html). For instance the TM1629 or TM1638 (http://titanmec.com/index.php/product/view/id/303/typeid/59.html, English datasheet at https://retrocip.cz/files/tm1638.pdf) -- it's smaller, supports 8x8 LEDs and uses a proper SPI protocol that plays nice with other devices. Or use the venerable HT16K33, which is well tested, has proper I2C and already has a lot of existing libraries. I suspect they got a really good deal on those clones...

Perosnally, I find the TM1680 particularly interesting, as it should be capable of driving an RGB matrix with I2C: http://titanmec.com/index.php/product/view/id/393.html

In the mean time, I will keep selling my own matrix shields on Tindie -- they can't compete with these price-wise, but I think they are much easier to use, at least for now.

Discussions

Stanislav Borutsky wrote 07/18/2017 at 11:13 point

Actually, there is an Arduino library for those WeMos 8x8 LED shields (that available on AliExpress) : https://github.com/wemos/WEMOS_Matrix_LED_Shield_Arduino_Library

I found no micropython lib on the net, so I decided to port it myself - here is the code:

from machine import Pin;

class MLED:


  def __init__(self, dataPin=13, clockPin=14): # D7(data), D5(clock)
    self.dataPin  = Pin(dataPin, Pin.OUT, value = 1)
    self.clockPin = Pin(clockPin, Pin.OUT, value = 1)
    self.intensity = 4
    self.buf = [0,0,0,0,0,0,0,0]


  def send(self, data):
    for i in range(8):
      self.clockPin.off()
      self.dataPin.value((data >> i) & 1)
      self.clockPin.on()


  def sendCommand(self, cmd):
      self.dataPin.off()
      self.send(cmd)
      self.dataPin.on()
    
  def sendData(self, address, data):
      self.sendCommand(0x44)
      self.dataPin.off()
      self.send(0xC0 | address)
      self.send(data)
      self.dataPin.on()


  def display(self):
    for i in range(8):
      self.sendData(i, self.buf[i])
      self.dataPin.off()
      self.clockPin.off()
      self.clockPin.on()
      self.dataPin.on()
    
    self.sendCommand(0x88|(self.intensity))


  def clear(self):
    for i in range(8):
      self.buf[i]=0


  def dot(self, x, y, draw=True):
    if draw:
      self.buf[y & 7] |= 1 << (x & 7)
    else:
      self.buf[y & 7] &= ~ (1 << (x & 7))

  Are you sure? yes | no

Elliot Williams wrote 05/30/2017 at 15:17 point

Was gonna say -- cost.  Or maybe familiarity.

But congrats on being "cloned" by WeMos! If indeed, congrats are in order. :)

  Are you sure? yes | no

Yann Guidon / YGDES wrote 05/28/2017 at 02:50 point

Maybe the extra pins can also drive a keyboard ?

  Are you sure? yes | no

deʃhipu wrote 05/28/2017 at 02:53 point

No, that particular chip doesn't seem to have keyboard support (the protocol is one-way, write-only). The TM1638 (the one with exactly 8x8 LEDs) does have extra 4 pins for keys, though.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 05/28/2017 at 02:56 point

yeah so they must have leftover parts from another project...

  Are you sure? yes | no