ksaksasy
Posts: 1
Joined: Mon Oct 08, 2018 4:48 pm

ADC in python, change sampling time

Mon Oct 08, 2018 8:02 pm

I am new to python and also to raspberry pi, I have connected the High-Precision AD/DA Board to the RPI 3 model B, and I am looking to change the sampling time of the ADC and I am not sure if I need to change the RPI reading time as well, I have found some code such as

Code: Select all

  byte drate_reg = 3; // Choosing Data Rate register = third register.
  byte drate_data = 0b11000000; // 11000000 = 3,750SPS
  SPI.transfer(0x50 | drate_reg);
  SPI.transfer(0x00);   // 2nd command byte, write one register only
  SPI.transfer(drate_data);   // write the databyte to the register
  delayMicroseconds(10);
However when I run the sudo ./ads1256_test to verify if it is properly reading, I am getting this random voltages that are not changing even though I have run with no error the line byte drate_data = 0b11000000; // 11000000 = 3,750SPS. The reading I am getting are: Image

sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: ADC in python, change sampling time

Wed Oct 10, 2018 11:30 pm

I have no experience with that ADC, Try to add a filtering capacitor, a 0.1uF ceramic to the input channel of the ADC to smooth out the ripples.
FLOSS enthusiast, Debian user (linux-libre)

User avatar
mikronauts
Posts: 2717
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: ADC in python, change sampling time

Thu Oct 11, 2018 5:54 pm

you will get a lot of variance if you leave the input floating

Tie unused inputs to ground.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

Return to “Beginners”