1
\$\begingroup\$

I'm looking to capture the output of some Hall Effect sensors on a microcontroller/SBC, operating at a logic level of 3V3.

The Hall Effect sensor voltage range could be 0-5V, 0-9V or 0-12V. What is the recommended means for shifting a variable voltage to 3V3? Would a simple LDO regulator (such as the LM2936-3.3) be sufficient? Would a comparator (such as the LM339) be another option? The square wave frequencies will be in the range of 20Hz - 400Hz.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Are the sensor power supplies variable or the output voltage? If the latter just uses resistor dividers. \$\endgroup\$
    – Oldfart
    Jan 14, 2018 at 23:10
  • \$\begingroup\$ The sensor power supplies are variable. I.e. sensor A may be tied to a 5V supply, whereas sensor B might be 12V. I won't have any way of knowing, so I need to be able to cater for both 0-5V and 0-12V square wave outputs. \$\endgroup\$
    – jars121
    Jan 14, 2018 at 23:39
  • \$\begingroup\$ Please add automotive aspects to question. | Schmitt trigger inputs will help in a noisy environment. \$\endgroup\$
    – Russell McMahon
    Jan 18, 2018 at 11:22

2 Answers 2

3
\$\begingroup\$

There are numerous ways to do that for a signal that is guaranteed to start ot zero volts.

Here are two simple ones.

schematic

simulate this circuit – Schematic created using CircuitLab

schematic

simulate this circuit

UPDATE

Sine you are now mentioning this is for an automotive application you would be wiser to use opto-couplers instead of simple passive components.

schematic

simulate this circuit

D1 adds some transient suppression on the front of that and protects the LED from reverse voltages.

\$\endgroup\$
15
  • \$\begingroup\$ Thanks Trevor. What if the sensor output voltage drops below 0V in the first circuit you posted? \$\endgroup\$
    – jars121
    Jan 15, 2018 at 0:31
  • \$\begingroup\$ No CPU/MPU can tolerate a negative voltage when it only has a positive supply voltage. A schottkey diode (1N5817 or 1N5822)at the CPU input will clamp negative voltage to -0.5 volts. Diode anode goes to CPU ground/Vee. \$\endgroup\$
    – user105652
    Jan 15, 2018 at 0:43
  • 1
    \$\begingroup\$ It sure is, thank you for your patience. I'll give the current circuit a go for the time being, and will address any noise issues in due course. \$\endgroup\$
    – jars121
    Jan 15, 2018 at 3:45
  • 1
    \$\begingroup\$ @jars121 one more thing, run the sensor cables all the way to the sensor, don't use the chassis ground for the return. Use twister pair. Shielded would be even better. \$\endgroup\$
    – Trevor_G
    Jan 15, 2018 at 3:52
  • 2
    \$\begingroup\$ @jars121, please can you edit your question and add all this automotive stuff to it. Other people will read this question and answers to learn and it's difficult for them to piece the full question together from details you've scattered across lots of comments. Thanks. \$\endgroup\$
    – TonyM
    Jan 15, 2018 at 7:25
2
\$\begingroup\$

"Anything that works" :-).
ie both your suggestions are OK and there are various others.
Convenience, cost, board area etc may have more affect once functionality is achieved.

A common method that is simple to implement at low frequencies and usable with extra design at higher frequencies is a voltage clamp.

In its simplest form Vin is fed to the uC via a resistor and a zener or clamp regulator is connected fron uC pin to ground. The clamp voltage must be high enough worst-case to always exceed uC logic 1, and low enough that Vin max will not produce excess voltage at the uC pin.

  1. The "easy way" is to use a TL431 / LM431 / ... clamp regulator. Also can be seen as a variable zener diode. These have defined accuracies, sharp turn in knees, programmable clamp voltage, lowish cost, wide availability, ... . What's noyt to like ? :-)

  2. For slightly lower cost and slightly more compact layout a zener diode and resistor can be used. The "simpler" solution will suffice but needs more design care.

it MAY be that the hall device uses an open collector/drain circuit with active pull down. If so, a clamp regulator or zener directly from output to ground may suffice, with direct connection to uC pin. Otherwise a resistor Rin from Hall to uC and a clamp or zener to ground at the uC is required.

A zener diode has a "soft knee" turn on voltage. As Izener increases Vzener_regulating rises. This is well covered in data sheets and application notes. With a 3V3 uC supply a 2V7 zener will probably suffice.

Call V at uC pin Vo or Vout

Rin should be dimensioned so as to

  • Not draw excess current with Vin = 12V
  • Not exceed Vo = 3V3 with Vin = 12V
  • Provide enough voltage at Vo when Vin = 5V
  • Not overload the Hall sensor output.

From $US0.35 each in 1's from Digikey, 9 cents in thousands. 2 or 3 cents in China in 1000's :-).

TL431 family datasheet

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for that Russel. To confirm, point 2 above regarding a diode and resistor, is that what Trevor_G's first circuit below outlines? \$\endgroup\$
    – jars121
    Jan 14, 2018 at 23:55
  • \$\begingroup\$ He later mentions this is automotive if you want to modify any of this good answer. \$\endgroup\$
    – Trevor_G
    Jan 15, 2018 at 3:28

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.