Page 1 of 1

Connect ADC to raspberry Pi

Posted: Wed Apr 20, 2016 3:07 pm
by jojo92
Hi
I was just wondering is there a difference on the the GPIO pins? I want to connect 8 pins of an ADC converter to my raspberry pi but now sure does it matter where i connect it.

Re: Connect ADC to raspberry Pi

Posted: Wed Apr 20, 2016 3:33 pm
by MarkHaysHarris777
jojo92 wrote:Hi
I was just wondering is there a difference on the the GPIO pins? I want to connect 8 pins of an ADC converter to my raspberry pi but now sure does it matter where i connect it.
GPIO stands for ¨general purpose input output¨

That said, you can connect the GPIO in a number of ways ´manually´ to read/write the adc|dac. Many adc|dac chips are designed for SPI, and you can connect the adc|dac to the standard SPI pins for use with the SPI library.

Read the spec sheet of the adc first. Study the SPI setup (if applicable) and then decide if you want to try to write your own (spi) or if you want to use the libraries. I will warn you, adc is tricky. And, further be warned that some adc chips have an eeprom that you can destroy by writing to the chip incorrectly; so make sure that you know what you´re doing.

Find examples on-line, and study what other people have already made work. Sometimes the adc makers will provide examples for you to study.

Re: Connect ADC to raspberry Pi

Posted: Wed Apr 20, 2016 6:40 pm
by jojo92
Are certain GPIO's SPI? The ADC i want to connect is ADC0804LCN. It just says that the converter appears as a memory location or I/O port and no interfacing logic is required. So would i be right in saying you could connect the pins to any GPIO pin.

Re: Connect ADC to raspberry Pi

Posted: Wed Apr 20, 2016 8:04 pm
by joan
As you say it's not a SPI device (most ADCs used on the Pi are probably SPI or I2C based).

You can use any spare GPIO. I presume you'll need at least 10 (8 data, 2 control).

Why not just use an MCP3008 etc.?

Re: Connect ADC to raspberry Pi

Posted: Wed Apr 20, 2016 8:12 pm
by jojo92
Thanks.
Just because i don't have one :(

Re: Connect ADC to raspberry Pi

Posted: Thu Apr 21, 2016 12:53 pm
by ben_nuttall
Which ADC is it?

The GPIO Zero library for Python supports multiple ADC chips, such as the MCP3008, which makes the software side really easy to use. See docs and examples.

Re: Connect ADC to raspberry Pi

Posted: Thu Apr 21, 2016 12:59 pm
by joan
ben_nuttall wrote:Which ADC is it?

The GPIO Zero library for Python supports multiple ADC chips, such as the MCP3008, which makes the software side really easy to use. See docs and examples.
Unfortunately the OP's device isn't SPI or I2C (or serial of any form).

The ADC0804LCN delivers its reading on 8 parallel pins.

Re: Connect ADC to raspberry Pi

Posted: Thu Apr 21, 2016 1:10 pm
by plugwash
jojo92 wrote:Are certain GPIO's SPI? The ADC i want to connect is ADC0804LCN. It just says that the converter appears as a memory location or I/O port and no interfacing logic is required. So would i be right in saying you could connect the pins to any GPIO pin.
You could, depending on what you are doing on the software side it may be easier/faster to have the data pins on consecutive GPIO pins to reduce the ammount of bit-fiddling needed.

You also need to pay attention to voltages, the ADC0804 is a 5V part. The Pi's inputs are not 5V tolerant, so you will need to level shift the outputs (I expect at least for slow operation voltage dividers will be fine) before feeding them into the pi.