1
\$\begingroup\$

I am currently working on an AND logic gate using 2 diodes.

  • My first logic input is 3.3V/5mA from a Raspberry Pi Zero W GPIO pin.
  • The second is 3.3V/500mA from a door access system. This input is originally 12V that I stepped down to 3.3V using this voltage regulator : https://my.cytron.io/p-voltage-regulator-plus-3.3v-1880?r=1
  • The supply voltage of the AND gate is 3.3V/<50mA => This supply voltage is used to supply a relay (a Grove mosfet). Then, this relay activates (or not) an external power supply (12V) used by a magnetic latch. By doing so, I want that if my logic gate is receiving 2 HIGH inputs, then my magnetic latch would remain closed. On the contrary, I want that if my logic gate is receiving at least one LOW input, then my magnetic latch would open.

The problem is that this configuration is not working. The magnetic latch remain closed no matter what the inputs states are.

However, when I replace the second logic input by another 3.3V and 5mA (from another raspberry GPIO pin), it works.

I also tried with different diodes : 1N5400, 1N5819, 1N4004, 1N4007.

Do you know what could be the origin of this issue? Is it from the second logic input of 500mA?

I attached a simple diagram of the AND logic gate. In my case, the 2 logic inputs correspond to the one I described earlier. And the LED corresponds to the relay (Grove Mosfet) that is triggered or not depending if the output of the logic gate is HIGH or LOW.

enter image description here

Edit : Here are the pictures of the circuit and the updated diagram : Assume that there is no LED. Instead, there is a wire that goes into the Grove Mosfet (the SIG pin). enter image description here

enter image description here

\$\endgroup\$
7
  • \$\begingroup\$ Can you attach an oscilloscope, a transient recorder or even more LED+resistors to the input signals and state, in the question, the signals are as expected? Does the gate work as intended connecting each input with a resistor of, say, 100 &ohm; to low or high as necessary? \$\endgroup\$
    – greybeard
    Commented Aug 9, 2023 at 7:47
  • 2
    \$\begingroup\$ The second is 3.3V/500mA from a door access system. what's the output configuration? Open drain/collector (i.e. Hi-Z), pull-up (non-zero output impedance) or push-pull? \$\endgroup\$ Commented Aug 9, 2023 at 7:51
  • 1
    \$\begingroup\$ Make sure that all your grounds are connected together (if not, it might explain the issue) \$\endgroup\$
    – Sandro
    Commented Aug 9, 2023 at 12:10
  • \$\begingroup\$ @RohatKılıç, Are you talking about the door access system ? Because I don't know anything about the configuration of the manufacturer. I just know that the output (that normally goes into the magnetic latch) is 12V when the door is closed, and 0V when it's open. I just stepped down the 12V into 3.3V so that It could match the signal from the Raspberry Pi to go into the AND gate. \$\endgroup\$ Commented Aug 10, 2023 at 6:50
  • \$\begingroup\$ @OmaymaRaji I just stepped down the 12V into 3.3V so that It could match the signal from the Raspberry Pi to go into the AND gate. How did you step it down? With resistors or regulators or something else? Put this detail into your question. \$\endgroup\$ Commented Aug 10, 2023 at 8:01

1 Answer 1

1
\$\begingroup\$

Two things:

  1. The Grove MOSFET site says that its input has to be 5V or above to switch properly. With that 3.3V supply, successful switching is not at all guaranteed.

  2. Your LED is preventing the output from rising above +1.7V or so. This is definitely insufficient voltage to activate the Grove MOSFET, which requires well above +3V to switch (according to the datasheet for the actual transistor it uses).

The second problem is easy to fix; remove the LED. Then the output signal from this diode-AND arrangement can rise to the full +3.3V. The first problem is bigger. Since you must provide a 0V/+5V signal to the Grove MOSFET, you will require a +5V supply. However, if you do that, then your diode-AND circuit won't work with the 0V/+3.3V outputs from the Raspberry Pi and door access system.

You need something that will reliably interpret the 0V/+3.3V input signals, and also produce a 0V/+5V output for the Grove MOSFET. If you also require the LED as some kind of status indicator, that's another thing to shoehorn in somehow.

I presume that you went this route because of the components you have on hand, and simplicity, but I think these goals will be difficult to achieve without transistors or an IC.

If you don't need the LED in the end product, a single transistor solution can work:

schematic

simulate this circuit – Schematic created using CircuitLab

This is a classic level translator, with diode-AND inputs. It's able to output +0.7V low and +5V high, which should work with the Grove MOSFET.

Another solution uses a real AND gate IC, a 74HCT1G08:

schematic

simulate this circuit

Notice the "T" in the part number, that means it's compatible with TTL logic signal levels, and will work well with 0V/+3.3V signals. Don't buy a part without "HCT" in it. Because the output is pull-pull, the LED is trivial to include.

A third option requires two transistors:

schematic

simulate this circuit

Note: All the MOSFETS in the above examples require \$V_{GS(TH)}\le 2.5V \$

\$\endgroup\$
1
  • \$\begingroup\$ - Thank you, I forgot to mention that the Grove Mosfet is supplied with 5V coming from the Raspberry Pi. I wanted that the output of the AND gate acts as the control signal for the Mosfet (~3.3V being high, and ~0V being low). - So even like that, if the door access system sends a Low signal (0V) into the diode, the output of the And gate would not be low. But, If the raspberry sends a Low signal, the output of the And gate is low, and the magnetic latch is open as expected. \$\endgroup\$ Commented Aug 10, 2023 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.