I have a atmega8 that is working with 3.6V dc, I need to control some 12V relays with a not chip (7404), what is the simplest way to do this? I have connected a 12V dc to the relays, so when I connect the relays to the chip and then the atmega8, the current returns to the atmega through the not chip. Is this solution correct? There a better way to do this?
Answer
You shouldn't need a "not chip", more normally called a "inverter". All that does is flip the logical level of the signal. Since the micro should be able to produce the signal in whatever polarity you want, there should be no need to invert it afterwards.
Driving a relay from a digital signal can be done like this:
Most digital outputs can source a few mA. This circuit takes the few mA and uses a transistor to amplify them so that a relay can be driven. Usually a relay coil will need more current than what a digital output can provide, and isolating it thru a transistor is a good idea anyway.
You didn't say how much coil current your relay needs to turn on, so this is only a example. Figure the transistor will drop 700 mV from base to emitter, so that leave 2.9 V accross the resistor when the digital logic line is high (at 3.6 V). In this example, that will cause about 1.6 mA of base current, which just about any digital output should be able to do. Let's say you can count on the transistor to have a gain of at least 50, so that means it can sink up to 81 mA.
Many small 12V relays won't need that much coil current, so this would work directly. If yours needs more, give us the specs and we can show how to drive it. It would also be useful to know how much current the digital output can actually source. Probably 5 mA is safe, and quite possibly 10 mA, which would allow up to 1/2 amp to be switched by the transistor if really necessary.
The 7404 is not a good choice to drive the transistor even if you really do need the external inversion for some reason. These old TTL logic chips had very low output current source capability. A 74HC04 is a CMOS part, and can source a lot more, and should work in this circuit with most small relays.
No comments:
Post a Comment