Need help in logic circuit using mechanical relay

Thread Starter

axios

Joined Nov 8, 2011
5
Hi, i am currently working on an projects and it consist of a DPDT(NC) mechanical relay, 7404 inverter and C8051F226 microproccessor. This is how it works, a 5VDC was connected to the "Common" of the mechanical relay and pin 1 which is the contact that normally closed with the common pin is connected to the inverter.

In this case, if i didnt toggle the relay, it will send a logic 1 to the inverter to invert into logic 0 and send it to the MP. I was able to detect logic 1 when the relay is in an ON state and subsequent a logic 0 when i toggle it back to OFF state. However, i encountered a problem.

The MP was not able to detect any logic when the relay is from an OFF to an ON state. I happened to discover that when i use an mixed signal oscilloscope probe to merely came in contact with the interver pin that is connect relay pin 1, the MP suddenly able to detect the logic. But that also mean that i have to constantly use the probe to touch the inverter to make it works. Any kind soul or pros out there can help me with it? Thanks inadvance to those who help.
 

ErnieM

Joined Apr 24, 2011
8,377
A "no parts" solution would be to just ground pin 5 of the relay.

The problem you saw was due to the input of inverter being connected to either 5V or... nothing at all. Logic inputs hate that, it's called a floating input, and a floating input can float to most anything. Floating TTL inputs tend to float high, floating CMOS inputs can and do float anywhere and can literally destroy the device.

I will state SqtWookie's solution is "better" in that in my way there is a brief time as the relay is changing states the input is once again floating.

However, exactly how to tie off an input is not an exact science, and I have seen threads go multiple pages long discussing which way is "best," so the "best" answer is probably "it depends..."
 

SgtWookie

Joined Jul 17, 2007
22,230
Our OP stated '7404', but I'm thinking they actually used a 74C04, 74HC04, or other CMOS variant of the good old TTL.

It's really not a good idea to make any assumptions on what a disconnected input might be. Always provide a current path to a logic high or logic low level for any and all inputs; even sections of an IC that are not being used. Otherwise, the IC may oscillate unpredictably, or exhibit other unstable behavior.

If it IS a CMOS version, you might wish to increase the resistor to 5k-10k to reduce the power consumption, as a 470 Ohm resistor will be a constant 10.64mA drain on the supply. 10k would be just a 0.5mA drain.
 

djsfantasi

Joined Apr 11, 2010
9,156
Sgt.,

So you are also implying that the other five inputs (pins 3,5,9,11,&13) on the 7404 (74C04, 74HC04 or whatever) should also be tied to ground using the appropriate resistor, correct?

SgtWookie said:
Always provide a current path to a logic high or logic low level for any and all inputs; even sections of an IC that are not being used.
 

SgtWookie

Joined Jul 17, 2007
22,230
Sgt.,

So you are also implying that the other five inputs (pins 3,5,9,11,&13) on the 7404 (74C04, 74HC04 or whatever) should also be tied to ground using the appropriate resistor, correct?
Absolutely. Any unused INPUT should have a current path to a logic 1 or a logic 0.
 
Top