Go Down

Topic: NeoMatrix with Wemos D1 esp8266 (Read 1 time) previous topic - next topic

Crocs

Good day everyone!
So I currently am working on a project in which i would like to control a ws2812 8x8 rgb led matrix with a Wemos d1 esp8266 board.
I did install the driver for the board itself and also installed the neomatrix and neopixel library in the arduino IDE(all the newest versions) the description of the neomatrix library says that it is compatible with the esp8266 chip (I therefore assumed that the library would also be compatible with the Wemos d1 because it is based on a esp8266). The library however doesnt seem to be working since the example code does not do anything:
Code: [Select]

// Adafruit_NeoMatrix example for single NeoPixel Shield.
// Scrolls 'Howdy' across the matrix in a portrait (vertical) orientation.

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
 #define PSTR // Make Arduino Due happy
#endif

#define PIN 7

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//   NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)


// Example for NeoPixel Shield.  In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, PIN,
  NEO_MATRIX_TOP     + NEO_MATRIX_RIGHT +
  NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE,
  NEO_GRB            + NEO_KHZ800);

const uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };

void setup() {
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(40);
  matrix.setTextColor(colors[0]);
}

int x    = matrix.width();
int pass = 0;

void loop() {
  matrix.fillScreen(0);
  matrix.setCursor(x, 0);
  matrix.print(F("Howdy"));
  if(--x < -36) {
    x = matrix.width();
    if(++pass >= 3) pass = 0;
    matrix.setTextColor(colors[pass]);
  }
  matrix.show();
  delay(100);
}


There is no problem compiling and uploading, the only message i get is this one:
"WARNING: Spurious .github folder in 'Adafruit NeoMatrix' library"
But i can't remove the github folder because the library doesnt work at all then.

I therefore wanted to ask you if this problem can be resolved or wheter this project is not doable at all with the board I am using.
PS: I use this board because i am using it as an Access Point where i host an http server to communicate with a web brower (the goal would be to be able to control the matrix over a smart phone browser).

Thanks for reading and thanks for the help in advance
Greetings from a Arduino noobie
Crocs

Coding Badly


Do not cross-post.  Other thread removed.


PaulRB

#2
Jan 07, 2017, 11:30 am Last Edit: Jan 07, 2017, 11:36 am by PaulRB
I've never tried the NeoMatrix or GFX libraries, but I have used the NeoPixel library with Wemos, so I imagine the rest should work OK too.

Which pin on the Wemos are you connecting the matrix to, what other components are you using and how are you powering the matrix? 64 NeoPixels will require a 4A 5V supply.

Have you tried the "strandtest" example sketch from the neopixel menu?

Crocs

I currently am using the d8 Pin on the Wemos (Are there any pins you cant use?) I am using the 5V Power supply on the Wemos (I do realise that it is only about 0.5A, but should work for testing purposes as it is also working with an Arduino with the same Power supply).
The strandtest example you are mentioning is for LED strips and not LED matrix if i'm not wrong, but i did try the example in the neomatrix library (matrixtest, the code in my other post)). It worked with my Arduino UNO but i cant get it to work with my Wemos.
I am not using any other components.

PaulRB

#4
Jan 07, 2017, 07:41 pm Last Edit: Jan 07, 2017, 07:44 pm by PaulRB
I currently am using the d8 Pin on the Wemos
But your code says:
Code: [Select]
#define PIN 7
So it should say:
Code: [Select]
#define PIN D8
Note that "8" and "D8" are not the same thing. Without the "D" in front of the "8", you are referring to the ESP's GPIO pin 8, which is not actually available to use. "D8" refers to the ESP's GPIO pin 0, which is connected to the pin marked D8 on a Wemos R1. A little confusing, isn't it?

(Are there any pins you cant use?)
I would avoid D8, D9 & D10 on Wemos R1, because those pins have a pull-up or pull-down resistor attached. But it might work. Try D8 and report back what you find.


I am using the 5V Power supply on the Wemos (I do realise that it is only about 0.5A, but should work for testing purposes as it is also working with an Arduino with the same Power supply).
Just because its working does not guarantee it is not damaging something.

The strandtest example you are mentioning is for LED strips and not LED matrix if i'm not wrong,
Yes, but a matrix is just a folded-up strip, so I was hoping that strandtest might at least make the leds light up. I was slightly concerned that the other two libraries might be the cause of your problems, and strandtest does not use them. But because you say strandtest does not work either, I now think that the problem is what I said above about pin numbers.

I am not using any other components.
You should have a resistor between the Wemos pin and the first led, value is not critical, 100R, 220R, 330R, 470R would be fine. You should also have a large cap across the power lines, e.g. 1000uF.

Crocs

Yes about the mistake in the code I am sorry, for testing purposes i did change it of course ^^
Do you need to write
Code: [Select]
#define PIN 5
or
Code: [Select]
#define PIN D5

And thanks about telling me about the damaging part, I think i got some parts lying around somewhere i can use so ill do that immediatly...
I tried the strandtest again but it is really not working. I did try to change the pin now aswell but it is still not working.
I tried to use every Pin now and none works. I tried the Matrix again with my trusty old Arduino UNO and it works there (So i dont think the Matrix itself is broken).
Btw is the Wemos R1 a typo (I got a D1, i dont know wheter there are any other types).

Also thanks for the awesome help, i really appreciate it!
May i ask from where you know that much about this stuff (from experience or is there some good way to learn those things).
Have a nice evening and thanks again!

PaulRB

#6
Jan 07, 2017, 11:29 pm Last Edit: Jan 07, 2017, 11:31 pm by PaulRB
As I tried to explain before, if you are using the pin labelled D5, you need to define the pin as "D5", not "5".

There are two versions of the Wemos D1, called the "D1" and the "D2 R2". There are some pin differences between them.


I have never owned a D1 or D1 R2. All the Wemos I own are D1 Mini, and there are three versions of those, the V1, V2 and Pro. Fortunately, unlike the D1 and D1 R2, there are no pinout differences between the version of the Mini.

Crocs

Alrigth i've tried the correct Pin labeling and it is still not working :/
Since you seem to know alot about this kind of stuff and it seems to be not working with the parts I have at the moment, could you tell me what parts you would recommend for using? (I was thinking about using a normal Arduino and a real esp8266 and controlling the NeoMatrix via the Arduino.
Side note: The project im trying to do is to put it simple controlling a LED Matrix via a Website that is hostet on a access Point (At the moment the esp8266 on the Wemos is doing that).
If you had any good recommendations I would be really happy!

Thanks again for everything and explaining all that stuff!
Greetings Crocs

PaulRB

I have never used ws2813, only ws2812B. I have a strip of 60 x ws2812b working with a Wemos D1 Mini, for example. I do not have any Wemos D1 or D1 R2, but I do not think they should be any different from a D1 Mini for this purpose.

Please try using that resistor as I suggested.

Did you ever have the NeoPixel library installed in the Arduino IDE before NeoPixel was made compatible with ESP? Perhaps your library is out of date, even if you think you have updated it. You could attempt to un-install the NeoPixel library, then check that the folder is gone or empty in your sketchbook/libraries folder, then re-install NeoPixel library.

Also you could try the FastLED library.

Crocs

Alright first of all i am really sorry I didn't reply for so long. I doing the mandatory service at the moment and didn't have time. I finally got it working now! I reinstalled all of my Arduino stuff, made sure that all connections are steady and voila it works!

I am really thankful for the help! I assume it was some kind of error with the library (maybe some corrupted files or just an older version).

Again thanks for all the help!

Go Up