jojo92
Posts: 8
Joined: Sun Mar 27, 2016 11:25 am

Connect ADC to raspberry Pi

Wed Apr 20, 2016 3:07 pm

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.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Connect ADC to raspberry Pi

Wed Apr 20, 2016 3:33 pm

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.
marcus
:ugeek:

jojo92
Posts: 8
Joined: Sun Mar 27, 2016 11:25 am

Re: Connect ADC to raspberry Pi

Wed Apr 20, 2016 6:40 pm

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.

User avatar
joan
Posts: 14470
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Connect ADC to raspberry Pi

Wed Apr 20, 2016 8:04 pm

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

jojo92
Posts: 8
Joined: Sun Mar 27, 2016 11:25 am

Re: Connect ADC to raspberry Pi

Wed Apr 20, 2016 8:12 pm

Thanks.
Just because i don't have one :(

User avatar
ben_nuttall
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 231
Joined: Sun Aug 19, 2012 11:19 am
Location: Cambridge, UK
Contact: Website

Re: Connect ADC to raspberry Pi

Thu Apr 21, 2016 12:53 pm

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.
Community Manager - Raspberry Pi Foundation
Author of GPIO Zero and creator of piwheels

User avatar
joan
Posts: 14470
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Connect ADC to raspberry Pi

Thu Apr 21, 2016 12:59 pm

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.

plugwash
Forum Moderator
Forum Moderator
Posts: 3475
Joined: Wed Dec 28, 2011 11:45 pm

Re: Connect ADC to raspberry Pi

Thu Apr 21, 2016 1:10 pm

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.

Return to “Beginners”