Jump to content

logic gate question


Guest analouge
 Share

Recommended Posts

Guest analouge

Hey guys and girls!

I've been looking into the topic of logic gates lately, and started to make some designs.

This is slightly off topic since I'm not using it for a MIDIbox project - yet. So I thought, someone in here of all you people is bound to know something about this right? So why not ask around here.

Here is what I'm looking for; 4 Input OR gate, either that or a dual 4 input OR gate. Forgive me that I don't write down the truth table to describe what I want, but I trust it's enough to say 4 input OR gate... ;)

OK, so I've used the 7805 pluss some caps to make a stable 5 volt from my electrical 12V system in my car. I've added 4 doorswitches next. Each switch goes into 1 input each of the OR gate. Then I get 5 volts from the output if one or more of the switches is closed, right...?

Next i need to drive a relay that switches the light inside my car on when the gate sends out 5 volts. So here my problems starts. In "theory" I could just wire the lightbulb right onto the ORgate, but that wouldn't work right? you would burn the electronics in a fraction of a second right...?

So I started to think, in real life (outside my simulation program) how much current can you drag out of the ORgate? Then I started to look for part numbers to see if I could find any info in the datasheets, but surprisingly I didn't find the part, and therefore no info from the datasheets.

So I figured, I should at least mount a relay into the circuit since the lightbulb runs on 12 volts, and not 5 as the gates does. But what I don't know is; can I drive a relay directly from the ORgate or do I need to have something else in between. Like a thing that is told by the gate to turn on the relay.

So have you guys got a clue? I know you TK would probably know it...:). I'm totally new to this, and I am NOT a electronic engineer, so I really have no clue exept from what I read from the internet and learn from my simulation program...

How do I drive a relay from the gate? Directly or through something else that is capable of delivering higher currents to the relay input? What type of gate should I use? if someone could slip me a part number so that I can have a look at the datasheet that would REALLY be great! The relay is gonna control the 12volt part of my system... wow... I don't really have a clue of what I'm doing here... I just read a lot about different types of gates and I found it REALLY useful, and I immediatly saw dousins of gadgets in my head that I could build using these things, especially simple control systems for my old car, in this case a system for switching on the light inside the car when a door goes up - BUT at the same time know WHAT door went open and show it in a console of leds that represents each door, or even better - on a LCD display...

I realize this post is very long, but please, if you know something about this, I most kindly with the greatest respect ask you for your help :D... hehe!

Chill ouT!

Ingebret

Link to comment
Share on other sites

Think you are looking at this backwards from first reading. You want a light to come on when a switch in the door closes? This would imply the door closing, usually the inside light comes on when one of the doors opens I will let you either explain or think about that further.

As to relays, one thing to bear in mind is that logic chips generally sink current a lot better than they source it.

Would say have a little look into optocouplers though personally...

Link to comment
Share on other sites

That is not that easy to explain. You need a schematic for that, but I've no drawing program at the moment, but basicaly:

The or gate output must be connected to the base of a transistor, this is connected with emiter to ground , and collector to relais. The other side of the relais is connected to 5V. Parallel to the relais should be a diode to safe the electronics. But there come different things you need to clear: The transistor must be "big" enough to drive the relais without overheading or burning down. The relais must switch at 3-5V (there are different relais on market). Also the whole thing needs a stabiliced power source. Your cap won't work, because when the relais switches on, the input voltage of the circuit will break down, and the logic gate would clear... so you'll get a permant relais switching.

To be 100% correct, you would also need some resistors, eg pullups or pulldowns, resistor base driving resistors...

It is not so easy...

Link to comment
Share on other sites

Guest analouge

lovesickdog,

you dont need to bother about the doorswitch stuff. The point is that when the switches has current flowing trough them the light is gonna glow :), so you misunderstood me a bit there maybe... switch is closed when the door is open :) - thought that was obvious - as you pointed out yourself...

Don't know very much about optocouplers. I thought they were used to ensure that you only has connection ONE WAY no matter what - somehow like diodes... But as I said... I've not looked into that yet so...

So back to real topic...

I've taken the liberty of downloading Electronics Workbench. I must say it's excellent... But not quite legal though, so I don't know how long I'm gonna use it. Normally I'm against pirateware, but I just had to try it out since a friend of mine tipped me off... a friend who isn't that consious about piratestuff :P

I made some schematics and I simulated them, and they seem to work fine... but the thing about simulation is that it doesn't simulate faults in the cuircut... I could probably set that up too, but I don't know how...

So I read a lot about signal amplifying lately. And I found out how to wire the transistors. I also found out how to protect the electronics with a diode in parallell with the relay (or anything that contains a coil). As I understood it you didn't really need protection if you don't drive anything with the coil from the transistor.

I also found out that you gotta have a network of resistors around the transistor... but I'm unsure of where to put it. Obviously I gotta put a resistor in front of the base of the transistor so that if won't drag too much out of the gate chip, and also to not exceed the limits of the transistor. I found a lot of formulaes on how to calculate resistor values correctly, but I'm not sure if I understand them correctly... It's not easy to understand when I don't even know where to put the resistors in the first place.

As I said, I made a simulation, but the program doesn't care if I drag 100Amps out of the OR Gate, it's happier than ever :P.

So... I would be most greatful if some of you could draw me a simple schematic that could put me in the right direction. A schematic that starts from the output of the gate chip and ends at the relay is very interesting for me - that is where to put the resistors together with the transistor etc. If I get the schematics I'll figure out how to calculate the right values, so that you don't need to bother about ;)

Anyway... thanks for the answers, and I hope you can help me... If someone would like to email me a schematic my email adress is ingebretsaerheim at hotmail.com

THANKS!!

Link to comment
Share on other sites

Guest analouge

MyCo,

I value your sense of simplicity. It would be the obvious solution to this problem. But unfortunatly it doesn's help very much. The schematics just shows an original setup for all cars with negative grounding.

I'm designing a complete system for my old car. In reality just to learn about digital logics, it's not sure I ever realize the project the way I thought in the beginning. For now I just know how I want the system to behave. I don't know if the system is gonna be this way in the end. Maybe I'll use a microcontroller too, but the way I see it is that if I'm gonna do that I need at least to have the understanding of how logics work in reality, not just on the computerscreen.

In some time the plan is to prototype a system without a microcontroller, that has the ability to:

- Turn on and off the coupelight as in the schematics from MyCo.

- Switch between coupelights off no matter what / coupelights on by doorswitch / coupelights on and able to dim with a potmeter (or a encoder if a microcontroller is used - that can also be used to do other system operations).

- Switch between blue and original parkinglights.

- Diagnose the light system so that it tells me if a lightbulb is blown.

- Tell me exactly what door is open (trunk door too) via a LED indicator console. (Or a LCD display if a microcontroller is used).

- Control the speed of the heating fan.

- Control the destination of the airflow from the heater

- Show every parameter on a LED console or LCD.

- And many things more that is just limited by my imagination.

So you see, MyCo, if this was a question about how to wire the doorswitches in my car, your answer would be totally correct. But this is just a minor part of a bigger system controlled by logic cuircuts.

So do you guys have any comments that could put me in the right direction.

I also looked into optocouplers on your recommendation, lovesickdog. And it was very interesting. I found it very useable for my project.

Just to remind you of my original question. It was, how can I amplify a signal from a OR gate so that it's useable current-wise for a relay?

If I understand it correctly I can drive a optocoupler directly from the logic gate...? So that would be much better than relays.

I also have another question.

How can I control the speed ot the heater fan via a potmeter and at the same time show the rpm in a 10 segment LED bar. I looked into the LM3914 IC or what it's called. It's a voltage devider/comparator/led driver or something, but I just can't work out from the datasheet how to wire it. I mean - how does it know that it is operating from 0-12 volts and not 0-18 volts?

Thank you very much for your help :)

Ingebret

Link to comment
Share on other sites

I don't know all optocouplers on market, but I think that there is no one that can switch a car light. If the light has 12W that means it takes 1A and that is too much for the optocouplers that I know.

To the fan thing: If the fan has a tempo signal like most of the computer fans, you can count the triggers per second, and you'll know the speed. That is something for a microcontroller. Displaying the result on an LCD is also no problem for a µC. A µC can als control the speed of the fan, in a good, clean and easy way: Pulse width modulation. For the whole thing you would only nead a simple µC-Testboard with voltage regulator, a transistor and some resistors. That makes 30$ (LCD incl.). I guess it is cheaper in US.

To the LM3914: It has an adjustable reference input (that's pin 8 ), which has to be adjusted to work correctly.

Just take a look on ebay, there are some Atmel testboards, with LCD and sometimes with relais, so you could do everything you've descibed on a single board just by adding source code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...