I have been trying to interface an ADC with Raspberry Pi namely AD7193 via SPI.

For that I have enabled my SPI and installed spidev on my Pi.

But I don't know what to do next in order to get the output from my ADC on terminal. how should I proceed further?

I have luckily found a driver (in C) for the ADC I am trying to interface https://drive.google.com/open?id=1W30J_SZN0c4Ap4oEjAwbs9y3p9YlRG1w, but I don't know what to do with the it.

I also tried to understand this https://ez.analog.com/message/323497-ad7193-driver-with-raspberry-pi, but I could not understand what is going on.

How can I start writing a code in c by using the drivers and where do I need to put these(drivers , if I even have to!?) files in the Linux kernel system files(I am using Raspbian on my pi3) in order to get it working from scratch?

  • There are hundreds of Raspberry Pi SPI tutorials. Perhaps looks at some for the MCP3008 to get the basic concepts.
    – joan
    Commented Apr 27, 2018 at 10:20
  • I have already checked that but that could not help me much as i am unable to understand how should i proceed with .dts files and drivers of my ADC ! Commented Apr 27, 2018 at 10:46
  • "i dont know what to do next" - neither do we, nor do we know what YOU have done.
    – Milliways
    Commented Apr 27, 2018 at 11:03
  • i have enabled the spi of my pi and installed the spidev driver in it.that's what i have done! but being a beginner i don't know how can i go further and get my adc working and give out samples to my input signals. Commented Apr 27, 2018 at 11:34
  • Is there any particular reason you must use C? You can use python to achieve the same result of read the data from AD7193 if it supports SPI. This tutorial will provide you the basic understanding on how to use spidev and communicate with SPI device.
    – hcheung
    Commented Apr 27, 2018 at 15:04

2 Answers 2


Have you read the datasheet on the AD7193? This will include enough information to tell you what data you need to send and receive.

I will admit that datasheets are a pain to read at first, but it is a necessary skill to learn. At first, they seem to give too much information, but with practice you find most of the information useful.

Raspberrypi.ord had an SPI tutorial.

SPI is just another serial interface. You send data to the DAC, you receive data from the DAC. It looks complex when you read the datasheet, but it really isn't.

  • i have an idea about the data sheet of AD7193 but my problem is how can i initiate things ? i dont know what steps do i need to follow to interface ad7193 with pi , i have already interfaced it with arduino but thats quite simple because of IDE , in pi i have the whole os so i dont know how i can do it there Commented Apr 27, 2018 at 15:26
  • You will have to read the SPI tutorial on raspberrypi.org. I linked it from my answer. I've you've done it with the Arguino, it isn't any more difficult to do this from the Pi.
    – NomadMaker
    Commented Apr 27, 2018 at 23:20
  • You might have to run raspi-config in order to run the SPI drivers on. I'd also suggest trying this from Python first.
    – NomadMaker
    Commented Apr 27, 2018 at 23:21
  • @PrabhjotSingh, if you done interface it with Arduino, then it is not difficult to interface it with RPi. I have two articles for interfacing with an LCD module which use SPI interface for both Arduino and RPi which will give you the idea on how to use SPI in both environments.
    – hcheung
    Commented Apr 28, 2018 at 1:23

I would strongly recommend you read Exploring Raspberry Pi by Derek Malloy https://www.amazon.co.uk/Exploring-Raspberry-Pi-Interfacing-Embedded/dp/1119188687/ref=mp_s_a_1_1?dchild=1&keywords=raspberry+pi+exploring&qid=1590480712&s=books&sr=1-1-catcorr

It is one of very few texts about the platform that treats it with seriously rather than as only suitable for toy projects, even up to rolling your own Linux distribution.

It deals with SPI and I2C in detail but In a comprehensible manner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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