Electronic – MCP3008 alternative

adcintegrated-circuitraspberry pispi

I have some analog devices like LDR, temperature sensors, and other sensors and I want to use the readings of these sensors in my raspberry pi B+ , for that I need an ADC , to convert the analog signals to digital and then transmit them to the rpi. I've searched about it and got this IC name – MCP3008 , which is an ADC with SPI interface, so I would require the MCP3008 IC with the SPI cable. the problem is that, here in kolkata I cannot find any local electronic store that has this IC in their stock. I have to buy it from online stores like mouser.com or digikey.com, but they are too costly, nearly 42$ for just shipping 1 piece. here comes the question.

Is there any alternative circuit design that I can do without MCP3008?

Best Answer

There are many many different ADC chips available. Most major IC manufacturers make them - TI, Analog Devices, Maxim, to name but a few. There's literally thousands of different ADC chips available.

To convert an analog value into a digital value you need an ADC. It is possible to build an ADC out of simpler building blocks, and there are lots of different designs.

One of the simplest is a comparator and a sweeping voltage. It's not fast, but requires very few components.

Basically you have to generate an analog voltage from your Pi. This could be a filtered PWM signal, as long as it's well filtered and stable.

You then sweep that voltage from 0V up to 3.3V a step at a time, and use a comparator to compare that voltage to your incoming voltage. When your sweep voltage reaches the incoming voltage you then know what the incoming voltage is.

For best results you want a "Rail-to-Rail Input/Output" OP-Amp.

schematic

simulate this circuit – Schematic created using CircuitLab

enter image description here

You can also generate the sweep voltage using a DAC (Digital to Analog Converter). This can give a more reliable voltage than filtering PWM, and a simple one can be made from just resistors in the form of what is called an "R-2R Ladder" DAC. It requires one GPIO for each bit of resolution you want in your DAC:

schematic

simulate this circuit

The actual resistor values don't matter that much, as long as you have one set as exactly twice the resistance as the other set, so 1K/2K, 10K/20K, 4K/8K, etc. Also keep the resistors at no more than around 10% the input impedance of the op-amp you want to use. 1K/2K is simple enough to get hold of and a good value to use (Hint: 2K resistors could be two 1K resistors in series).

I will leave the rest to your imagination.