I am currently working on sensors and I'd like to read the sensor data into my Raspberry Pi.

However, I have some difficulties with the Waveshare High-Precision-Board which

I'm using. I just don't know how to import data and use it in Python. Do I have to work with SPI? My goal is to get the differential voltage between A0 and A1.

Here are some Information about the product...

SCHEMATIC: https://www.waveshare.com/w/upload/2/29/High-Precision-AD-DA-board.pdf

PRODUCT PAGE: https://www.waveshare.com/wiki/High-Precision_AD/DA_Board

USER MANUAL: https://www.waveshare.com/w/upload/b/b7/High-Precision-AD-DA-User-Manual.pdf

What i did:

First i had a programm from waveshare that enabled me to measure the volts from the ports A0-A7. The first programm didn't work quite right so i figured out that it might be measuring something else (maybe changing signals, mine was relatively steady). The second programm which waveshare provided was exactly what i wanted. It was essentially a Voltmeter between wire 1 and wire 2. The problem: it was written in C. I needed Python.

The sensor has 3 wires. 1 ground wire and 2 signal wires (1 positive, 1 negative voltage). I need a programm that shows me the potential between the 2 signal wires just like a voltmeter.

So to get this straight. I have to use spi.open(0,0), right?

Then i surely need a sample rate and something to define the bits (the board has 24 bits). To get access to A0 and A1 (Analog Input zero and one) is additional software required? Or is it something simple like the have a GPIO-number? I don't guess so but what do i know.

  • Comments are not for extended discussion; this conversation has been moved to chat. Please note that all relevant information should be edited into the question itself not provided in the comments.
    – Ghanima
    Jul 30, 2018 at 20:48

1 Answer 1


I don't have one of these boards, but I've looked at the documentation.

Yes, you will have to learn to use SPI. I would strongly suggest at least one of the following tutorials:

  1. [PDF]SpiDev
  2. I SPI with Raspberry Pi (you might not have this hardware, but it is a useful thing to read)
  3. Controlling an SPI device with the Raspberry Pi | Takaitra.com

There should also be documentation on the Raspberrypi.org site.

You need to enable the SPI device in raspi-config.

The enable pin, more correctly called the "not chip select pin" is represented by the letters CS with a bar over them. The bar means that this pin selects one of the SPI ports when the pin is low. The CS pins are normally high. I do not know which pin selects the ADS1256 chip. You will need to experiment to find the right select. I'd start with "0" and there only a maximum number of three possible values (0, 1, 2). You don't control the state of the CS pin, the SPI peripheral does this.

You will need to pay attention to the ADS1256 datasheet starting at page 34. You really should read the rest, but page 34 lists the important registers and commands for using the SPI interface.

There is test code along with the Waveshare board. You should look at this code because it should tell you a lot about using the SPI commands.

  • Wow that really helps me a lot! I'll let you know on Monday or Tuesday what i found out! I really don't know how i can thank you :-) Jul 29, 2018 at 18:12
  • Hello! I didn't quite manage to figure it out so I just changed the C-code a little bit and made it wrote the data in a .txt file. I then programmed a python programm which read the data out of the .txt file and voila. However, I'll surely work with these kind of sensors again and I'll report back when i am actually be able to do it the common way. Jul 31, 2018 at 16:17

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.