Node MCU and 7 segment SPI display.

I have a Node MCU arduino which I am using for Temp/Humidity detection (and other stuff in the future) and it is going to report the data back to a central device via wifi.

I saw one of these:

A display that could be handy

The idea that there are 8 digits and I could group them into 4 x 2 digits.

I have a basic "test" script working on an Arduino Uno, but I am still at a loss with the Node MCU board.

As hard as I try I am still not getting the pin names/numbers on it.

The code supplied for the display is "nice" in that you can define the pins used for the SPI protocol.
Nice as in the pins are not set.

The SPI pins on the node MCU are not being used, but I don't know their numbers to put in the code.

The code starts off:

#define MAX7219DIN 4
#define MAX7219CS 5
#define MAX7219CLK 6
#define brightness 15

void setup() 
{
  Serial.begin(115200);
  Serial.println("Starting");
  MAX7219init();
  delay(500);
  MAX7219brightness(brightness);
}

But I can't "translate" the 4, 5, and 6 to pins on the Node MCU.

As far as I know I am using D5 and D6 for the temperature readings.
I am needing to keep the RX pin free for another device (GPS) to talk to it.

And I also have an atmospheric pressure/temp device which I think is 1 Wire protocol.

This is the "best" picture of the Node MCU I have, but it still doesn't help me with what pin is called what at the IDE level.
And it was for when I was wanting to get the I2C pins.

The other point where I am stuck is that board is 3.3v. The Display is 5.

I get the display could (maybe) work on 3.3v, but I would prefer to know before I get to that stage.
I know there is a 5v output from the node MCU to power the board, but would the 3.3v signals be valid from the board to the display?

Sorry for all the dumb questions. It has been a while and I have forgotten a lot with what I have been learning in the mean time.

There's no obvious relationship between the ESP8266's own GPIO pin numbering, and the NodeMCU Dx pin numbering. Just look up the NodeMCU pinout to map them.

Mind all the special pins, too. Connect the wrong thing to the wrong pin and your NodeMCU doesn't boot.

Thank you.

So, I am still a bit unsure about the pins.

This is a link I found:

Node-MCU pins

I am still failing to work out the "association" of the pin names/numbers.

In the Arduino IDE I can't get it working how to get the right value to use.

(But that is probably getting off topic.)

With said SPI display code I can pick ANY pins (but for those RESERVED pins and the special pin to flash the chip) for the functions.

But as stated - sorry to repeat this - I don't "get" what values to use to get/select given pins.

I'm also wanting a serial input pin (GPIO3) for data input. Using the table further down on the link I posted. That would be '9' via the IDE - yes?

Using pin 9 (GPIO9) would cause trouble (it's one of the Flash SPI pins) unless you set the flash mode to DIO, but even so reportedly only pin 10 will work and 9 still not. I never actually tried this.

GPIO3 is pin 3 or RX (don't know if that's defined). Beware when using this as general I/O pin as it may interact with the on board USB/TTL converter.

wvmarle:
Using pin 9 (GPIO9) would cause trouble (it's one of the Flash SPI pins) unless you set the flash mode to DIO, but even so reportedly only pin 10 will work and 9 still not. I never actually tried this.

GPIO3 is pin 3 or RX (don't know if that's defined). Beware when using this as general I/O pin as it may interact with the on board USB/TTL converter.

Ok. But as I read it from the link I posted GPIO9 is '11'.

I shall again state: I am not understanding the translation from the name on the big board to the pin names you use in the IDE to use the pins for I/O.

(Sorry the stuff below is not good. See link I originally posted)

GPIO Pin I/O Index Number
GPIO0 3
GPIO1 10
GPIO2 4
GPIO3 9
GPIO4 2
GPIO5 1
GPIO6 N/A
GPIO7 N/A
GPIO8 N/A
GPIO9 11
GPIO10 12
GPIO11 N/A
GPIO12 6
GPIO13 7
GPIO14 5
GPIO15 8
GPIO16 0

They left out the D in front of those numbers.

Just he number is the GPIO number.
D0, D1, D2 - as marked on your board - is what you need for the IDE.
Also do read this beginner's guide to familiarise yourself with the all the special features and quirks of this processor.

Thanks for that link.

That's a new one for me.

So...... I prefix the numbers (I/O index number) from my link with D and use that at the IDE to use that pin?

So (EG:) If I want to use GPIO 3, I would call it D9 in the IDE.

Indeed.
But only if you really want to use that one, and you really know what you're doing :slight_smile:

I am probably picking a bad example.

I just want to establish the methodology I understand of how to translate what I see on the board to what I type in the IDE to use that pin.

Now: What I want to do:
From the topic, I want to use the SPI bus.

The display I got has code with it and you seem to not need to use actual assigned SPI pins. You can set your own.

However, I will try to use the established SPI pins.

Looking at what I see:
I would use GPIO pins 12, 13, 14, 15
which would translate to D6, 7, 5 8

Ok, dunno what "gremlins" that would entail, as I am also wanting to keep an RX pin free for data reception.

What would I call the SDD1, SDCMD, SDD0, SDCLK pins. They don't have any GPIO numbers and so I am stuck in how to translate those pins to the IDE names.

RX pin is marked on the board as such. Remember that this is also connected to the built-in USB/TTL converter.

The others you mention you better not touch; that's for communication with the internal flash.

Others have suggested I use the software.serial option and use GPIO9.

But that is interesting from what you said.

As it is, I have one of the two temperature sensors working, and the SPI display.

All I need now is the second temperature sensor and an RX pin from the GPS unit.

SPI: 4 pins.
Temp sensors: 1 pin each.
That would leave another two plus the Rx/Tx free.
So what's the problem?

The "problem" was which pins were what.

There are 4 pins on the left of the picture which can't be used. They are to access the WiFi eeprom, or something like that.

Getting it CLEAR which pins were where (as said) was confusing.

Luckily things have moved on and I am now further down the path of getting things working.

lost_and_confused:
The "problem" was which pins were what.

There are 4 pins on the left of the picture which can't be used. They are to access the WiFi eeprom, or something like that.

That's the internal flash - and in fact they reportedly CAN be used for SPI communication. This is what I found in the drivers of some LCD display; unfortunately it didn't work for my version of the NodeMCU. When I have more time I'm going to try with a bare ESP12 module.

Getting it CLEAR which pins were where (as said) was confusing.

Most of my designs now use the ESP12 modules rather than the NodeMCU development board; it's definitely not the easiest controller to design circuits with but that's mostly due to the boot functions the various pins also have.