I have a couple different types of hall effect sensors I would like to test out using an MCP3008 ADC to interface with my Pi. The sensors run on 4.5 V minimum. Before I configure the ADC for 5 volts I wanted to double check there is no danger to my Pi. I plan on connecting:

Vcc -- 5v
out -- mcp3008 ch0
ground -- ground

Vdd(power) -- 3.3 V
Vref -- 5 V
and the rest normally

Will this harm my pi?

  • From what I can see in the datasheet of the mcp3008, Vref can't be higher than Vdd. So you setup seems to be incorrect. Do you need a analog value from the hall effect sensor? In most setup an HIGH and LOW value is all that is needed. If that is the case I think you only need 1 or 2 resistors. What type of hall effect sensor do you have?
    – Gerben
    Mar 14, 2014 at 13:35
  • In this case I need the analog value, I need to know how far the magnet is from the sensor. I have two, Optek OHS3151U and A Honeywell SS495B. I tested both out on 3.3v and they work but I would like a little more sensitivity. Thanks for your reply! Mar 14, 2014 at 15:31
  • The datasheet says all inputs can handle up-to VDD + 0.6V. So if you are not really interested in the high values (between 3.3V and 5V)(in case of the OHS3151U, if you are only interested in the north pole, and not the south), you can just add a clamping diode (and resistor) to 3.3V. Preferably a schottky diode. And run the mcp3008 on 3.3v (Vdd and Vref).
    – Gerben
    Mar 14, 2014 at 17:13

2 Answers 2


First, lets check the characteristics of the MCP3008 again:

  • Single supply operation: V_dd = 2.7V to 5.5V
  • All Inputs and Outputs < V_dd + 0.6V (this should include V_ref)
  • 200 ksps max. sampling rate at V_dd = 5V
  • 75 ksps max. sampling rate at V_dd = 2.7V

So powering the MCP3008 with the Pi's 3.3V it would be out of spec to apply 5V to V_ref. It is also noteworthy (if relevant for the application) that the sampling rate increases with higher supply voltage.

This leaves us with two options to read this 5V sensor with the MCP with a linear characteristics (as compared to the suggested clamping).

MCP supply voltage 5V

Power the MCP and the sensor with 5V (V_dd = V_ref = 5V). This way the sensor will provide its highest sensitivity and the MCP is able to linearly resolve the complete range. The adaption to the Pi and its 3.3V then happens at the digital interface (the SPI interface).

From the MCP's datasheet we find that that the High Level Input Voltage has to be at least 0.7 * V_dd = 3.5V - that's higher than what the Pi's output pins can provide. The MCP's High Level Output Voltage is 4.1V (minimum) - that's too much for the Pi.

So level-shifting is necessary but since all SPI connections (SCLK, MOSI, MISO, CS) are uni-directional simplifying things a little. Outbound pins of the Pi (SCLK, MOSI, CS) need some boosting, e.g. using a 74AHCT541 octal uni-directional buffer chip or the TXB0108 (a bi-directional level shifter). MISO (input at the Pi) could be handled as simple as using a voltage divider. With the TXB0108, as it is bi-directional, all SPI connections can be routed through the same chip.

MCP supply voltage 3.3V

Power the MCP with 3.3V (V_dd = V_ref = 3.3V) - note the reduced sample rate. The sensor is powered with 5V (or more if available) but its output is fed into a voltage divider the reduce the signal to a swing of 0 to 3.3V. Just consider the output current of the sensor when selecting the resistors of the voltage divider.

On the plus side: this could be also used with higher sensor supply voltages (if there is a benefit to it such as a higher sensitivity), e.g. the SS495B could be supplied by 4.5V to 10.5V, simply adapt the voltage divider to properly interface the MCP.

  • 1
    "Just consider the output current of the sensor when selecting the resistors of the voltage divider." How can I calculate that? I'm thinking to connect the MPC this way and then connecting the MiCS-5524 but I have no clue how many resistors I should use. Can you please point me where I should look? Thanks!
    – nuc
    Mar 19, 2017 at 23:05
  • 1
    @Ghanima super helpful, thanks OP too for asking Dec 30, 2021 at 20:46

GPIO pins 2 and 4 are both 5v DC Out on pi A+, B+, Zero and Pi2/3.

Not sure if those were available at the time of writing the original question though.

The MCP3008 can handle up to 5.5v and the Allegro hall effect current sensors are good for 3.3v - 5v (max 8v).

  • 2
    Welcome. A nitpick: It's kind of a misnomer to call the power pins GPIO's ("general purpose input/output"), although they are all together on the same breakout. All models of Pi have 5V power pins, but what is at issue is the fact that it does not have 5V GPIOs, only 3.3V ones.
    – goldilocks
    Feb 13, 2019 at 7:59
  • Are you sure you're answering the question? The OP wasn't asking about Allegro sensors. Feb 13, 2019 at 8:40
  • True. I just found they are a nice option with the pi and 5v. Feb 15, 2019 at 8:56

Your Answer

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

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