ESP GPIO expert device needed

Hey,
i have bought myself an esp8266 nodecmu v3 , configured Esphome…
Bought myself a new doorbell/intercom POE…
Now on my indoor station, i can define output relays, so configured one that will close on a doorpress event… So hooked up those 2 cables to D6 and GND pin… there is no voltage running on those cables, its always 0V, so when i press the doorbell, its a closed circuit, and D6 is triggering…
This is working for 1 month without an issue … in HA i read that binary sensor, when it goes from off to on, i can do other automations

binary_sensor:
  - platform: gpio
    pin:
      number: D6
      mode: INPUT_PULLUP
      inverted: True
    name: Deurbell

On my outdoor station, i can also use a code/swipe card that opens my electrical lock, so on the outdoor station, there is also a relay that triggers … so i thought, ok, gonna hook up 2 cables in parallel to another GPIO D7… on those 2 cables there is always 24V, so with resistor voltage divider 68k and 10k i reduced to 3,3v, to not break the input pin… so when the doorlock is triggering, it drops to 0V for 1 sec (relay time) … so ath that moment D7 triggers
so the + 3.3v cable hooked up to pin D7 and the GND cable i hooked up to the same GND pin on the breadboard i used for the doorbell …

  - platform: gpio
    pin:
      number: D7
      mode: INPUT_PULLUP
      inverted: True
    name: Deurlock

So a quite basic/easy setup, now since yesterday , when i started with D7 , 2 times also D6 was triggered for some unknown reason? how is that possible? i am using the same GND for D6 and D7 on the breadbord… could that be the reason? Is there maybe some interference on that powered doorlock? Should i use for the D7 another GND pin on the ESP board? i dont know if they are shared gnd’s?

It could be that for some reason the GNDs aren’t the same. It might be hard to figure out but following the wiring between your two stations and some circuitry you might able to figure that but out but I think you can avoid it.

Are you willing to add more hardware? You could add a dry contact relay between the outdoor station and D7 to duplicate what you have connected to D6. That way, it won’t matter.

The only other thing I can think of is to measure whether the 3.3V is accurate (if you haven’t), given the tolerances on resistors. Maybe you’re exceeding a threshold on the ESP’s side.

Hey my esp8266 has several ground pins, so I used d7 together with another one… not a shared anymore…

Didn’t get s false warning anymore… So I think it’s resolved now… So that means the gnd pins on the chip are not shared?

Glad you resolved it.

Are you powering the ESP from the same supply that powers the doorbell and intercom?

I can’t imagine why the ESP itself would have two different GNDs (I mean, multiple pins but it there should be only one ground plane).

Since I’m curious, could you tell which specific ESP8266 board you’re using? I’d like to look up the schematic.

using the 8266 nodemcu v3, powering it from my hp microserver (usb port)

there are 5 GND pins

first i connected both wires on the same GND at the right bottom
now i am using them seperaty, the 2 GND pins on the right side

According to schematic it’s the same ground, isn’t it?

Yes, that would be the same. I would’ve been very surprised if it wasn’t but you never know. There are lots of versions of these chips and boards. On a pedantic note, that is a pinout diagram. I’ve searched for some schematics (that shows the wiring to the chip) to see if there could be something odd.

I don’t think your problem is resolved though and might occur again: it’s not a good idea to connect the grounds of two circuits if they aren’t driven from the same power source. You need to either drive the ESP from the doorbell’s power (using a voltage regulator and if it can provide sufficient power) and then you can have that direct connection with D7, or you can drive from separate sources but isolate the circuits.

Ok, thnx for feedback, appreciated… It seems stable now, no more false warnings, i leave it like it is for now for testing

Crap, it did happen again … so seperating grounds didn’t help… Is the a way to workaround this without any additional hardware?

Because there’s no real separation. It’s the same GND — just different pins.

You either need to use the same power source for everything (and use a regulator to get the right output voltage for the ESP) in order to have a single GND plane, or isolate the circuits. In both cases you need extra hardware.

How can I isolate? Sorry new to this all :+)

I don’t think I can use that power source from the electrical door, because if I make contact, the voltage drops… Then there is no power to feed the esp board

Would this work if the original source was VAC. OP doesn’t specify type of 24v.

I have a addon board that runs off 9VAC and converts to 3.3VDC to power an onboard nodemcu.

If I use an ac-dc buck off the 9VAC to power the nodemcu, off board, I can then jumper over the pins with a ground to the addon board?

the 2 cables that are coming from my relay on the doorbell , that are going to the lock, they have 24DC power… if i connect them to each other , the same that the relay does on the doorbell, the voltage level drops to 0v … so i cant use that as a voltage source for my esp?
Those are connected to D7

The 2 cables connected to D6 , the one thats not giving issues, there is no voltage on it, its just a closed circuit when i connect them to each other

i did an easy workaround for now, all false detections , when i looked in logbook, where that D6 was only on for max 1 second, maybe even less in milliseconds
so now i configured the relay on an actually doorpress to stay on for 2 seconds instead of 1
changed my automation to below, that should do the trick

  trigger:
    - platform: state
      entity_id: binary_sensor.deurbel
      from: 'off'
      to: 'on'
      for: '00:00:02'

How can I isolate? Sorry new to this all :+)

I said this in my first reply:

In other words, power a relay from your doorbell/intercom and switch it with the output you currently have connected to D7. Then connect the dry contact from the relay to D7 instead. Using a dry contact means there’s no power connected to the relay’s switching side. One purpose of a relay is to isolate circuits.

Relays use fairly little power so it shouldn’t affect your power source too much.

You said this in your original post:

so i thought, ok, gonna hook up 2 cables in parallel to another GPIO D7… on those 2 cables there is always 24V, so with resistor voltage divider 68k and 10k i reduced to 3,3v

This tells me there’s no relay there – it’s just an output pin that switches between 24VDC and 0VDC.

so the + 3.3v cable hooked up to pin D7 and the GND cable i hooked up to the same GND pin on the breadboard i used for the doorbell

When the outdoor station drops that 24V line to 0V, it’s 0V of that circuit, which is now also connected to 0V of your ESP’s board. You’re momentarily connecting two different live circuits to one another.

Please also answer this, because there are specific bands within which the voltages must be for a pin to be pulled low and high respectively:

The only other thing I can think of is to measure whether the 3.3V is accurate (if you haven’t), given the tolerances on resistors. Maybe you’re exceeding a threshold on the ESP’s side.

I don’t think I can use that power source from the electrical door, because if I make contact, the voltage drops… Then there is no power to feed the esp board

What’s the specs of the power source of your electrical door? What’s making contact to what? Don’t just randomly connect things: You can potentially get hurt and damage your hardware.

Note that I did say you’ll potentially need additional hardware, like a regulator or a buck converter to bring the voltage down to an acceptable level for the ESP:

You either need to use the same power source for everything (and use a regulator to get the right output voltage for the ESP) in order to have a single GND plane, or isolate the circuits. In both cases you need extra hardware.

yeah, my guess is that the 3.3v is indeed not accurate, making somekind of noise

below is schematif of the door , its using 3 cables, 2 of them are going to the outdoor station connected to No1/com , so when i open the door with the code/swipe card, i hear the relay closing for 1 sec , during that 1 sec , it drops to 0 v instead of 24v
So on the No1/com of outdoor station, i have just put 2 cables in parallel on No1/com, then with voltage divider (resistor 68k and 10k put it back to like 3v) …

whats also strange, if i put the 2 wires together afer the voltage divider, so closing the circuit, it doesnt open the door , if i do it without the resistors, then it opens … isnt that strange?

image

Would this work if the original source was VAC. OP doesn’t specify type of 24v.

You’re right, it wasn’t made clear. I assumed 24VDC because that’s usually the case but better to confirm. I know irrigation systems are often 24VAC.

I have a addon board that runs off 9VAC and converts to 3.3VDC to power an onboard nodemcu.

Yes, that board would typically have a transformer to isolate the AC input, then a rectifier to change the AC on the transformer’s output side to DC and then more circuitry to drop the voltage to the required level. The main point I’m trying to drive home on the thread is that one shouldn’t connect the grounds of different circuits. With circuit, I don’t mean boards: It means, don’t connect two circuits, driven by different power sources (even if both are DC) directly to one another.

If I use an ac-dc buck off the 9VAC to power the nodemcu, off board, I can then jumper over the pins with a ground to the addon board?

I suspect it’s not a pure buck converter, since these are normally DC-to-DC converters and will have the same ground. There are very likely a transformer stage and a rectifier stage before the buck stage.

These are general remarks. It’s very hard to say without knowing the specifics of the hardware used.

1 Like

can i use something like this :

Why are you doing this? Are you saying you’re connecting the two wires of Vout as in your divider’s diagram (assuming Vin is connected to N01 and COM)?

You also need to differentiate between measuring the open pins vs the loaded pins. Remember, the pins of the ESP have resistance too. The pull-up (or pull-down) resistor would be in parallel with your voltage divider and can significantly alter the voltage. Calculate the output voltage by inserting that resistor between Vout of the divider and the 3.3V of the ESP. Do this for Vin for 24VDC and 0VDC.

yeah, was just for testing, if i connect the 2 wires ‘red ones’ together, the door opens
if i connect the 2 wires ‘blue ones’ it doesnt work …i thought if that would work too, then i was able to maybe open the door from my ESP module too

btw

Vin the + and min there , thats connected to NO1/Com of the doorbell (24v)
The V Out, + and - , only 3 v , those are connected to D7 and GND
image