EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: waj334 on April 30, 2020, 08:57:48 pm

Title: Reading 5V analog with MCP3001 on Raspberry Pi
Post by: waj334 on April 30, 2020, 08:57:48 pm
[attachimg=1]

I'm trying read a fluid level sensor that outputs 0V - 5V and decided to go with using a MCP3001 because I saw that I could give it a reference voltage. So I connected Vref pin to the 5V pin of the raspberry pi and the output of the sensor to IN+ pin on the MCP3001. I powered up the Raspberry Pi and noticed it wasn't going to boot. Upon probing the output pins of the MCP3001 I saw that CS was putting out 4.84V or so. Desoldering the chip allows th Pi to boot. Is having Vref and Vdd at different voltages ok for this chip or is the something else wrong with my circuit?
Title: Re: Reading 5V analog with MCP3001 on Raspberry Pi
Post by: SiliconWizard on April 30, 2020, 10:53:01 pm
I suggest reading the datasheet.

And short answer is: Vref should be between 0.25V and VDD. So different from Vdd yes, but higher, no.

So with Vref= 5V and Vdd = 3.3V, chances are you'll fry the poor chip.
Title: Re: Reading 5V analog with MCP3001 on Raspberry Pi
Post by: waj334 on April 30, 2020, 11:28:56 pm
Thanks for the reply!

It definitely got fried  |O. My google searches suggest that I need to use a voltage divider. I think a 2.4K and 4.7K resistor should translate it down to a range of 0V to about 3.1V theoretically (according to a calculator). Is there anything I should be considering as far as maximizing accuracy when designing the circuit? I'm not really experienced I must admit, but I'm learning a lot
Title: Re: Reading 5V analog with MCP3001 on Raspberry Pi
Post by: Ian.M on April 30, 2020, 11:50:48 pm
A 2.4K, 4.7K divider is going to be a significant load on your signal source.  If its high impedance you may need a 5V unit gain RRIO OPAMP buffer in front of the divider.  Also, the tolerance  of the resistors and accuracy of the 3.3V supply voltage directly affect the accuracy of the result.
Title: Re: Reading 5V analog with MCP3001 on Raspberry Pi
Post by: waj334 on May 03, 2020, 04:26:49 pm
[attachimg=1]

I decided to keep the sensor input and the ADC at 5V because I could get better performance out of the ADC with a higher voltage than 3.3V, so I added a level shifter IC to translate the SPI signals from 5V to 3.3V. I didn't consider noise in my original circuit or that my sensor's cable would become antenna, so I think the addition of the low pass filter was a must have though I have questions about the frequency range. I'm expecting the output of my sensor to behave like a potentiometer where full 5V = tank full and 0V = tank empty. Do I really need 500hz of bandwidth or should my ceiling be lower?
Title: Re: Reading 5V analog with MCP3001 on Raspberry Pi
Post by: SiliconWizard on May 03, 2020, 04:33:44 pm
I didn't check the details of your schematic, but your approach looks correct to me.

As to filtering, I don't know about the specific sensors you're using, but generally speaking, for fluid level sensing, I would go for a much lower frequency. 1Hz to 10Hz should be adequate (or maybe even lower), unless you need to monitor very fast level changes (which I doubt?)