1
\$\begingroup\$

I am building a motor with permanent magnets in the rotor, and I need to pulse the stator coils at the right time, and need to be able to adjust the duty cycle.

My plan was to use not 1 but 2 Hall effect switches (A3144) in an AND gate setup, where the current would only flow when BOTH sensors were ON.

This way, the further I place the sensors apart, the lower the duty cycle becomes, since the moment at which both sensors are ON becomes shorter.

However, I've only been able to create an OR gate setup like this:

enter image description here enter image description here

Any idea if and how I can create an AND gate using two Hall sensors?

Thanks for the help!

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Your Hall sensors appear to be of the usual output-low-when active and hopefully open-collector/open-drain configuration. Thus in your shown circuit, the LED will light when either activates and sinks current.

Your literal request is for the functionality of an "AND" gate but with active low inputs and the outputs, or in simple terms, an AND gate with inversion at both the inputs and output. Via DeMorgan's theorem, an AND gate with inverted inputs is a NOR gate, and if we add the inversion of the output, we're back to an OR gate.

So a literal answer to your question would be to buy an OR gate such as a 74AHC1G32. Or if you'll take four of them to get a breadboadable 14-pin DIP package, an 74AHC32. The "AHC" letters represent one logic family with a wide supply range; depending on your actual needs many others will suit.

However, given that you seem to be trying to ultimately do motor control, in the end you'll probably have an MCU in the system.

And at that point, it makes far more sense to run the two sensors into distinct MCU pins, and implement the required logic function in software.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks! I'm trying to keep the circuit as simple as possible, so if I can do without an MCU and software, and just have two Hall sensors + maybe a handful of basic components to do the job, that would be ideal. Would this be easier if I found an output high sensor instead? \$\endgroup\$
    – kregus
    Oct 14, 2020 at 18:46
  • \$\begingroup\$ You will certainly find this far more compact with an MCU than without! \$\endgroup\$ Oct 14, 2020 at 18:53
  • \$\begingroup\$ The AHC gate won't work with 12v signs of course, you hadn't originally mentioned that... \$\endgroup\$ Oct 14, 2020 at 18:59
1
\$\begingroup\$

Please do not show a positive voltage supply as Vee, and show it at the top of the schematic. Both of those actions suggest it is a negative voltage wrt ground.

The output of the 3144 is an open-collector NPN transistor, so you have built a wired-OR gate (inverted output).

If you want an AND gate, you can add pullup resistors to each output (eg. 10K to Vcc) and use a NOR gate with the LED + resistor from the gate output to ground (active high).

The logic family (if any) that will work depends on the Vcc voltage. At ~5V you could use a 74HC02.

Alternatively, and for voltages up to 15V or more, you could use a discrete circuit such as:

schematic

simulate this circuit – Schematic created using CircuitLab

Both inputs have to be low for the output to be low (opposite of the above) and thus for the LED to illuminate (since it is connected between output and Vdd).

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Thanks! The schematic was done in under a minute for this post, but you're totally right of course :-) My power supply is 12V. I'll look into the discrete circuit, although I somehow was hoping that the Hall sensors could be used "as the transistors" so to speak, to keep the component count to a minimum. \$\endgroup\$
    – kregus
    Oct 14, 2020 at 18:51
  • \$\begingroup\$ A NOR gate would have to drive the LED anode rather than the shown cathode, but such of course will work. \$\endgroup\$ Oct 14, 2020 at 18:55
  • \$\begingroup\$ @Spehro Pefhany, I like your solution very much! Cheers. \$\endgroup\$
    – tlfong01
    Oct 15, 2020 at 0:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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