GPIO-1 and GPIO-3. Can I use them?
Moderators: grovkillen, Stuntteam, TD-er
GPIO-1 and GPIO-3. Can I use them?
I have NodeMCU running for some time now. I configured it about a year ago and everything works great. This is how I have it configured.
SDA uses GPIO-9
SCL uses GPIO-10
This device uses 7 pins to monitor my security. Basically it notifies me when my doors or windows are opened or closed. I use the following GPIOs for monitoring:
GPIO-0, GPIO-2, GPIO-4, GPIO-5, GPIO-12, GPIO-13, GPIO-14.
Now I want to add HC-SR04 sensor to this device. This sensor require two GPIOs. I found that when I disable Serial Port in Advanced settings, I can select GPIO-1 and GPIO-3, but when I do it, my sensor does not work. I test it using different NodeMCU and it works if I use GPIO-12 and GPIO-13, but if I try to move this sensor to GPIO-1 and GPIO-3, it stop working. The plan is to learn how to enable them, test, and connect this sensor to my existing NodeMCU if possible.
Am I missing something? Can I use GPIO-1 and GPIO-3? Or will I have to use the second NodeMCU?
Thank you.
SDA uses GPIO-9
SCL uses GPIO-10
This device uses 7 pins to monitor my security. Basically it notifies me when my doors or windows are opened or closed. I use the following GPIOs for monitoring:
GPIO-0, GPIO-2, GPIO-4, GPIO-5, GPIO-12, GPIO-13, GPIO-14.
Now I want to add HC-SR04 sensor to this device. This sensor require two GPIOs. I found that when I disable Serial Port in Advanced settings, I can select GPIO-1 and GPIO-3, but when I do it, my sensor does not work. I test it using different NodeMCU and it works if I use GPIO-12 and GPIO-13, but if I try to move this sensor to GPIO-1 and GPIO-3, it stop working. The plan is to learn how to enable them, test, and connect this sensor to my existing NodeMCU if possible.
Am I missing something? Can I use GPIO-1 and GPIO-3? Or will I have to use the second NodeMCU?
Thank you.
Re: GPIO-1 and GPIO-3. Can I use them?
https://www.letscontrolit.com/wiki/inde ... figuration :)
May be used but observe that signal might flicker due to serial activity during boot.
Please excuse my English, thanks!
Re: GPIO-1 and GPIO-3. Can I use them?
I saw this information, but it does not work.
Re: GPIO-1 and GPIO-3. Can I use them?
Read here : http://www.letscontrolit.com/forum/viewtopic.php?t=1462
Do yourself a favour and get an i2c i/o expander for that unit. This will free up enough gpio
Do yourself a favour and get an i2c i/o expander for that unit. This will free up enough gpio
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: GPIO-1 and GPIO-3. Can I use them?
Totally agree.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Re: GPIO-1 and GPIO-3. Can I use them?
Do you mean PCF8574? I will definitely try, thank you for your advice.
Re: GPIO-1 and GPIO-3. Can I use them?
Yes, either PCF8574 or MCP23017.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: GPIO-1 and GPIO-3. Can I use them?
For some Clarification:
ESPEasy uses GPIO1 and GPIO3 as serial communication port by default.
This says that serial communication is enabled in a fresh installation of ESPEasy and GPIO 1+3 can not be used as In/Out by default!
If you want to use them you have to deactivate the serial port in the ESPEasy settings first.
Please beware:
- GPIO 1 and 3 are the standard ports for serial - deactivating serial takes place when ESPEasy has already started.
So on Startup there will be some signals on the TX line as the ESP itself sends some boot messages.
This cannot be disabled by ESPEasy.
- If you use these ports for other purposes then serial, the diagnosing possibilities via serial are lost!
Be very sure your project runs, diagnosing without serial can be somewhat tricky.
- Take measurements for re-flashing with your circuit.
You may need to reflash your firmware some day - via serial. Make sure you have jumpers in your circuit to disconect
GPIO1 and GPIO3 from circuit and make it availlable for flashing.
All in all i agree with grovkillen: A GPIO expander like PCF8574 or MCP23017 should be preferred over using GPIO 1/3
Regards
Shardan
ESPEasy uses GPIO1 and GPIO3 as serial communication port by default.
This says that serial communication is enabled in a fresh installation of ESPEasy and GPIO 1+3 can not be used as In/Out by default!
If you want to use them you have to deactivate the serial port in the ESPEasy settings first.
Please beware:
- GPIO 1 and 3 are the standard ports for serial - deactivating serial takes place when ESPEasy has already started.
So on Startup there will be some signals on the TX line as the ESP itself sends some boot messages.
This cannot be disabled by ESPEasy.
- If you use these ports for other purposes then serial, the diagnosing possibilities via serial are lost!
Be very sure your project runs, diagnosing without serial can be somewhat tricky.
- Take measurements for re-flashing with your circuit.
You may need to reflash your firmware some day - via serial. Make sure you have jumpers in your circuit to disconect
GPIO1 and GPIO3 from circuit and make it availlable for flashing.
All in all i agree with grovkillen: A GPIO expander like PCF8574 or MCP23017 should be preferred over using GPIO 1/3
Regards
Shardan
Regards
Shardan
Shardan
Re: GPIO-1 and GPIO-3. Can I use them?
Thank you for your help.
I bought th PCF8574 device.
It will take a couple of week to come from China, but I am trying to understand how to use it. I found this article: https://www.letscontrolit.com/wiki/index.php/PCF8574, but have a few questions.
First of all, are the connections on the right and on the left the same? Can I use either one of them?
Also, the article says that there will be eight additional pins, but I see nine pins on the board. Do you know why?
It is not clear how to connect it in the ESPEasy. The example show Port: 1 and IDX/Var: 22. What are those numbers? I do not understand that table with A0, A1, A2, Address, and Port range. Can you please explain?
Thank you.
I bought th PCF8574 device.
It will take a couple of week to come from China, but I am trying to understand how to use it. I found this article: https://www.letscontrolit.com/wiki/index.php/PCF8574, but have a few questions.
First of all, are the connections on the right and on the left the same? Can I use either one of them?
Also, the article says that there will be eight additional pins, but I see nine pins on the board. Do you know why?
It is not clear how to connect it in the ESPEasy. The example show Port: 1 and IDX/Var: 22. What are those numbers? I do not understand that table with A0, A1, A2, Address, and Port range. Can you please explain?
Thank you.
- Attachments
-
- Capture.JPG (29.08 KiB) Viewed 25619 times
Re: GPIO-1 and GPIO-3. Can I use them?
I'm still in the office and don't have a module at hands.
The yellow pins are the additional input/output pins, the 9th pin might be a ground pin, i have to check that myself.
The four pins left and right are identical, yes.
You can chain max. 8 of these modules by just plugging one module to the other.
At this point the A0...A2 comes up: This selects the address the PCF chip uses on the I²C bus.
As you have three jumpers and every possible combination from all jumpers "on" to all jumpers "off" is valid you can select up to 8 addresses.
Connecting to ESP is as simple. I²C is a two wire bus system. The bus consists of SDA (data) and SCL (clock).
On top you need Ground and 3.3V (Vcc). Connect GPIO5 (D1) to SCL, GPIO4 (D2) to SDA, Vcc to Vcc and Gnd to Gnd.
That's it.
For input you need a task per input.
The input port number depends on the address you've chosen with A0...A2. If you have set A0-A3 to "0" or "Off", this is chip address 0,
so input pins for the setup in ESPEasy are pins 1 ... 8 (so called "Port Range")
If you set for example A0 = 0, A1 = 1 and A2 = 0 you selected the chip address 2. Port range will be 17 ... 24 then.
For output just send command:
For example: PCFGPIO,6,1 to switch the pin 6 on chip 0 to "on".
For a detailed description of I²C and how to get it to work see wiki: https://letscontrolit.com/wiki/index.ph ... C2%B2C_Bus
Regards
Shardan
The yellow pins are the additional input/output pins, the 9th pin might be a ground pin, i have to check that myself.
The four pins left and right are identical, yes.
You can chain max. 8 of these modules by just plugging one module to the other.
At this point the A0...A2 comes up: This selects the address the PCF chip uses on the I²C bus.
As you have three jumpers and every possible combination from all jumpers "on" to all jumpers "off" is valid you can select up to 8 addresses.
Connecting to ESP is as simple. I²C is a two wire bus system. The bus consists of SDA (data) and SCL (clock).
On top you need Ground and 3.3V (Vcc). Connect GPIO5 (D1) to SCL, GPIO4 (D2) to SDA, Vcc to Vcc and Gnd to Gnd.
That's it.
For input you need a task per input.
The input port number depends on the address you've chosen with A0...A2. If you have set A0-A3 to "0" or "Off", this is chip address 0,
so input pins for the setup in ESPEasy are pins 1 ... 8 (so called "Port Range")
If you set for example A0 = 0, A1 = 1 and A2 = 0 you selected the chip address 2. Port range will be 17 ... 24 then.
For output just send command:
For example: PCFGPIO,6,1 to switch the pin 6 on chip 0 to "on".
For a detailed description of I²C and how to get it to work see wiki: https://letscontrolit.com/wiki/index.ph ... C2%B2C_Bus
Regards
Shardan
Regards
Shardan
Shardan
Re: GPIO-1 and GPIO-3. Can I use them?
Great, thank you very much. I will try it when I receive this device.
Re: GPIO-1 and GPIO-3. Can I use them?
Does it mean that example has a mistake? They have Port 1 and IDX/Var is 22, but in your explanation IDX/Var 22 (17-24) would be with the port 2, not port 1. Am I correct? Or maybe I do not understand it.Shardan wrote: ↑22 Mar 2018, 16:33 The input port number depends on the address you've chosen with A0...A2. If you have set A0-A3 to "0" or "Off", this is chip address 0,
so input pins for the setup in ESPEasy are pins 1 ... 8 (so called "Port Range")
If you set for example A0 = 0, A1 = 1 and A2 = 0 you selected the chip address 2. Port range will be 17 ... 24 then.
Thank you.
Re: GPIO-1 and GPIO-3. Can I use them?
Port number and IDX are not related.onlize wrote: ↑22 Mar 2018, 23:58Does it mean that example has a mistake? They have Port 1 and IDX/Var is 22, but in your explanation IDX/Var 22 (17-24) would be with the port 2, not port 1. Am I correct? Or maybe I do not understand it.Shardan wrote: ↑22 Mar 2018, 16:33 The input port number depends on the address you've chosen with A0...A2. If you have set A0-A3 to "0" or "Off", this is chip address 0,
so input pins for the setup in ESPEasy are pins 1 ... 8 (so called "Port Range")
If you set for example A0 = 0, A1 = 1 and A2 = 0 you selected the chip address 2. Port range will be 17 ... 24 then.
Thank you.
In the example in the wiki:
The 3 adress bits (A0-A2) of the PCF chip are all set to 0.
This means the chip will have the I2C-Adress 0x20 and the port range is 1-7.
If the adress bits were set to 1 0 0 the adress of the chip changes to 0x21 with the port range 8-15.
This way, up to 8 chips can be daisy chained.
The IDX is the unique identifier for Domoticz. It has nothing to do with the adress/port of the PCF.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: GPIO-1 and GPIO-3. Can I use them?
Got it. That IDX value confused me. Thank you for explaining.
Who is online
Users browsing this forum: No registered users and 7 guests