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.
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).