Problems with ESP and LED Matrix

I am attempting to use an ESP8266 with a 8x32 LED matrix, consisting of 4 chained 8x8 matrices, each controlled by a MAX7219 controller.
I wired it up according to the ESP pin reference (5V - VCC, GND - GND, D7 - DIN, D8 - CS, D5 - CLK) and am now attempting to control it via SPI.h:

#include <SPI.h>

void cmd(uint16_t c, uint8_t data) {
  SPI.beginTransaction(SPISettings(1000, MSBFIRST, SPI_MODE0));
  digitalWrite(15 /* CS */, LOW);
  for (int i = 0; i < 4; i++)
    SPI.transfer16((c << 8) | data);
  digitalWrite(15 /* CS */, HIGH);
  SPI.endTransaction();
}

void setup() {
  SPI.begin();
  cmd(12, 1);
  cmd(1, B01010101);
}

void loop() {
  // put your main code here, to run repeatedly:
}

.
However, the LED matrices turn on and off entirely, randomly.
Has anyone had a similar problem, or knows what I did wrong?
Is there a way I can check whether my matrices are still functional?

Supply external power to the LED matrix. Do not use the 3v3 from the 8266 breakout board.

Hi,
Can we please have a circuit diagram?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

Have you checked that the 7219 is able to work with 3V3 logic from your controller?

Tom.. :smiley: :+1: :coffee: :australia:

Sorry, I am inexperienced with Fritzing, but I hope this works.


My matrices are, unlike the diagram states, single-color (red), and my actual board is an ESP mini.

The MAX7219 does not work reliably with a 3V power supply. You need to give the matrix 5V for the LEDs. Remember to connect the ground of all the power supplies together to avoid other problems.

For a small number of LED modules in the chain you might get away with 3V digital signals but the operation is usually marginal and may not work reliably. You should really be using a signal level converter between ESP8266 and the MAX7219 I/O.

In my Demo (vimeo), I was using 5V, which is V_usb.

The 3V data enters the first module and is 'converted' thereafter (D_out), No?

Yes, but not for the other signals. As the chain gets longer there is a voltage drop and this may drop the voltage to below the '1/HIGH' voltage level detected by the IC.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.