1

I am using a bi-directional 3.3-5V logic converter to control 5V relay with 3.3V D5 pin of nodemcu. link of logic converter is here

However, I expected to control the relay but it didn't work. I don't think there is a problem with electrical connection or code since that is simple.

3.3V sides of nodemcu is connected to LV and 5V side of Relay is connected to HV.

Code:-

void setup() {
  // put your setup code here, to run once:
pinMode(D5, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(D5, HIGH);
delay(2000);
digitalWrite(D5, LOW);
delay(2000);
}

My Observations:- 1) When relay is removed, multimeter shows 3.3V at the LV & HV side. (so logic converter is not working i guess) 2) When relay is connected, multimeter shows 2.5V on both sides.

Everything is powered from nodemcu pins. Does it means that i have to supply extenal power or something wrong with logic converter?[![enter image description here][2]][2]

What do you guys think?

PS - I soldered the pins another way around on logic converter. Does it change anything?

circuit image, nodemcu is powered by the laptop USB

circuit

5
  • Please show your actual wiring.
    – Majenko
    Sep 30, 2019 at 10:34
  • Are you trying to drive a pure relay, or do you have a relay module (which already includes the driver circuit). If the first, make sure, that the level converter can actually provide the needed current
    – chrisl
    Sep 30, 2019 at 11:17
  • The photograph you provide is not helpful. Instead, show us the schematic of your actual circuit and provide a link to the manufacturer's datasheet for the level converter and the relay. Sep 30, 2019 at 12:56
  • Its the relay module that I am running. I provided that above photo to check if I soldered right side. Will the logic converter work if I soldered behind? will add the circuit also Oct 1, 2019 at 8:00
  • can anybody draw wiring diagram for raspberry pi to relay connection? Jun 20, 2021 at 20:13

3 Answers 3

2

You must supply a steady, regulated voltage to both 3.3v and 5v pins at all time (see Voltage Inputs on https://learn.sparkfun.com/tutorials/bi-directional-logic-level-converter-hookup-guide/all).

Logic level controller does NOT convert 3.3v to 5v for powering the relay, it just let you turn 3.3v signal to 5v so a relay can get activated. Relay's positive pin still needs to be supplied with a 5v from a PSU or other sources.

1

To make that work you'd need to connect the HV connection to the Vin of the NodeMCU (as well as to the relay board) which should be the 5 V coming form the USB port. You'd also need to connect the GND on the HV side to the GND of the NodeMCU.

1
  • Exactly. Although the GND sides are probably connected, the 5V needed for the relay and logic conversion needs to be supplied from somewhere. It will not be generated by the logic level converter.
    – StarCat
    Mar 29, 2020 at 17:44
0

The converter and/or the nodemcu can't provide enough current to drive the relay. So you should get a 5V psu. For further details we need more information about the parts you use.

1
  • could be, I put arduino instead of nodemcu since it has 5V pins and worked Oct 3, 2019 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.