Reputation: 1
See attached my waveform of input to channel of ADS1115, my code, and my output that I am getting
I cannot get the output matplotlib waveform to plot smoothly like my input waveform from oscilloscope
Input frequency is 50Hz Code -
import matplotlib.pyplot as plt
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import board
import busio
import numpy as np
import time
i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS.ADS1115(i2c,gain=1,data_rate=860)
ads.data_rate=860
Channel0 = AnalogIn(ads, ADS.P0)
times = []
voltages = []
start_time = time.time()
while True:
current_time = time.time() - start_time
voltage0 = Channel0.voltage
times.append(current_time)
voltages.append(voltage0)
plt.clf()
plt.plot(times, voltages)
plt.xlabel('Time (s)')
plt.ylabel('Channel Voltage (V)')
plt.title('Voltage over Time')
plt.pause(0.005)
This is the input waveform:
This is what I'm getting:
I was expecting the output waveform to still have same sinusoidal output.
Upvotes: 0
Views: 25