Go Down

Topic: WeMos D1 R1 - 5v Relay won't respond to working digital pin (Read 348 times) previous topic - next topic

jtbennett

Hi - I have a WeMos D1 R1 standalone board that I've connected to with Blynk. I've set up one button to operate Pin D2. It works just fine when I use it to power a little buzzer, but for some reason it will not function with a 5v relay.

I double checked the relay was good by testing the same setup on an Arduino board, and it was.

On the D1, I have the 5v VCC and Ground connected to their corresponding pins on the relay, and then the IN pin connected to D2.

It powers on to normally open state from the 5v vcc, but it just doesn't respond at all to the D2 pin trying to get it to close.

I tried switching from USB power to a wall adapter, still nothing.

What could be the cause of this?

(I am new, pls don't make fun of me  :'( )

Thee_Captain

Is the WeMos D1 using an ESP8266 chip? I think they all run on 3.3V. Maybe test the pin with your multimeter.
Throw a little karma my way. What goes around comes around.

jtbennett

It's an R1 shield, it has both 5v and 3.3v outputs - I had the VCC connected to 5v, but maybe there's not enough power coming out of the digital pin? or something?

I'll check that it's actually 5v though

jtbennett

Is the WeMos D1 using an ESP8266 chip? I think they all run on 3.3V. Maybe test the pin with your multimeter.
OK - so there's 3.3v on D2 when it's engaged (HIGH). I checked the arduino's pins and they put out 5v, so that must be the issue.

I'm sure I could have looked that up, but I guess this is how I learn these things. Anyway, thanks!



e: I have another question - if I insisted on using the WeMos shield (instead of putting a D1 Mini on an arduino) to control these 5v relays, would there be any way to step it up? I never studied electrical engineering or anything so I'm sorry if it's a really dumb question. Basically, I want a 3.3v pin to be able to put out 5v...could I put it in a capacitor and then the relay would draw it when there was enough stored up?

Thee_Captain

At this point I would say post a schematic of what you've got on your breadboard and show the specs of the components.

But yeah, the logic pins on most Arduinos (the one's not using ESP's) are 5V and ESP's use 3.3V.

It sounds like your relay needs 5V to actuate. I would also be somewhat careful depending on whether or not your relay has got a driver built in. Relays are inductors and they send current backwards through your circuit upon discharging. If your relay is just a solenoid connecting switch you'll need a diode to prevent the current from flowing in the wrong direction.

Let us know when you're not new here anymore so we can make fun of you.

<I'm still new here too.>
Throw a little karma my way. What goes around comes around.

jtbennett

If your relay is just a solenoid connecting switch you'll need a diode to prevent the current from flowing in the wrong direction.
I'm not sure how to check for that, but this is the one I've got here. It says the trigger current is 5mA - I would have thought 3.3v would have that covered?


Let us know when you're not new here anymore so we can make fun of you.
I just need a couple months more I think

freaklabs

I think it depends. Normally a relay takes a lot more current than a digital pin can put out. You would need a transistor to interface to it. If you are using a relay module though, all of that circuitry may already exist. In that case, it would be a simple interface issue. In my opinion, I think you might be trying to interface directly to the relay. In that case, you won't have enough current to energize the coil and turn on the relay.
FreakLabs
Wireless Technology for the environment, wildlife, and agriculture
https://freaklabs.org
https://hackerfarm.jp
Twitter: @freaklabs

neiklot

If you are using a relay module though, all of that circuitry may already exist. ..... I think you might be trying to interface directly to the relay.
See OP's link to his module in #5.

It says on the pic you (@OP) linked to, that the relay is active low.

With 5V and ground to the relay module Vcc and ground (and you said you can do 5V?), a LOW in the IN pin should close it. What I would expect to see is not that it's not closing (which is what you say is happening) but rather that it won't open. A 3V digital signal may not be enough to be seen as high in the 5V domain of the relay module's electronics to open it, although the digital low from the 3V side will be a low on the 5V side, to close it.

So if it's closing but not opening (oops) opening but not closing, that strikes me as a bit odd. (Although, edit, it's not really opening is it, it's just open to start with, and it's not really getting a chance to prove it can open, since you can't close it?)

edit: but 3V should actually be high enough to be a "high" on the 5V side.






neiklot

So maybe the real question is in fact (although you say it's working on an Arduino?...) are you actually putting a LOW on the IN pin to close it?


Thee_Captain

I think it depends. Normally a relay takes a lot more current than a digital pin can put out. You would need a transistor to interface to it. If you are using a relay module though, all of that circuitry may already exist. In that case, it would be a simple interface issue. In my opinion, I think you might be trying to interface directly to the relay. In that case, you won't have enough current to energize the coil and turn on the relay.
This is what I thought too, but he's got a transistor on the relay.

@OP Maybe take a photo of your actual circuit. Everything you are saying sounds like it should be working in my head, but there might be a mistake in your actual circuit (or in my head).

Also check to make sure all your contacts are working. That is the most frustrating when it's just not connected when you think it is.

You can also try physically taking the signal input line and directly connecting it to 3.3V then removing it putting it in GND to test it.
Throw a little karma my way. What goes around comes around.

jtbennett

but 3V should actually be high enough to be a "high" on the 5V side.
That's what I thought too, the specs say just 5mA on the trigger to switch.

So maybe the real question is in fact (although you say it's working on an Arduino?...) are you actually putting a LOW on the IN pin to close it?
I thought I'd figured this out last now but now you're gonna make me go back and fiddle with it again  :smiley-eek:. I did try switching the Blynk button to go from High to Low just to cover all my bases, and still no response.

I'm just gonna see about switching the NO/NC terminals and see what happens...if that doesn't work, I'll just use the WeMos Mini + Arduino to get the 5v on the trigger pin. Stupid weak shield.




You can also try physically taking the signal input line and directly connecting it to 3.3V then removing it putting it in GND to test it.
Just gonna test this along with a couple other things now...just for science I suppose, I think I've already resolved to just go with what works (Arduino pins).

jtbennett

You know what, I'm dumb and assumed I could run the wemos from the arduino and use the arduino's pins instead...I'm trying to figure out how to do that now since the wemos is meant to function as a standalone. I have TX/RX, 3.3v in and ground connected, but it refuses to take uploads. Am I misunderstanding how this would go down?




EDIT: Wow, ok so this is strange. I decided to try connecting the 3.3v to vcc on the relay (instead of the 5v, even though it's a 5v relay) and suddenly it's functioning just fine.

I suppose these relays want the same voltage on the trigger and the vcc? I dunno but I guess it's solved now.

freaklabs

Oh good to hear you got it working. Sounds weird that it worked after you got the 3.3V in there. It's possible there might have been something wrong with the 5V supply you were using.
FreakLabs
Wireless Technology for the environment, wildlife, and agriculture
https://freaklabs.org
https://hackerfarm.jp
Twitter: @freaklabs

jtbennett

It's possible there might have been something wrong with the 5V supply you were using.
I'd have thought so too if I hadn't tested it, it's putting out 5v steady. It's just some weird quirk I guess - but for anyone else using these Tongling 5v relays apparently you have to have the same voltage on the VCC and the trigger pins:


Go Up