ESP8266 un useable pins

Hi i have all the digital pins and analog a0 tied up on my esp8266. the only pins i have left are d4 and d8. i need to use one of them for a flow sensor but if i use either of them for a hall effect flow meter it can cause infinite reboots or no boot. what can i do to these pins to make the useable??

Scroll down a little on this page to see what the pins are used for: https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/.

D4 should not be pulled low at boot.
D8 should not be pulled high at boot.

Which board do you have ?
What is connected to the other pins ?

im using the nodemcu v1.0. since all my pins are used up and i cant use d8 for the flow meter input without boot issues. so i still use d4 for flow sensor input but i use d8 to power the flow meter waiting until the esp is powered up before setting d8 to output to power the flow meter. i hope this is going to work,

I have relay connected to D0,D5,D6,D7. RTC connected to D1,D2. photosensor on A0, and float switch connected to D3, flow meter input connected to D4 flow meter vcc connected to D8

If you cannot make those pins work, maybe consider an I2C expander like the MCP23008. That would give you 8 more GPIO pins.

1 Like


The pins marked on the PCB with a Dx are not the only pins that can be used as a GPIO.
If you are not using the UART, RX & TX are available (TX can not be LOW at Boot)
And the SPI pins can also be used as GPIO pins. To refer to those pins you can use their GPIO NR (1 for TX 3 for RX) without the D prefix (as you can do for any pin by the way)

Hi can i use GPIO 7,6,OR 11 as digital input? because when i look at nodmcu pins the schematic above does not match the arduino pins.

i fi try to use spi miso aka arduino ide pin "1" the program wont finish booting?

Actually if i try to use any of SPI pins 14,10,9 the program wont boot right. if i use 9 it reboots when pulled low

Is there anyway i can stop D3 from being pulled low on boot and causing a relay to chatter?

i

have a analog multiplexer could that work?

Unfortunately, there is a bit of a muck-up on the NodeMCU. These pins are actually the internal interface to the flash chip. They are actually not available in general to use as GPIO pins, certainly not as inputs as this simply prevents the ESP from running its code. If you were to use them as outputs, they would only set to the state you defined briefly but would immediately afterwards start outputting a stream of unrelated data as the code executes.

They are basically, useless and simply should not have been part of the NodeMCU design. While it appears to have more I/O than the smaller and cheaper WeMOS D1 Mini, it actually does not. :roll_eyes:

You can use "D3", "D4" and "D8" as long as you make absolutely sure that whether chosen as outputs or inputs, the first two are HIGH and the latter LOW on startup. This means that if used as inputs, the input device must be guaranteed to be at the correct state on startup or if any load is connected to them, that load must by default be pulling them to the correct states. Clearly something such as a flow sensor may be in either state at start-up so that is not appropriate.

what multiplexer do i need to control states of relays? is the esp32 any more useful?

I have a ESP32 which is said to have 15 more gpio pins than esp8266. i have a ESPRESSIF WROOM 32D

would this be more suitable? which pins should i not use on the 32.

so i converted my code to ESP32 but i cannot seem to find a pinout regard ESP32 and arduino ide. does anyone have a mapping of the pins for ide?

Do you have the ESP-WROOM-32 module on it ? That is the most common module.
Here is (almost) everything about de ESP32 and Arduino:

Yea thats the one i have. it seems to be a lot different that the esp8266. I just read this,

but it dont explain what the pin numbers are in IDE

Looks like maybe i suppose to use GPIO numbers in ide

Yes you are supposed to. Same as with the ESP8266,
If you want to refer to GPIO13 aka HSPI MOSI you can simply by it's GPIO number

pinMode(13, OUTPUT);

Sorry about the mistake from before, on the matter of the ESP8266,
I also found this and this which just proves i was not correct.

That depends on your ESP32 module.
For example "GPIO5" might have the label on the pcb called "D5" and in the sketch use the number 5.
For the ESP8266 the pins have different numbers, but for the ESP32 they are the same as the GPIO numbers.
The pins GPIO1 and GPIO3 are often labelled on the pcb as "TX0" and "RX0", but those are connected to the CH340G.
Note that when Wifi is used, none of the ADC2 pins can be used. That is 10 pins becoming useless[EDIT] the ADC2 module can not be used, the pins can be used as digital pins.

So if i use the Wifi on esp32 i lose the use of 10 pins? "adc2 pins"does this mean that they cannot be used for digital input or output either?

It is only for the ADC2 module, so using them as digital pins should be okay. I will fix my previous post.
The ADC2 pins are: 0,2,4,12,13,14,15,25,26,27.
According to Espressif:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html

Since the ADC2 module is also used by the Wi-Fi, only one of them could get the preemption when using together, which means the adc2_get_raw() may get blocked until Wi-Fi stops, and vice versa