nodemcu logic level shift- doubts

I have 2 major questions

As a former arduino Uno user, I'm not very comfortable in using 3.3v arduino compliant devices, specifically the Wemos d1 mini and nodemcu.

Almost all my modules are 5v compliant, so I realized that I could power then with usb 5v/3.3v (i guess it's the same)- I used the VV/5v usb passthrough from the wemos.

What I should have taken care of is the feedback from the modules to the nodemcu. I believe that max supported voltage is 3.6 v- I measured 5.5v (might I have fried something?
My relays didn't work well- while my arduino Uno is driving them perfectly in same configuration

  1. Is there a way to test the board?

Second question: 2)I found some AMS1117 modules for stepdown purposes. Do I need 1 voltage variator
per module (only feedback- source shall be 5v passthrough) or one is enough for say.. 3 modules with input mode?

The problem here is that you are giving no detail, and in the absence of this, there is no "one size fits all" answer!

The standard relay modules for example, work perfectly well - if you understand how to connect them.

look for the phrase "5V tolerant pins".

some 3v3 devices CAN accept 5V signals, some CAN accept a 5V power supply, but others only take 3v3, despite having 5V tolerant pins.

NodeMCU can not accept 5V on its pins as far as I’m aware.
So you may have to either power your sensors at 3.3V, or add logic level shifters for those that use 5V for both power and logic level.

Ok you need more info, here you go.
This is a little project I buit where a button controls a relay

I can make the relay switch on and off with a 2sec blink project, but I cannot control it with a button.
here’s a simple project with voltage divider as logic level

and this is my code

#define RELAY1  D8    
int button=D3;
int staterelay;
                    
void setup()

{    


Serial.begin(74880);
  pinMode(RELAY1, OUTPUT);
  pinMode(button, INPUT);       

}

  void loop()

{
  int readbutton=digitalRead(button);
 
  if (readbutton == 0)
  {
     if (staterelay == LOW)
     {
 
       staterelay=HIGH;
       digitalWrite(RELAY1,0);
       delay(1000);
 
     } else {
 
       staterelay=LOW;
       digitalWrite(RELAY1,1);
       delay(1000);
 
     }
  }
}

pinMode(button, INPUT_PULLUP); does this help ?

unfortunately no,

I really can't ascertain whether my wemos d1 is 100% working or not.
What I have observed is that if I power my relay from 5v passthrough I have no control, while if I power it from 3.3v wemos I can control it.
But in this mode, sometimes I notice that the relay led is struggling to keep on (I added digitalWrite(door, LOW) in the setup, sometimes the led goes off and on (logic ok) but the relay does not activate (doesn't go HIGH). So, if I connect 5v, (no switching) remove 5v+ wire , then connect 3.3v, wire, it works for a while.
(I guess I'm missing some electronics theory here- would love to read some explanation.)

So I decided to add a step down on the passthrough- tuned at 3.4 and worked perfectly.

What you are missing, is revealing to us what relay module you are using, and how you are trying to connect it.

As I pointed out first.

I have 2 relays I’m using to open my front door and front gate

Both are connected in NO, but

digitalWrite(door, LOW); (high opens)

digitalWrite(gate, HIGH); (low opens)

Some relay modules are active high, others active low... doesn't matter as long as you know which one it is.

It matters when you are tying to interface them to an ESP8266.

If we can ever get him to reveal what modules he is actually using, we might be able to sort the problem out!

what modules? my relays? Not a secret

I’m using 2 single Tongling 5vdc JDC-3FF-S-Z interfaced with a wemos D1 Mini

However, as I said previously, I’ve succesfully finished it: the step down tuned at 3.40v solved my problem.

I’ll share code, if interested

joerack:
what modules? my relays? Not a secret

I'm using 2 single Tongling 5vdc JDC-3FF-S-Z interfaced with a wemos D1 Mini

This is most frustrating!

As best I can find on Google, "JDC-3FF-S-Z" refers to a relay on its own, not a relay module, and you cannot connect that relay directly to a WeMOS D1 Mini because it requires 70 mA to actuate with at least 3.8 V.

So I simply do not believe that you are using just two relays directly connected to the WeMOS.

As best I can find on Google, "JDC-3FF-S-Z" refers to a relay on its own, not a relay module, and you cannot connect that relay directly to a WeMOS D1 Mini because it requires 70 mA to actuate with at least 3.8 V.

So I simply do not believe that you are using just two relays directly connected to the WeMOS.

Correct, relays are connected to wemos by passthrough, receiving 3.4V via stepdown

This explains why the 2 modules would never work directly connected to wemos. I believe max pin current is less than 20 mA

What's a "passthrough"?

3.4V is less than specified (minimum 3.8V) and therefore may lead to issues.

The ESP8266 can source/sink some 10 mA continuous; 20 mA or so absolute maximum rating.