1
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ Unfortunately, recommendations for specific products are off topic in this forum and the question will be closed. \$\endgroup\$ – tcrosley Feb 28 '15 at 10:35
  • 1
    \$\begingroup\$ You could ask your local electronics stores for any ADC chip, with a SPI, I2C or even parallel interface. It is impossible for us to guess what they might have available. \$\endgroup\$ – Wouter van Ooijen Feb 28 '15 at 10:59
  • 1
    \$\begingroup\$ I also asked if there is any alternate circuitry for doing what I intend to do. \$\endgroup\$ – shiladitya basu Feb 28 '15 at 11:08
  • 1
    \$\begingroup\$ There, edited! Not a shopping question anymore. \$\endgroup\$ – Ricardo Feb 28 '15 at 11:29
3
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

The easiest way might be to use an arduino!

Use the analog in pins on the arduino, and run a little code inside it. This will also help a lot if you want to do anything in real-time, or react to any interrupt sources.

If you can get hold of a raspi, I'm sure you can get an arduino.

\$\endgroup\$
  • \$\begingroup\$ What if I dont want to use arduino? \$\endgroup\$ – shiladitya basu Feb 28 '15 at 11:08
  • \$\begingroup\$ A good option for that kind of system would be the chipKIT Pi. It's like an Arduino, but PIC32 based (much more powerful) and is designed to connect to the GPIO pins of the Pi as a daughter board. \$\endgroup\$ – Majenko Feb 28 '15 at 11:09
  • \$\begingroup\$ Another simple idea is to use a 555 timer as an ADC. They are available everywhere and are dirt cheap. Google will have many circuits for this. \$\endgroup\$ – Joel Mar 2 '15 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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