× General topics about hardware.

weird result with your wifi relay example

8 years 10 months ago #1652 by joefly
Hi Thanks for the nice writeups. I am following your wiring example for the wifi relay example.

I separately got a web enabled LED on my esp8266. The LED turns on and off by web interface fine. But then attached a 5V relay to the same LED pin following your wiring with 2n2222 and 5V relay module.

The weird thing is, when the LED lights up, the relay turns off, and If I turn off the LED, the relay turns on. So the reverse of what is suppose to happen. Weird. I double checked my wiring and components, I can understand why I am getting the reverse of what you get. Confused...help?

Please Log in or Create an account to join the conversation.

8 years 10 months ago - 8 years 10 months ago #1653 by NightOne
Its probably because the type of relay.... as a safety feature you might have a relay that " fails open" what that means is that the relay normally needs to have power to be open, the reason for this is that a relay normally switches high voltage and high amps

When something goes wrong with your micro-controller you don't what the relay to "fail closed" meaning that whatever the relay switches stays on forever, or at least until it catches fire... for example a kettle or water boiler.
Almost all relays are "fail open" by default but you can buy relays that are "fail closed" if you really need one.

The terminology on the relay is either NO or NC, meaning "Normally Open" or "Normally Closed"

Hope that helps

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1654 by joefly
No eBay APP ID défined in Kunena configurationOk after fooling around with it all day, I realized the 5 vdc relay module I got not need a transistor, but the IO pin from the esp8266 will drive it with an externally supplied 5v to the relay module.

without 5V power the relay is open
with 5v power the relay is open,
if the signal pin is HIGH on the relay module is high, the relay is closed, if the signal from ESP8266 is LOW the relay, it is open..

So looks like the relay module I got is able to work with 3v3 from esp8266.
I am not sure if the relay module I got is different from the example, but in the end I can not get it to work as described in the example.

But looking at the photo of the relay, it is different from mine, as mine only has a diode, small 3 leg chip, resistor and LED besides the relay. In the example, there are more components on the relay module.

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1655 by EasyIoT
No eBay APP ID défined in Kunena configuration

joefly wrote: Ok after fooling around with it all day, I realized the 5 vdc relay module I got not need a transistor, but the IO pin from the esp8266 will drive it with an externally supplied 5v to the relay module.

without 5V power the relay is open
with 5v power the relay is open,
if the signal pin is HIGH on the relay module is high, the relay is closed, if the signal from ESP8266 is LOW the relay, it is open..

So looks like the relay module I got is able to work with 3v3 from esp8266.
I am not sure if the relay module I got is different from the example, but in the end I can not get it to work as described in the example.

But looking at the photo of the relay, it is different from mine, as mine only has a diode, small 3 leg chip, resistor and LED besides the relay. In the example, there are more components on the relay module.


My relay was closed, when input was connected to GND. Transistor inverts values, so when 3.3V is on ESP8266 output, relay input is on GND. This can be done also in ESP8266 program, but when I try to connect ESP8266 directly to relay module my ESP8266 fry - because 5V from relay was on ESP8266 output pin. ESP8266 is not 5V tolerant. You can also try to power relay with 3.3V as you did.

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1657 by Dennis
why don't you simply reverse the LEDs orientation, and swap vcc with gnd at the LEDs other pin? Hint: your LED can signal a logic low or logic high, depending on how you wire it up...

regards

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1658 by joefly
Dennis, Yes, I could have done it by program but was part learning and figuring out what it was doing. I guess by previous comment, the transistor reverses the logic.

Also, did not know that the LED can be reversed, have to give it a try.

Please Log in or Create an account to join the conversation.

Time to create page: 0.305 seconds

Forum latest

  • No posts to display.