0
\$\begingroup\$

I thought this would be a simple problem with lots of answers but alas, here I am :-) I have a throttle pedal with a Hall sensor (3 wires) that I want to connect to an ESP8266 (Node MCU) microcontroller.

The problem is that the sensor doesn't work properly if I supply it with the 3.3V output from the ESP8266. Using an external power supply with 5V seems better for the sensor (I can see on my DMM the voltage going from 0.8V to about 4.3V when I press the pedal). But the ADC on the Node MCU only supports 0-3.3V (well normally it would be 0-1V but it has an internal divider).

So, the Hall sensor pedal shows about 0.865V at rest (pedal not pressed) and 4.3V with the pedal fully pressed. I want to "shift down" the voltage range such that at rest is close to 0V and fully pressed is no more that 3.3V so I can connect it to the controller without frying the ADC.

I read somewhere that an op-amp might help. I could not find something concrete (a schematic) that will work for this particular case. I also looked at resistor dividers but they don't seem to shift the voltage range properly.

I'm sure somebody else solved this before me :-) Please help!

TIA

\$\endgroup\$
2
  • \$\begingroup\$ A simple resistor divider should suffice. I hope you’re not using this for any safety related application. \$\endgroup\$
    – Kartman
    Sep 7, 2022 at 12:49
  • \$\begingroup\$ As @Kartman said, a resistive divider is good and has the benefit, that you have a "pedal present" info if there is at least the minimum voltage. \$\endgroup\$
    – Jens
    Sep 8, 2022 at 2:15

1 Answer 1

0
\$\begingroup\$

You can use an opamp adder circuit to do this (subtracting is just adding a negative value). But there might be an even simples solution.

The easiest (even if not the most precise one) is probably just adding 2 diodes in series to drop the voltage slightly.

schematic

simulate this circuit – Schematic created using CircuitLab

Each diode will drop the voltage by about 0.5V to 0.7V which would bring you into the desired voltage range.

A more advanced version would be an adder with an opamp.

schematic

simulate this circuit

$$Vout = ((Rf/Rin)*(HS-Vneg))$$

The interesting Part here ist the -Vneg. So you wire +1V (or whatever offset you want to subtract) to the Vneg input and it should work...

\$\endgroup\$
3
  • \$\begingroup\$ Thank you. Why is R1 (10K) necessary in the diode setup? Just curious, trying to learn... \$\endgroup\$
    – Florin T.
    Sep 8, 2022 at 5:08
  • \$\begingroup\$ @FlorinT. for diodes to have the desired voltage drop there has to be a current. Now I have no clue what the input of your ADC looks like so I added a bias resistor to make sure there is a small current trough the diodes at all times. \$\endgroup\$
    – kruemi
    Sep 9, 2022 at 4:12
  • \$\begingroup\$ I've also added a capacitor parallel to R1 (I suggest something in the range of 100nF to 10uF). This has two reasons. 1st it helps reduce high frequency noise and 2nd helps to reduce the influence of the ADC. Many ADC (especially if they are multiplexed) have a capacitive load on the input which can influence the input signal and also lead to crosstalk between inputs if they are not really low impedance. \$\endgroup\$
    – kruemi
    Sep 9, 2022 at 4:20

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.