I'd like to switch on/off a relay by using a momentary switch. The relay should be turned on the first time I press the switch and off when I press it the second time. If possible, it would be great if some sort of "memory" feature could be incorporated, so that the relay would be in the same position as last time power was applied to the circuit.
The switch will be used to turn on/off power for a SATA hard drive in a rack enclosure for two separate hard drives sharing the same power supply.
Yes, that was the first thing that came to mind, but it's hard to find elegant looking switches like that. Alternating switches are usually big and bulky and I want something small and elegant. The latter is usually momentary switches -even on/off switches for power (soft-power that is), like on most Apple Macs, which in my opinion is a very elegant power switch:
formatting link
(does anyone know where I can them, or anything similar?).
So that's why I'm asking for a circuit which will use a "soft-switch" which in turn activates the relay.
No, go to a home supply store that sells those cheap circular flat lights that run on batteries. The one I took apart had on on/off switch in it. Use it to control the power to the relay. Check out the ratings and it may do the job for you.
Yes, that would be helpful as I'm not really into designing stuff from scratch. On that note I don't know how to program a PIC either, so a basic circuit with readily available components would probably be easier.
I didn't even know there was such a thing before the replies here. That sounds just the thing I could use! Correct me if I've misunderstood, but a "latching relay" is basically a relay which is in one position (e.g. "on" as far as the SATA hard drive power is concerned), and the next time the relay is activated it goes to the other position (e.g. "off" as far as the SATA hard drive power is concerned) -and the current position is held until the relay is activated again? That would take care of the "memory" part in addition to letting me use a low power momentary switch :-)
Are they always bulky? Looks like small ones can be found, like this one:
formatting link
I suppose I need a 2A relay to handle the power lines of the hard drive with 2 poles (switching both the +12V and +5V lines would probably be good). The relay could would have to run on either 12V or 5V as that's what the hard drive power supply has to offer.
One question: when the relay switches from one position to the other, does it cause a "clean break" (or make)? I don't think the hard drive electronics will like it if the electrical contact switches on-off-on-off-on-off-on-off (if even only for a fraction of a second).
On a sunny day (Tue, 03 Jun 2008 21:37:09 GMT) it happened Rich Grise wrote in :
There is no such rule, as long time ago I stated: I will not program it for you. And that rules. The PIC is interesting for the OP, as it can store the current status in EEPROM, so it needs no battery backup as a D flip flop would. But hey, rules are made to be broken, feel free to supply some ASM source.
Yes, debounce should always be preset.
The mechanical button has the advantage that you can see if it is on or off even without power.
The PIC allows more cool things, like keep buttun down 10 seconds to reset system etc...
A SATA power cable carries three voltages: 3.3V, 5V and 12V. So you need a
3pdt (latching)relay to switch them all. In practice you may find a 4pdt type.
A latching relay has a memory. It will stay in the last position it is switched to even when the driving power has gone. To achieve this behaviour, the relay has two coils. Each one moves the contacts to one of the two possible positions. It has no use to keep a coil activated or to reactivate it. The only way to switch the relay to its other position is to activate the other coil. (There are other types, but I stick to the one I described for the moment.) The latching relay is the way to go as you want your circuit to remember which disk was activated the last time and keep it that way.
A PIC is a very good thing to control the relay... If you can write a program and program a chip. As you apparently do not have those skills, you have to use some good old LS or similar logic. You have 5V power, so that cannot be a problem. So one and a half LS221, two transistors and some passive components will do the job. Use half an LS221 to make a - let's say - 3s pulse when you press the button. This pulse triggers one of two other monostables, depending on which disk is active. (You can always see which disk is active by looking at the 5V connection of the disks, though I would like a separate set of contacts on the relay.) You pulse the coil of the non-active disk, for over 4s meanwhile blocking the other monostable from being activated when the relay switches. As the outputs of the LS221 are not able to activate the coils, you 've to use transistors for it. This way you can also use the 12V power connection voor the relay coils.
I've been wondering about the wisdom of abruptly removing power at all. Do you have software to flush your buffers and put the drive electronics into a state where it's _safe_ to turn it off?
Toggle flip-flop: You give it a trigger, it switches state, just like the latching relay but electronic. Here's a quick example:
Yeah, but when you take into account $100.00 or more just for the development kit, the time to learn the S/W, and finding a way to work around the bank switching, which is evil in and of itself, go screw yourself. :-) (
On a sunny day (Thu, 05 Jun 2008 21:55:24 GMT) it happened Rich Grise wrote in :
Well, the bank switching is not that bad, once you get used to it, but I agree it is overhead, and things would be simpler without it. As to the price, I have here a noppp programmer (cost to make about 10$ if you do not already have the parts in the junkbox), and the Linux gnu programming software is free and very good. And learning you will have to do that anyways, or be forced to spend much more money on making big 74HCXXXX CMOS boards. As somebody said: 'He who is not busy learning is busy dying'. Well, actually *I* said that, the original was from Bob Dylan: 'He who is not busy being born is busy dying'.
On a sunny day (Thu, 05 Jun 2008 19:26:54 -0400) it happened Phil Hobbs wrote in :
Whi I estimated you very knowlageble, but if a simple thing like that causes you problems, then hell how could you program any modern micro??????????????? ;-)
The fact that the data sheet was wrong made it a bit more challenging--it was wrong in a couple of explicit ways and a couple of much subtler ways. The part was wrong too, until the A version came out--the WDT was buggy, which made it _really_ entertaining. It wasn't just a matter of looking up the bit mask and typing it in, believe me.
One reason Microchip wanted to bury the PIC17s at midnight in an unmarked grave.
On a sunny day (Fri, 06 Jun 2008 09:03:17 -0400) it happened Phil Hobbs wrote in :
you
OK, I understand, yes that is bad, never used the 17 myself. One reason I like Microchip is that you can get them everywhere, and the on board FLASH makes it possible to use them as replacement for many rather complicated circuits with normal logic. Anyways nothing is perfect, but I often find the problem is with my code... or I simply work around it :-)
Yeah, you have to work with what you've got, and I'll see your bug and raise you two more. ;)
That was for the Footprints project--a distributed network of 96-pixel thermal IR sensors with a highly competitive 0.13 K noise-equivalent delta T, for a cost of $10 (sensor alone) or $100 (sensor plus PIC plus flash plus communications), installed. Cute project once I got the bugs out of the sensors. The sensor film was PVDF (i.e. fluorinated Saran Wrap) with carbon ink pixels printed on it literally with T-shirt lithography (silk screen). I wrote it up as a (hopefully) entertaining war story at
formatting link
and the technical details of the sensor at
formatting link
I really got the accelerated course in microcontroller programming on that one.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.