Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect relay board to NodeMCU #29

Open
alexartd opened this issue Nov 15, 2017 · 11 comments
Open

Connect relay board to NodeMCU #29

alexartd opened this issue Nov 15, 2017 · 11 comments

Comments

@alexartd
Copy link

Hello, I've a relay board with 3 pins, VCC, GND and IN. I've connected VCC to 3.3 and GND to GND of MCU. In is connected to a GPIO pin. With pinMode(pin, OUTPUT); and digitalWrite(RELAY1,LOW); and digitalWrite(RELAY1,LOW); relay doesn't work. I've tested that if I connect relay IN pin to VCC it doesn't work but if I connect it to GND it work. This relay hasn't jumper to set if it should work in HIGHT or LOW. I suppose that MCU GPIO should provide a GND signal to turn on relay but I don't know how.
Can you help me ?

@mcbaer
Copy link

mcbaer commented Nov 15, 2017

Probably not supplying the correct pinout. Also you would need to define "RELAY1" to the pin you're using.

Google how to use relay with Arduino, and you will get your basic setup. Also there are several videos of the NodeMCU used with relays.

No need to post under issues, as you're inability to use a simple relay is not an issue with NodeMCU

@alexartd
Copy link
Author

If I connect led anode (+) to the same GPIO and led catode (-) to GND it works so GPIO is controlled correctly, but if the same GPIO is connected to IN pin of relay, it doesn't work.

@mcbaer
Copy link

mcbaer commented Nov 15, 2017

http://bfy.tw/F33K

@alexartd
Copy link
Author

Many thanks but it is what I've done and I'm sure that relay is connected well, as explained on internet. You haven't understand my question. I think that the problem is that this relay board work with low signal, GND to be clear. But a GPIO is not able to send a GND signal bit a positive signal from 0 to 3.3V. I think that with a transistor I can resolve but I'm searching other solutions.

@mcbaer
Copy link

mcbaer commented Nov 15, 2017

No, relays work the same. You have POWER or NO POWER to the input/trigger. Which Opens or Closes the gate/circuit depending on the NC/NO state of the relay. By connecting to GND you are basically providing NO POWER to the input/trigger.

You are almost 100% referencing the wrong GPIO in your code, or have not correctly defined your pin

@alexartd
Copy link
Author

Ok but I've wrote that if I connect a led in the place of relay, it work so GPIO work.

@alexartd
Copy link
Author

@mcbaer
Copy link

mcbaer commented Nov 15, 2017

Again, relay works the same. I have a 8 RELAY system that controls the lights in my work shop off a NodeMCU, and each relay input/trigger is connected to a GPIO. No need for any resistors (or in the case of the link you provided NO transistor) to make the relay work.

I even have a 2 channel relay sitting right here, that I just tested on a spare NodeMCU, and again no resistor or transistor needed.

@alexartd
Copy link
Author

Probably my relay is different from your. I don't know.

@mcbaer
Copy link

mcbaer commented Nov 15, 2017

THEY ALL WORK THE SAME! FFS

@alexartd
Copy link
Author

My relay turn on with pin IN connected to GND or also to 3.3V. GPIO pin from MCU turn from 0V to 3.3V but I don't understand why it cannot turn on relay. I've solved with circuit with transistor.
Bye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants