Buttons and digital input in parallel

Hi All,

sorry if this question have been answered before, but digging, i could not find it.

Scenario:

1 arduino nano with three push buttons (each to a GPIO as input).

1 esp8266 with three GPIO as output.

on arduino nano, loop checks the state of the directly connected push buttons - all works ok.

The question:

can the 3 GPIO outputs from esp8266 directly connect to the 3 GPIO inputs on nano in parallel and perform the same function, so, either pushing the physical button or having the input from esp8266 output, the task on nano will be executed?

Thx in advance.

Paulo

Yes, but you cannot go the other way as the Nano is 5V and the ESP 3.3V.

can the 3 GPIO outputs from esp8266 directly connect to the 3 GPIO inputs on nano in parallel and perform the same function, so, either pushing the physical button or having the input from esp8266 output, the task on nano will be executed?

Yes, but you might have to adapt the circuitry. As you failed to post the used code and wiring, I cannot tell you what to change.

But in the end you should pull the Nano's inputs high by the ESP8266's output over a resistor and use the buttons to just pull the Nano's inputs to GND.

Be careful if you want to connect the GPIO outputs and push buttons to the same inputs. You don't want to short the GPIO pin to ground or vcc through the push button.

Hi,

thank you for the replies.

Attached, a very simple drawing by fritzing.

esp8266 in a 3.3 V from 5 V rail (thru regulator), being the ground common.

From D1 at esp8266 to pin D13 from nano and button also to pin13.

the sketch reads the D13 for high or low.

Is there a diode needed, in order that when pushing the button, D1 at esp8266 does not gets the returning signal?

Thx in advance.

Please tell me you used the schematic view of F**ing.

DO NOT hook it up like that! Pressing the switch will connect the output from the esp8266 directly to the 5 volt power source.

MorganS:
Please tell me you used the schematic view of F**ing.

i did not get it... can you please educate me?

TIA

david_2018:
DO NOT hook it up like that! Pressing the switch will connect the output from the esp8266 directly to the 5 volt power source.

OK, thank you for the hint. Suggestion, please?

The earlier suggestion sounds like it would work. Connect the esp8266 output to the nano input through a resistor, and then connect the push button from the nano input to ground. There would be no need to use the internal pullup resistor, because the high level output of the esp8266 functions as the pullup.

pylon:
But in the end you should pull the Nano's inputs high by the ESP8266's output over a resistor and use the buttons to just pull the Nano's inputs to GND.

david_2018:
The earlier suggestion sounds like it would work. Connect the esp8266 output to the nano input through a resistor, and then connect the push button from the nano input to ground. There would be no need to use the internal pullup resistor, because the high level output of the esp8266 functions as the pullup.

could you please educate me? i did not understand. push button to the ground? could you draw it?

would an optcoupler 4N25 get the job done?

TIA

pw44:
i did not get it... can you please educate me?

Schematic view. As in: the easily readable version, not the fancy looking but otherwise unreadable spaghetti version you posted. Or just ditch Fritzing and learn how to draw real schematics. Pen and paper is generally better than this.

No pin numbers on that ESP module.

No part number for that "78xxl" thing, can't say for sure what that is. Also no indication on its terminals.

No value for that resistor - 220Ω as suggested by the colours doesn't make sense there so the colours probably have no meaning.

wvmarle:
Schematic view. As in: the easily readable version, not the fancy looking but otherwise unreadable spaghetti version you posted. Or just ditch Fritzing and learn how to draw real schematics. Pen and paper is generally better than this.

No pin numbers on that ESP module.

No part number for that "78xxl" thing, can't say for sure what that is. Also no indication on its terminals.

No value for that resistor - 220Ω as suggested by the colours doesn't make sense there so the colours probably have no meaning.

LM7833, resistor 10K pull down. Attached the diagram and the box with the doted line is what i'm trying to figure out the best way. One of the answers was totally right, as the original idea would inject 5v to the pin D0 of the esp8266.

The LM7833 misses the required 0.33 uF input and 0.1 uF output capacitors (see datasheet). It also has a 2.0V dropout, so should be supplied by at least 5.3V to be able to deliver 3.3V on it's output. You need a low drop-out regulator, the AMS1117-3.3 is commonly used for this exact application (it's a.o. on the NodeMCU boards).

That box can be a voltage divider. Basically you replace that 10k pull-down with a voltage divider, the mid point of which gives the 3.3V to the ESP's input, the top of which the 5V (directly from the switch) goes to the Arduino's input.

Do consider to add a resistor (1-10k) in series with the Arduino pin - in case it's set to OUTPUT, LOW you would otherwise create a short when pressing the button. The top resistor of the divider has the same function for the ESP.

wvmarle:
The LM7833 misses the required 0.33 uF input and 0.1 uF output capacitors (see datasheet). It also has a 2.0V dropout, so should be supplied by at least 5.3V to be able to deliver 3.3V on it’s output. You need a low drop-out regulator, the AMS1117-3.3 is commonly used for this exact application (it’s a.o. on the NodeMCU boards).

That box can be a voltage divider. Basically you replace that 10k pull-down with a voltage divider, the mid point of which gives the 3.3V to the ESP’s input, the top of which the 5V (directly from the switch) goes to the Arduino’s input.

Do consider to add a resistor (1-10k) in series with the Arduino pin - in case it’s set to OUTPUT, LOW you would otherwise create a short when pressing the button. The top resistor of the divider has the same function for the ESP.

Thank you for your answer.

Regarding the hint switching LM 7833 by AMS1117, thanks!

In my case, D0 at esp8266 is only OUTPUT, aimed to perform the same as the push button does, which is trigger the nano D13 INPUT, so D13 is HIGH by pressing the push button or receiving the output of D0 from esp8266.

I’m thinking in output D0 from esp8266 to a 4N25 optocoupler (D0 → 220 Ohm resistor → pin 1 of 4N25) and having pin 5 of 4N25 to 5V and pin 4 of 4N25 to the conection between push button and 10 K resistor, so 4N25 emulates the push button.

Is this approach feaseable?

TIA

3.3V is enough to read as high on a 5V Arduino. Direct connection - much easier.

But you should NOT connect it to the 5V from the switch. Use a dedicated pin on the Arduino for your ESP signal.

i must do it in pararell, as i have no more free pins on nano :slight_smile: the diagram showed the particular need, not all connections, like to easydriver, leds, ldr, and other buttons.

from esp8266 i will have 3 GPIO turning high to trigger 3 or the 5 buttons on nano... that's why...

Really? You even used A6 and A7? If you don't need Serial other than for programming that are two more options.

A6 and A7 would give me 2 options, i need 3 :wink:

As that are analog inputs you can read all three of them with a resistor ladder on a single pin.