Skip to content

Python Code designed on Raspberry Pi 0W to gather ADC samples.

License

Notifications You must be signed in to change notification settings

SRKadam1/RaspberryPi_ADS1115

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RaspberryPi_ADS1115

This Python (not CircuitPython) code is intended for collecting continuous, differential Analog-to-Digital Converter (ADC) counts with a timestamp.

The Raspberry Pi will collect data and save to a csv file as long as it receives a HIGH signal. The code is cyclic; once it has been started from the terminal, it will repeat the process of waiting, collecting data, and storing data until interrupted.

Equipment

Setup

The microcontroller-ADC wiring is described in Adafruit's tutorial.

This code assumes two microcontrollers. The first is controlling some process which produces analog measurements. The second is a Raspberry Pi communicating with the ADS1115 chip. Since both mirocontrollers control events on independent timelines, timestamps are created to correlate the two chronologies.

Usage- Sampling Rate

Generally, this code returns 820 samples per second. The ADS1115 datasheet sets an upper limit of 860 samples per second. While the Raspberry Pi's bus speed can be changed from the default 100000 to 400000 ((https://www.raspberrypi-spy.co.uk/2018/02/change-raspberry-pi-i2c-bus-speed/)), doing so does not positively impact the sampling rate of the afore-described setup. It results in ADC data being read by the Raspberry Pi multiple times (data duplication).

If you are willing to trade precision for speed, the ADS1015 is a 12-bit ADC with an upper limit of 3,300 samples per second.

Notes

Please see the examples in Adafruit's ADS1115 Python library for explanations on how to alter I2C addresses, ADC conversion speeds, PGA, etc.

A detailed explanation of I2C is provided in the ADS1115 datasheet, but a nice job of explaining I2C and its relevance to microcontroller-ADS1115 communication and code can also be found here.

If you are interested in using CircuitPython or Arduino, check out Adafruit's newer tutorial.

About

Python Code designed on Raspberry Pi 0W to gather ADC samples.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages