novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jan 28, 2016 1:02 am

I'm connecting WaveShare High-Percision AD/DA http://www.waveshare.com/wiki/High-Prec ... D/DA_Board with ADS1256 24bit ADC to a RaspberryPi 2B. I used Waveshare example code to create my own code to test it. I have the PI connected to a WiFi dangle, 5V 2A power adapter keyboard and a LAN cable. I get lots of noise from the device.Waveform Figure below shows the digital output with red arrows showing examples of the noise spikes (other spikes are also noise). The code reads the samples and each second create a file and send it to a ringbuffer. A different code on a remote client then reads the data from the buffer and present it as you see in the figure. I get similar noise patterns if the PI is only connected to the power adapter and have the client installed locally, saving the data to a file (no WiFi,LAN,keyboard etc.). I think this problem is due to non-stable power supply from the PI to the converter. Does anyone know of such a problem? Any solution suggestion?
Thanks, Ran
Screenshot.png
Figure
Screenshot.png (50.45 KiB) Viewed 13946 times
Raspberry PI 2B, Raspbian Jessie RT patched.

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

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jan 28, 2016 8:44 am

If it was a non-stable power supply wouldn't you expect spikes at a much higher frequency? They seem to be every second or so.

I understand that using a 24 bit ADC properly is very difficult and the circuits around the ADC need to be carefully designed. What have you done to prevent noise from getting into the system.

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jan 28, 2016 6:39 pm

Hi Joan,
Thanks for the reply. I used the Waveshare board so I assumed the circuits are properly designed and did nothing but connecting the board (that already has the ADC embedded into it) to the PI. The only thing I changed with their example code is that I read the digital output at 100 SPS and every 1 sec I convert the data and send it to a socket. When that happens, I believe the PI is using more resources as CPU, network etc and use more power. Less power is available to the board and to the ADC. this explains the timing of the power drops and their nature (drop, not oscillations).
Do you think my explanation is reasonable? can you suggest other explanation? do you have a possible fix to that problem or any other example to this kind of behavior? and idea how to test that this is actually the problem?

Cheers,
Ran
Raspberry PI 2B, Raspbian Jessie RT patched.

TimEllershaw
Posts: 1
Joined: Sat Jan 30, 2016 6:11 pm

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sat Jan 30, 2016 6:17 pm

( Sorry for hijacking your thread )

Any chance you could point me towards the example code you found for the WaveShare board please ?
It looks to be a nice little board, but the instructions are terrible ! They, talk about a ADS1256 folder and ads1256_test application but don't say where to get it from.

Thanks very much.
Tim.


rzusman
Posts: 346
Joined: Fri Jan 01, 2016 10:27 pm

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sat Jan 30, 2016 11:42 pm

Without a scale, that screenshot is kind of useless.
How many bits are those noise spikes?

rzusman
Posts: 346
Joined: Fri Jan 01, 2016 10:27 pm

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sat Jan 30, 2016 11:48 pm

To further elaborate:
24 bits is one part in 16,777,216.
If your reference voltage is 5v, then 1 bit is 5/16,777,216 or 298 nanovolts.
So, 8 bits of noise is only 76 microvolts.

I think that you are unlikely to get better than 16 bits of usable data without serious attention to power supply design, shielding, references, and amplification.

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sun Jan 31, 2016 12:47 am

Hi Rzusman,
Yes. I think you have a point here. On the left of the screenshot there are two numbers - the mean value and the offset of that value. These numbers are in counts (24bits are as you said are 16,777,216 or +/- 8,388,608). In this case, the offsets are 15,605.5 which is less than 1% of 4.22444E+06. The specs of the converter are noise-free of 17 bits at worst case (in my case should be around 18bits) .

So I guess should have expected noise of that kind of level?

Cheers,
Ran
Raspberry PI 2B, Raspbian Jessie RT patched.

rzusman
Posts: 346
Joined: Fri Jan 01, 2016 10:27 pm

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sun Jan 31, 2016 2:07 am

It might be worth tracking down the source of those "big" noise spikes.
It would require a decent oscilloscope - I would probe around until I found something that looked similar to the digitized signal you got. What input where you sampling when you got this data?

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Wed Feb 10, 2016 9:35 pm

OK. After some work I confirmed the source of the noise is the unstable power from the RPI - whenever the RPI use power for i.e. wifi, processing etc. there is a power drop of the converters output. My input is LIS344ALH sensor. When I connect it to an outside power and measure its output - there is no problem, BUT! when I connect the sensor to the converter, The 3rd channel gives wrong measurement. event if I connect it to any of the other channels the output is wrong.
Does anyone have any experience with this converter and can verify it worked correctly?

Cheers,
Ran
Raspberry PI 2B, Raspbian Jessie RT patched.

User avatar
brekee12
Posts: 335
Joined: Wed Feb 03, 2016 3:36 pm
Location: HU

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Wed Feb 10, 2016 10:35 pm

Hi,

I am sure the spikes caused by wifi dongle. I worked with ADs and experienced the same thing with the 5V power supply.
It is not easy to build such supply converting high ratio 230V AC to 5 V DC with such good quality your AD require. You have chance:
- to switch to cable, which use less power so spikes will be at least lower
- use a strong filter which also not easy because you will get high value capacitor and inductor for low frequencies (wifi dongle works in msecs)
- use separate analog powersupply for the board

Anyway, high resolution is attractive and promissing especially with easyness of use, but think INL which in reality gives best cases 16 bit, so do not make big dreams. Sorry if I make you sad.
Regards,
Brekee12
on a Raspberry B+ with whezzy, two Zero with Jessie Light

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Wed Feb 10, 2016 10:59 pm

Thanks for the reply. I understand that effectively, the resolution would be 18-20bits. However, now I face a different problem - Only the first two channels get correct readings. The third channel of my sensor gives me wrong output. I was wondering if the board is wrongly designed or if its something else.
Cheers,
Raspberry PI 2B, Raspbian Jessie RT patched.

SherlockHao
Posts: 6
Joined: Thu Jun 02, 2016 2:04 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jun 02, 2016 2:15 am

Hi Dude, I am using the same AD/DA adc with RPI 3. But I cannot get any output from when I run the source code. I double checked the required libraries. I am trying to modified the source code to get any output from my screen but failed. I didn't connect any pins just put the AD/DA adc on the RPI 3. Here is what I got.

ASD1256 Chip ID = 0x255

ID=
Error, ASD1256 Chip ID = 0x15
0=FFFFFF, -1 ( 0.000 000 V)
1=FFFFFF, -1 ( 0.000 000 V)
2=FFFFFF, -1 ( 0.000 000 V)
3=FFFFFF, -1 ( 0.000 000 V)
4=FFFFFF, -1 ( 0.000 000 V)
5=FFFFFF, -1 ( 0.000 000 V)
6=FFFFFF, -1 ( 0.000 000 V)
7=FFFFFF, -1 ( 0.000 000 V)


Appreciate any response!

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jun 02, 2016 9:45 pm

Hi,
Did you connect the jumpers?
use jumpers to connect AINCOM-AGND, AD1-LDR, AD0-ADJ, 5V-VCC, 5V-VREF
Raspberry PI 2B, Raspbian Jessie RT patched.

SherlockHao
Posts: 6
Joined: Thu Jun 02, 2016 2:04 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Fri Jun 03, 2016 11:02 pm

Hi Novitsky,

Thank you for your reply!\

I have connected these pins! (See attached Fig 1) And the results are still the same.

I have checked the data from the SPI in ADS1256_test.c. It seems like in function ADS1256_Recive8Bit(), the value of read is always equals to 0xff which is in the function bcm_spi_transfer(0xff). I don't understand this. I think the value of read should be the digital output from the ADC.

Additionally, I wanna use the ADC and raspberry Pi 3 to read the analog data from a microphone(https://www.adafruit.com/product/1063). The output of the microphone is around 2.25v.

Thanks a lot!
Attachments
Fig 1.JPG
Fig 1.JPG (33.05 KiB) Viewed 13194 times

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sat Jun 04, 2016 4:14 am

An output of 2.25v shouldn't be a problem. However, it looks like there is a problem with the connection or something - you got an error on the ID reading. Did you enable SPI in the device tree of the RPI? you might want to add to the the /boot/config.txt:
# for RPI 2B:
sudo echo “device_tree=bcm2709-rpi-2-b.dtb” >> /boot/config.txt
# for RPI 3B:
sudo echo “device_tree=bcm2710-rpi-3-b.dtb” >> /boot/config.txt

Cheers,
Ran
Raspberry PI 2B, Raspbian Jessie RT patched.

SherlockHao
Posts: 6
Joined: Thu Jun 02, 2016 2:04 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Tue Jun 07, 2016 2:43 pm

Hi Ran,

I tried enable the SPI again following their instruction,
Installing the library spidev (SPI functions). Copy the installation package spidev to your RPi board, and unzip it. Enter the unzip file under the terminal, and run the following command to install the library:
sudo python setup.py install

and enable the I2C.

And I also followed your suggestion, but the results are still error.

BTW, I have a question. For RPI 3 we install BCM2835 library. But why should we add sudo echo “device_tree=bcm2710-rpi-3-b.dtb”. In their instruction for i2C, they said we should add i2c-bcm2708 to the /etc/modules. But they said we only have to install library for BCM2835 instead of BCM2710 and BCM2708. Is this the reason I cannot get the correct results?

Best Regards,
Yiya Hao

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Tue Jun 07, 2016 9:54 pm

I'm not sure you need SPIDEV at all for the High-Percision AD/DA.
I followed these steps:
# connect ADC
# Connect the High-Precision AD-DA Board to the Raspberry Pi.
# set jumpers (http://www.waveshare.com/wiki/High-Prec ... D/DA_Board)

Code: Select all

Jumper settings:
Set the Power Supply to 5V: connect the pin 5V and VCC.
Set the Reference Input Voltage to 5V: connect the pin 5V and VREF.
Set the Potentiometer output as an Analog Input: connect the pin ADJ and AD0. Make sure the left side Sensor Interface AD0 is disconnected.
Set the LDR output as an Analog Input: connect the pin LDR and AD1. Make sure the left side Sensor Interface AD1 is disconnected.
Connect AINCOM to AGND. When using AD for differential measurements, the common input
AINCOM does not need to be tied to ground.
# install wiringPi

Code: Select all

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
cd ..
# install bcm2835 library

Code: Select all

wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.??.tar.gz
tar zxvf bcm2835-1.??.tar.gz
cd bcm2835-1.??
./configure
make
make check
make install
# configure enabled SPI,I2C,device tree

Code: Select all

raspi-config
# Add device tree to /boot/config.txt
# for RPI2:

Code: Select all

echo “device_tree=bcm2709-rpi-2-b.dtb” >> /boot/config.txt
# for RPI3:

Code: Select all

echo “device_tree=bcm2710-rpi-3-b.dtb” >> /boot/config.txt
# Install 7z package

Code: Select all

apt-get install p7zip-full
# Reboot
# get test codes:

Code: Select all

wget http://www.waveshare.com/w/upload/5/5e/High-Precision-AD-DA-Board-Code.7z
7z x High-Precision-AD-DA-Board-Code.7z
cd High-Precision-AD-DA-Board-Code/Raspberry/ADS1256
make
./ads1256_test
Raspberry PI 2B, Raspbian Jessie RT patched.

SherlockHao
Posts: 6
Joined: Thu Jun 02, 2016 2:04 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Wed Jun 08, 2016 4:32 pm

Thanks for your reply!

Can I know what is the Install 7z package?

Yiya

novitsky
Posts: 25
Joined: Sun Oct 06, 2013 12:22 pm
Contact: Website

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Wed Jun 08, 2016 4:37 pm

Yes,
It is for unzipping 7z files as the High-Precision-AD-DA-Board-Code.7z
see here: http://www.7-zip.org/7z.html
Raspberry PI 2B, Raspbian Jessie RT patched.

SherlockHao
Posts: 6
Joined: Thu Jun 02, 2016 2:04 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jun 09, 2016 4:41 pm

Hi Ran,

Oh, got you! I used USB flash to put the source code to RPI.
I tried all your steps, but It's still not working. I decide to contact WaveShare. And I will update my progress.

BR,
Yiya

senovr
Posts: 3
Joined: Sat Jun 25, 2016 8:48 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Sat Jun 25, 2016 8:51 am

Novitsky,
Can you please share your modified code and advise how I can change sample code?
I am connecting Waveshare's temperature-humidity sensor to the AD2 input of ADC, and want to:
1. Point code for gettign data from AD2
2. Modify the sampling rate
3. Modify the sensitivity of ADC to 24 bits
4. Save results in file ( either txt or csv will work)

Thank you in advance!

Chen Peng
Posts: 1
Joined: Thu Sep 17, 2015 11:02 pm

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Thu Jun 30, 2016 1:57 am

Hi Yiya,

Have you finished the analog reading? I have tried the same process and I am still not getting the result. Do you have any updates?

Best

Chen

Hateful7
Posts: 3
Joined: Wed May 04, 2016 9:42 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Mon Jul 04, 2016 12:52 pm

Hello,

to everybody who has problems at getting anything back from the High-Precision AD/DA board with the waveshare example code (like SherlockHao has had them. The board did not return the chip id): I had the same problems. Initially i tried to use the bcm2835-1.5 version, which caused an compilation error because of some delay function. I then made my own delay function, it compiled but it still did not work.
Today i tried it again with bcm2835-1.45 and it works. Seems like the version of that library is very important. It compiled with version 1.5 but the program just worked forever with no output.

I hope that i could help someone with this

Zoka
Posts: 1
Joined: Tue Jul 05, 2016 8:52 am

Re: WaveShare High-Percision AD/DA (ADS1256) with RPI 2B

Tue Jul 05, 2016 9:31 am

Hi all,
for everybody who reads zeroes. I didn't use this IC, but, according to datasheet... bla, bla,...that chip has internal sensor control circuit for open - short input detection. Based on that, multiplexer chooses which input port to read. If you keep all them unconnected, what is the result?
I hope this will help...
Best regards,
Zoran

Return to “Troubleshooting”