EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: BrainyCapacitance on August 17, 2024, 10:41:11 pm

Title: project help
Post by: BrainyCapacitance on August 17, 2024, 10:41:11 pm
I've been working on this passcode solenoid door lock circuit, and it's just about finished, but I'm only a homeschool kid doing this project. so, do you guys have any advice or things like that for this circuit? anything I haven't thought of? you are welcome to ask for the specifics and any other info that I may have forgotten to put in here.

NOTE: U1 and U2 are 74HC4514.
Title: Re: project help
Post by: Benta on August 17, 2024, 10:50:29 pm
No meaningful connection of EL and EN on both ICs.
No pulldown resistors on the AND gate.
No current limiting resistors for the LEDs.

That's just for starters.
Title: Re: project help
Post by: BrainyCapacitance on August 18, 2024, 01:24:38 am
so... like this?
Title: Re: project help
Post by: Konkedout on August 18, 2024, 03:09:21 am
I give you credit for trying to design a circuit at the age of 12.  I was 13-14 when I was trying to do that in the 1960s.  In my early days, my designs were baloney.  Now, not so much.  Usually when I design something nowadays, it works.

It will be helpful if you would verbally explain how you expect your circuit to work.  However you expect it to work, it will not do so because your design violates some basic rules.  I am a design engineer, but I much prefer design engineering rather than "reverse engineering."    Reverse engineering is starting with a circuit design and figuring out how it is supposed to work.  That is particularly difficult when the design has major errors.   To be blunt, your design has major errors.

Logic gate outputs should not directly drive BJT common emitter transistor bases (such as Q1).  This because there is no means to limit the current and protect both the transistor and the logic gate.  So if all else is correct, you need to have a current limiting resistor between the logic gate output and the base of each common emitter BJT.

But the base drive of Q1 is worse than that.  With Q1 emitter at ground, the base will need to be driven to 1 Vbe (about 700 mV) negative with respect to ground.  There is no way that U2A output can do that when it is powered by +5V and ground.

So anyway...I get back to saying that you should describe how you want your circuit to work....
Title: Re: project help
Post by: BrainyCapacitance on August 18, 2024, 03:52:48 am
hmm... can't believe I didn't notice that.but anyways, the circuit is supposed to read a binary code input at J1, and unlock (pull the solenoid) with the code 11100011 active on J1 pins 1,2,3,4,5,6,7,8. and, you're also saying that the bjts will have some problems. will a pulldown resistor and a current limiting resistor at the bjt bases do the job? thanks sooo much for the advice and gentleness! :-+
Title: Re: project help
Post by: ledtester on August 18, 2024, 04:44:05 am
I'm not sure of the point of the diodes D2 and D3 - I'm sure you don't need them.

An alternative way to drive the LEDs is with unused AND gates -- note that a 4000-series or 74-series IC will have four two-input AND gates on a chip and you're currently only using one gate.

Here is how it might work:

(Link to Falstad schematic) (https://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWcMBMcUHYMGZIA4UA2ATmIxAUgoqoQFMBaMMAKDEpEIBZxCqwMhXlSoooFNhwFDshPCBR55s+aPEJJ-QSC5d5i+btUL1LAE4hsaBVypW7kHv3jnL1hGDH2K253BYA7gpKOnpuVEZQLADm4T4y1nzGkCwASnEotnFgxGIiOrTiItAaQQaWcnEqUQAelh46eDxchEh65DyZINFmdHQAdgA6AM4AMgCiACIsddhcxJZcEFzY5HPNNiC9ACYjE9N1IczyYHPgKMubAKooAIKB4NpgfI8yCHkP0vViX9hNUUFfv8visPoDtKDXjpuADsi8vs8RDNLLJeB1iBABBFNgwAHwjAAuAHsRgBZADyAGUAGLjAAqLG2VUcVUqYm2dAAZgBDACuABsCYy4pFvB4xOyuXzBci0F4UEhMspFDprigAEKyyDYCjMBQNDwbLo3ADCLCAA)

The output of the U2A AND gate is fed to both inputs of two other AND gates. The red LED will light up when the output of U2A is a logic LOW and the green LED will light up when U2A outputs a logic HIGH.

Modern LEDs only need a few milliamps of current to light up which is the reason for the 1K current limiting resistors. Those resistors will also keep the current within the sourcing/sinking capability of CMOS and 74-series logic chips.
Title: Re: project help
Post by: BrainyCapacitance on August 18, 2024, 02:22:13 pm
could I use a push-pull (dual BJT) with the base connected to the AND gate output to drive the LEDs?

[image below]
Title: Re: project help
Post by: PGPG on August 18, 2024, 02:23:55 pm
will a pulldown resistor and a current limiting resistor at the bjt bases do the job?

Your mistake is that Q1 emitter should be connected to Q2 emitter and Q1 collector connected to GND (you did it reverse).
If it will be connected that way no extra resistors are needed.
Pull down resistors R1,R3 were needed only because you used diodes D2,D3. There should be no diodes and then resistors are also not needed.

If you use AND gate from IC that has more gates in it (I believe it as your gate has 'A' at the reference end) you should not left all other gate inputs open so you should have them at your schematic and set their input to 0 or 1 (your choice). CMOS gates 'don't like' if their inputs are floating - they can do unexpected by you things and for example switch their state very often increasing current consumption many times.
There are also ICs having only one gate in them - search any distributor for 'HC1G'  text.

We don't know what is to the left of J1. You have to ensure that A0..A3 4514 inputs are not floating as floating mens not determined state. It can be done at this schematic or inside something that is connected to J1.

I have build my first detector radio receiver when I was 10. You are happy - when I was 12 I had no access to any ICs yet.
Title: Re: project help
Post by: PGPG on August 18, 2024, 02:29:21 pm
could I use a push-pull (dual BJT) with the base connected to the AND gate output to drive the LEDs?

You post when I was writing.

You have a problem with pnp. You have to understand that it works like npn but with voltages reversed.
If NPN collector is connected to +5V supply then pnp collector have to be connected to - supply (in your case it is GND).
But you connected emitter to GND.
If you switch emitter with collector of pnp your first circuit will be correct (correct regarding these two transistors use).
Title: Re: project help
Post by: PGPG on August 18, 2024, 03:03:30 pm
At your schematic MOSFET is wrongly driven. You made from it a voltage follower.

At first imagine N MOSFET as npn but npn needs 0.7V at base relative emitter to be switched on and NMOS needs some higher voltage.

So if you drive npn base with 5V and it will have its collector connected to +12V and emitter to some load connected to GND then at first moment Vbe is higher than 0.7V so npn switches on and makes voltage at load rising. But when voltage reaches 4.3V it can't rise more as it will switch npn off. If you will be changing voltage at base the emitter will be also changing all the time being about 0.7V below base. Because of it it is called voltage follower.

You connected NMOS that way but NMOS needs higher Vgs voltage than npn Vbe voltage. So when you set its Gate at 5V you will get at output something about 2..3 V. It is not what you probably expect.

You should drive NMOS with signal applied to its Gate versus Source. So your signal should be connected to Gate and it is OK, but Source should be connected to GND to have your controlling signal to control Vgs voltage.
The Solenoid should be connected between NMOS Drain and +12V supply. But you should have in mind that when current in Solenoid will be switched off it will generate a very high voltage peak (self-induction voltage) that can kill your NMOS if you not do something to protect it.

IRFSL7440 is not 'logic-level'. It is intended to be driven by 10V signal and not 5V.
In its datasheet there is given its output resistance for 6V Vgs but nothing guaranteed for 5V.
Gate threshold can be as high as 3.9V. Gate threshold is defined (you have it in datasheet) as the Vgs voltage when output current is 100uA (0.0001A) so much, much lower than you need for your solenoid. With 5V the current will certainly be higher but the transistor is not guaranteed to be really switched on. If 5V would be enough to switch it on then in datasheet Rds(on) value would be given for some voltage lower than 5V but is only given for 6V.

Search for logic level MOSFETs and carefully read (and try to understand) all its specification. Logic level mosfets can be controlled by 5V signal.
There are also MOSFETs that can be controlled by 3V3 logic.

If something I have written is not clear feel free to ask. I will certainly look here but have in mind time difference.
Title: Re: project help
Post by: PGPG on August 18, 2024, 03:25:01 pm
I have looked also in 74HC4514 datasheet.
At first page I see there:
"When Latch Enable (LE) is high the output follows changes
in the inputs (see truth table). When LE is low the output is
isolated from changes in the input"

So for outputs to see changes at input LE (pin 1) have to be high and you set it to low.
Title: Re: project help
Post by: Doctorandus_P on August 18, 2024, 04:48:29 pm
The best advice I can give here has nothing to do with the circuit at all. Stop downplaying yourself. Simply do not use sentences like: "I 'm only a homeschool kid" and "technically brainless". When you use such language often enough, you may start believing it, and this undermines your self esteem and confidence. The same goes for the saying "What am I doing wrong?"... without even knowing whether the person saying it is actually doing anything wrong. It may just be a technical glitch or a faulty part or something else.

There is nothing special about being 12 year old (young). Most of us have gone though that same process, Not having much knowledge about electronics is also simply normal for someone your age. Many people never learn (nor have an interest in electronics). So be curious, take things apart to see how they work (but not your parents car) read books, internet and other information. Do experiments and let your knowledge grow.

A circuit like this is easy to build on a breadboard. A long time (30+ years) ago I built a bunch of small modules for use on breadboards. two such modules were an ULN2803 combined with 8 leds and series resistors. You can plug the module into a breadboard, and then monitor 8 logic signals at the same time.

Once you are reasonably comfortable with digital (and analog) circuits, you probably want to look into programming microcontrollers. Microcontrollers are extremely verstile, cheap and reusable. With a microcontoller you can write some software and then use it to enter for example a 6 digit pass code into your keyboard, wile using only one IC and some keys, and you can even add code to change your secret number.

I also highly recommend to buy a logic analyzer. These cost less then EUR10, and I often find it more useful for debugging (digital) circuits then the EUR500 oscilloscope I have. These cheap LA's can be used with the Free & Open Source software   Sigrok / Pulseview.

And don't forget to have fun while you're tinkering with this stuff.
Title: Re: project help
Post by: Doctorandus_P on August 18, 2024, 05:09:52 pm
Some more life advise.

[attachimg=1]