Welcome! Log In Create A New Profile

Advanced

Relay questions

Posted by TopherMan 
Relay questions
October 23, 2013 02:08PM
Hey all,

Looking at adding a relay to my power supply so I can switch it on and off through my controller. I found this: [www.sparkfun.com] which looks promising, but since I'm using a Smoothieboard-relative, I'm running at 3.3V logic. Rather than set up a level shifter and all that nonsense, I think if I switch some resistors around it will work properly at 3.3V logic. If someone wouldn't mind checking my calculations, I'd appreciate it.

So on the schematic page (here) there are a few equations. Below "VCC=5V" is a line that says (5-1.2-0.7)=0.020*R. 5 is VCC, 1.2 is the relay's typical forward voltage, and (I'm assuming) the 0.7 is the transistor's collector-emitter voltage drop. On the right side is 0.020*R, which I'm assuming is the recommended 20mA switching current. So if I replace 5 with 3.3, I get R = 70 ohm. So if I replace R3 with a 68 ohm (more common than 70) resistor, I'll be able to switch at 3.3V.

Now, R1 is just a pulldown (I think) so I don't need to touch that, and R4 is for the LED and I'd need to find the LEDs forward voltage to change that (which I'm not worried about at the moment). For R2 I'm on shaky ground, though, so this doubly needs checked. I know the resistor is the current limiter, so with a 330 ohm resistor at 5V, I = (5-0.7)/330 = 13mA. So for 3.3V, R = (3.3-0.7)/0.013 = 200 ohm. I think. Again, I'd like to stress that I'm a mechanical engineer, with no significant electronics experience outside of 3D printing and arduino tinkering.

Thanks in advance!
Chris
Re: Relay questions
October 24, 2013 02:47AM
Yes i think you pretty much got everything right.

About R1, transistor could make some currents in base by itself, leakage or else, and R1 is not only a pulldown, but also a drainage path for the base, usually 10-100k. I think 22k-47k should probably be enough coz we aim at as little waste as possible, but then 10k should ofc also work.

And the resistor in series with base, R2, its not that critical in our case because device is used as a switch. The transistor is basically current device, e.g. currernt in base * gain = current output. So the math is for the minimum levels of switch being on, e.g. if it has a minimum gain of 50 and we want to allow 100 mA through the switch, then we need 2mA in the base. And then the voltage for that resistor would be 3.3-1.0(vbe-max)=2.3v(min voltage) and then 330r would still give ~6.9mA like worst case so it should work. Though in the context of using it like a switch and to keep the vce(on) as low as possible, you can set this to perhaps 10-15mA, that could be like 220r-180r, and again thats fine also. Aiming to find out what was the original setting at 5v, its probably 10 to 15mA and a vbe estimated at 0.5-1v or so. I took it for 1v coz in the context of calculating a minimum its better to maximize the adverse values, e.g. not underestimate nor average them, but usually ppls just average them or something like that.
Re: Relay questions
October 24, 2013 03:58AM
Can't you just use a PC power supply? They have this built in already and to my experience, it works with 3.3V electronics, too.

Another one is to add a generic mechanical switch at the back (opposite side of the homing endstop) of your printer frame. To switch off, you simply command the bed to move all the way back, making it hitting the switch.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Relay questions
October 24, 2013 09:56AM
Okay, cool, thanks Noobman.

Traumflug, I could, but I already have a decent power supply, and I don't have a spare ATX supply. Minimizing waste and all that. The switch idea is an interesting one, though it wouldn't allow me to turn it on remotely. Plus, this will go on a Rostock, and figuring out an appropriate location for the switch that is unlikely to be accidentally triggered would be tricky. I'll give it some thought though.
Re: Relay questions
October 24, 2013 11:11AM
The psu is wasting power accordingly to how much power is being drawn out of it. Because it has a limited efficiency. But if the output is zero, the efficiency doesnt count for much. If the bed, extruder, and motors outputs are disabled, and since in this setup the uC board needs to be supplied from usb, the overal losses are slim to none, since there is no active current consumption. Sort of speaking, turning off the power supply while its not in use it does some economies, but not "that" significant. I think more of a "principle" than a "need". On the other hand the uC side is still being supplied from usb, so it does keep consuming after the said psu is off. So this switch wont be efficient or a complete solution, sort of speaking. Or, if the uC board is being supplied from same psu, switch would be on the complete system, so it could turn everything off idd, but then it wont be able to turn it back on.
Re: Relay questions
October 25, 2013 06:13AM
Quote

But if the output is zero, the efficiency doesnt count for much.

I measure 3 watts here for a 250W PC PSU in standby mode, close to zero load. That's quite a bit if it runs 24/7. Still, being able to just start a print without thinking about the PSU is nice and comfortable, of course.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Relay questions
October 25, 2013 08:10AM
Yup i think its a good figure, even surprisingly low, but i guess depends much on condition on how light the load is. Cant find similar figures for mega, but for due main page says smth about 800mA for a (peak?) 5v current rating. Ofc, its very discussable probably depends on running conditions, what is actually happening and such, but still its a number to work with. Lets say 4w@5v - probably max one rather. Starting with this, if its a linear regulator making it from 12v, that means 9.6w including losses. If we suppose a atx smps is providing the 12v, and imagining a efficiency of 75%, its 12.8w at the atx input. This would be a (max?) number for the uC consumption from mains. Doesnt matter if its printer atx, or fed through usb, in the latter case is the pc's atx so still same thingy.

I imagine these two scenarios.
1) One, how it is, where the said arduino uC and its board is supplied from usb, that makes possible to turn the psu on-off, to feed bed, extruder and steppers, but then the switch wont turn off the uC. The switch will turn off a psu that has already has no consumption and that gains little. Stand-by current of an atx with no load, like from quiescent currents or like losses through caps and other things that should be ideal but arent. Matter of opinion ofc, but imho not much gain, still its a partial shutdown as the uC keeps running.
2) Another scenario for a complete shutdown, the uC is powered from the same atx which is capable to turn off. Its better, complete shutdown as in no more consumption. This shutdown turns off the uC itself also. Except the uC wont be able to start again by itself, it would require a manual startup. But i think its better, this is how i'd do the switch like. I am near printer when it starts printing anyway, no need to have auto power on, its just the auto power off that i really need and anyway thats where the current economy really happens.
3?) just thought of this, but is there a uC deep sleep ~ standby mode that can be implemented via g-code ?

Another thought which is even more worth to discuss what is the timeline use of the switch, or how and with which parts it is implemented. This switch takes current to keep it on and it has losses, even some at mains level. If prints take long time, that consumption builds up. If prints for 10 hours and disconnects 30 mins before i get home, it should be mathed out its worth, the consumption during printing to be less than the economy made by turning it off.
Also another though, the economy of it, like 20$ for that relay board and price 0.25$/kw then needs to make 80kw economy to pay for itself (without shipment), and if it makes economy at rate of 5w/hr, that means like 16000 hours? I need to buy that relay, turn off the printer, and leave it like that for a few years, just for relay to pay itself and get break-even.
So all in all, lots of considerents, and probably anything that can be done has upside and downside also. All in all, for a matter of choice, i'd personally go with scenario 2 (or 3?) above, makes just a little more sense than 1, at least for me.

So... is there any uC deep sleep mode thingy? smiling smiley
Re: Relay questions
October 26, 2013 06:44AM
Quote

for due main page says smth about 800mA for a (peak?) 5v current rating

This is really "peak", with current sinking devices on all signals. The ATmega it's self is more like 20 mA.

Quote

just thought of this, but is there a uC deep sleep

There is. Waking happens by something like an interrupt, e.g. incoming data on the serial line.

Quote

the timeline use of the switch

Relays are typically lifetime-limited by the number of on/off cycles, not by the time of keeping a state. As the relay is on during the whole print, it'll take decades to reach these 100.000 cycles typical relays are rated.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Relay questions
October 27, 2013 04:42PM
-------------------------------------------------------
>As the relay is on during the
> whole print, it'll take decades to reach these
> 100.000 cycles typical relays are rated.

What i meant by timeline was about consumption. Relay can take 20-50mA itself, then a led about 20-30, and a transistor 10-15mA, lets round it up for 100mA/hour@5v, and we could ignore the junction losses. If it prints for say 8 hours, then its 800mA@5v/8hrs, and then to reuse calculations from previous it reaches 12.8W@utility totals, in terms of keeping relay on 8hrs during print. And if turn off economy is 3-5w/hour, if come home after only after one-two hours after the print stopped, the relay consumption is still bigger than the economy it makes. So in this example, it stands to reason that i would be better off by not using the relay in the first place.

The numbers are probably off more or less, but its just an example as for what i meant with timeline consumption. The opportunity of introducing it should be considered, the math should be done also from this perspective.

Edited 1 time(s). Last edit at 10/27/2013 04:44PM by NoobMan.
Re: Relay questions
October 28, 2013 04:57AM
Quote

What i meant by timeline was about consumption.

Well, you insist on your "decent" power supply, so deal with this. There are Solid-State Relays wich might require less power.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Relay questions
October 28, 2013 06:21AM
Huh, im lost? The psu belongs to OP, not mine, and i dont insist on him using it or not, was his idea. He asked about circuit and i replied. Then went a bit further with ideas about the switch.

Probably went too far in talking about switch, especially as OP seems to have left discussion. But anyway, i see nothing wrong with talking about it imo.
Sorry, only registered users may post in this forum.

Click here to login