Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited
Resolved Resolved by rb550f!

5V Relay Not Responding As It Should

So I've just been trying out a 5v relay (with 5v regulator) on port D0 but it's not working as expected. I first tried "Set(D0,on)" and it closed the relay switch. I then tried "Set(D0,off)" and it wouldn't open. I disconnect it from the EZ-B and it opens, plug it back in and it closes again but can't control it from then onwards. I even tried a combined script...



but no change. I'm I missing something here or is there something else I can try?


User-inserted image


Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

AI Support Bot
Related Content
@Richard R

From what I am reading, there are different types. You could get one that does as you describe, and acts like a toggle, changing position each time signal is applied, or one that has two different signals, on and off, so you set one high momentarily to turn it on, and another high momentarily to turn it off.

@Steve G, Yes, that is one of the things this is meant to do, and should be working. I suspect the issue is that it expects a 5v signal and the EZ-B only provides a 3.3v signal, as @rb550f indicated. You may need a logic volt shifter (so your voltage regulator is dropping the VCC from 7.5 to 5, which is what the relay needs for VCC (power), and the shifter raises the 3.3v signal to 5v which is what it needs to trip relay position.

@steve... RE: what Alan said... just as a stretch try sending the relay set(D0,ON) and then send the same set(D0,ON) again and see if it clicks off... You never know...
United Kingdom
Right thanks guys. I'm getting it now. As @rb550 said, the signal pin need to produce 5v, not 3.3. I'll have a look at your suggestion Richard. Thanks again everyone. Not just this issue (just the cherry on the horrible tasting cake), but I'm REALLY having one of those days where nothing goes right.

Thanks again.
United Kingdom

Worth a try I guess with nothing to lose.
@Steve.... We've all been there... It's frustrating trying to get something to work that shouldn't be that hard in the first place.... been there, done that... Relax, have a beer and know that tomorrow will be a way better day...
United Kingdom

Yeah, a beer sounds like a great idea. Had a 4 hour back and forth argument with UPS earlier about what I thought was a simple issue that could be resolved, then my central heating boiler packed up, and numerous other things were sent to test me. So I thought robotics would be a nice stress free release... Wrong, lol. What was I thinking.

Andrew, make mine a Budwiser, and make it snappy. :P
Ahh man, that has been a crappy day. Sorry about that dude... Andrew, better make it two Buds for Steve.... :)
United Kingdom

Now you're talking.:D

Jokes aside, thanks for the kind words. I've just ordered two of the relays you linked to, so it should be all good.
@Steve... awesome... I promise those are plug in play with the ezb4... Andrew has one in his drive base.... You're welcome by the way....:)

Forgot to mention.. they are only rated at 2amps, but as I said I have ran more through them...
United Kingdom
No problem. 2 amps will be more than enough for my needs. I'm still going to use the relay I have as well with a level converter that @rb550f mentioned. I've got it so might as well use it.

Thanks again for your input everyone.;)

United Kingdom

Quick and possibly silly question. The relay you linked to, how do you connect it? So far I have the G, V, S (three pin port on the relay) on port d0 via a 5v reg, and a separately powered LED with the break in one wire going through the Com and NC, but nothing's happening (except for a very faint LED that breifly flashes once when I run a "On, sleep, Off script").
@steve.... you don't need a regulator unless you are using more than 7.4V with you ezb... Plug it directly into the ezb port with 3 wires...
V= Red pin
S=signal pin

switching part....
com= common
NO= normally open
NC = Normally closed

simply set(D0,On) and set(D0,off) to operate... Plug and play dude...:)
United Kingdom

Right. Reg was the problem. All good now. Cheers bud.:)
On second thought, maybe best to use with only 5V... I just tested it with 8.14V that my LIPO was reading.... It worked well enough, but can't vouch for the longevity of the relay at that voltage... I usually use them at 6V because most of my recent projects were using 6V niMh bats.... So just got used to plugging them directly into the ezb without a regulator....
United Kingdom
So why wouldn't the 5v reg work with the relay then? It's connected correctly and it does work.
United Kingdom

I found out what the problem was. The regulator I was using (not an EZ-Robot one, but a UBEC one) was labeled incorrectly. Output was input, and visa versa. It works now I have it back to front.

Thanks anyway. An unrelated question, can an ADC port be set to On and Off, and if so, how?
I made my own 5V regs using LM7805s and some servo extension wire that seem to drive the relay no problem... Maybe there is something different about the ez robot reg? Not sure...
Perhaps you'll be fine without the reg... Like I said the relay wasn't complaining or getting hot when I was using 8V with them.... Besides, they are not all that expensive, so won't be a big deal to replace them should they fail before their MFT (mean failure time).... They are probably good for a few 100,000 relay cycles....
You can't control an adc port like you can a digital port.... ADC ports are more meant to measure analog voltage levels...
United Kingdom
I thought as much. Just wanted to make sure as I'm running a little short on Digital ports. I just emailed the company selling the UBEC regs telling them they were labeled incorrectly.

Thanks again.