Author Topic: Using OH137 Hall Effect switch to trigger both 2N7002 and input for Arduino  (Read 1094 times)

0 Members and 1 Guest are viewing this topic.

Offline lesthegringoTopic starter

  • Contributor
  • Posts: 46
  • Country: qa
Hi All

As the subject line states, I need to use an OH137 hall effect switch to indicate the position of an item to both provide feedback to an Arduino input pin and also so that I can power five LED telltales. While it would be possible to output from the Arduino for the LED's I am pin limited, and the LED's only need to be powered when the OH137 is

Can I use the circuit attached to do that?

Les
 

Offline xvr

  • Frequent Contributor
  • **
  • Posts: 928
  • Country: ie
    • LinkedIn
Something like that. However, you need to use a P-channel MOSFET because the OH137 has an open-collector output that connects to ground when triggered. An N-channel MOSFET is controlled by a positive voltage, so it wouldn't turn on.
Also, the OH137 output will require a pull-up resistor (unless there is one in the Arduino itself—I’m not sure).
 
The following users thanked this post: lesthegringo

Offline lesthegringoTopic starter

  • Contributor
  • Posts: 46
  • Country: qa
Thanks for the reply!

I have used OH137 switches with Arduinos before, using the input pullup mode
Code: [Select]
pinMode(hallSensorPin1, INPUT_PULLUP); and that works fine, however I know that for example using pins A6 and A7 (on the Nano) a 10K resistor is needed plus you need analogRead instead.

Any recommendations as to the P-Channel mosfet? I would for preference want to use an SMD device ***EDIT*** I see BSS84 as a pnp equivalent, any reason why that is unsuitable?

Cheers

Les
« Last Edit: October 01, 2026, 10:04:08 am by lesthegringo »
 

Offline xvr

  • Frequent Contributor
  • **
  • Posts: 928
  • Country: ie
    • LinkedIn
Quote
Any recommendations as to the P-Channel mosfet?
My favourite - Si2301

Quote
I see BSS84 as a pnp equivalent, any reason why that is unsuitable?
It's a P channel MOSFET, not PNP. And yes, it will suite

 
The following users thanked this post: lesthegringo

Offline lesthegringoTopic starter

  • Contributor
  • Posts: 46
  • Country: qa
Hi again

Here's what I think it should look like - an OH137 is not directly available in the Kicad library, so I have used an A3144, which as it comes in SMD packaging might end up being what I end up using.

If I could ask for a sanity check on this setup, I would appreciate it. I would normally just try and make the circuit to try and see if it works but right now I am assigned away from home so don't have access, hence so many (stupid) questions on this forum. You guys have been a massive help

***Edit*** just realised the LED part of the circuit I cut and pasted in is not correct, they are supposed to be in series not parallel, apologies for not spotting it

Les
« Last Edit: October 02, 2026, 07:43:38 am by lesthegringo »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 4231
  • Country: us
A problem I see is that the voltage on the Arduino pin will be 12V when the OH137 output is open.

One way to solve the problem is to level convert the 5V signal that is sent to the Arduino to a 12V signal like as shown in the attachment. The middle MOSFET is used as a level converter as described in this article:

https://circuitdigest.com/tutorial/bi-directional-logic-level-controller-using-mosfet

Here is a Falstad simulation of the circuit:

(Falstad simulation)

If you play around with it you'll see that the toGPIO voltage remains between 0 and 5V when the OH137 turns on and off which is what you want for the Arduino.
« Last Edit: October 02, 2026, 08:29:07 am by ledtester »
 
The following users thanked this post: lesthegringo

Offline lesthegringoTopic starter

  • Contributor
  • Posts: 46
  • Country: qa
Thanks for the reply

I do actually have the option to power the LED's using a 5V power supply, there is both a 12v and a 5v rail on the board I am designing. That would simplify this, I would have to change to a parallel resistor setup but that would not be big issue as that would be off the board. I assume that would be OK?

Les
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 4231
  • Country: us
Yes, you can avoid the issue by using 5V to power the LEDs.
 
The following users thanked this post: lesthegringo


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->