Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
Hi, I want to record the AC current time stamp data into my RaspberryPi from current sensor (WCS1600) via an ADC(ADS1015) that is being supplied to my mobile.
Herewith I have attached a schematic diagram of the setup.
from Adafruit_ADS1x15 import ADS1x15
import time
import numpy as np
import matplotlib.pyplot as plt
pga = 1# Set full-scale range of programable gain amplifier
ADS1015 = 0x00# Specify that the device being used is ADS1015
adc = ADS1x15(ic=ADS1015) # Create instance of the class ADS1x15 called adc# Function to print sampled values to the terminaldeflogdata():print"sps value should be one of: 128, 250, 490, 920, 1600, 2400, 3300, otherwise the value will default to 1600"
frequency = 1000# Data rate in Hz
sps = 3300# maximum sps value for ADS1015
time1 = 10# how long to sample in seconds
period = 1.0 / frequency # Calculate sampling period
datapoints = int(time1*frequency) # Datapoints is the total number of samples to take, which must be an integer
dataarray=np.zeros([datapoints,2]) # Create numpy array to store value and time at which samples are taken
adc.start_adc(0, pga, sps) # Begin continuous conversion on input A0
startTime=time.time() # Time of first sample
t1=startTime # T1 is last sample time
t2=t1 # T2 is current time
V_dd = 3.3# ADS1015 is powered with 3.3V from RPi
n = 12# No. of bits in ADS1015
senstivity = 0.022# Sensitivity of WCS1600 in V/Afor x inrange (0,datapoints) : # Loop in which data is recorded
dataarray[x,0] = time.time()-startTime # Store the sample time in the numpy array
dataarray[x,1]= ((adc.get_last_result())*(V_dd)/(2**n))/ senstivity # Get the result in Amperes of the last conversion from ADS1015 and store in numpy arraywhile (t2-t1 < period) : # Check if t2-t1 is less then sample period, if it is then update t2
t2=time.time() # and check again
t1+=period # Update last sample time by the sampling periodreturn (dataarray)
dataSamples = logdata() # Call function to log data# Plot time data
TIME = dataarray[:,[0]]
CURRENT = dataarray[:,[1]]
plt.plot(TIME,CURRENT 'r', linewidth=1)
plt.xlabel('Time (s)')
plt.ylabel('Current (A)')
The input side the charger reads (110-220 V, 50 Hz, 0.3A).So we can expected a sinusoidal wave for the current time stamp with maximum current restricted to 0.3A.
However, on plotting the time vs current below graph is achieved which is obviously wrong:
I never dived into current measuring, so I am not sure if this is relevant or not. First thing I thought was measuring current (A) versus voltage (V). But I suppose both are sinus shaped.
The next though I had is that the sensor's purpose was to measure the load (A) on a wire, so maybe the sensor is actually making it a flat line already? I honestly have no clue, this is just me guessing.
IINA VideoPlayer One of the best media players for MacOS X - it's free and a great alternative for, and more stable than, VLC.
NAPS2 - Not Another PDF Scanner 2 Wonderful simple and reliable scanner application for Windows users. This still depends on your Windows having the proper scanner drivers installed, but it makes scanning to images or PDFs a lot easier.
MalwareBytes Probably one of the best tools to prevent and remove all kinds of malware and viruses on Windows and MacOS X.
RegExr Awesome website to play and experiment with regular expression!
Find Any File (FAF) [Shareware] Find any File, even when Spotlight fails (eg. your network shares)
Photopea A free alternative to Photoshop (pretty close anyway), and runs in your browser - this works surprisingly good!
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
RenameMyTVSeries-2.3.2-QT5-Linux-x64-static-ffmpeg.tar.xzDate: 2025-07-10 - Size: 78.3 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle comews with rather large static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.2-QT5-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-07-10 - Size: 1.9 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.2-GTK-Linux-x64-static-ffmpeg.tar.xzDate: 2025-07-10 - Size: 78.3 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle comes with (large) static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.2-GTK-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-07-10 - Size: 1.9 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.2-Windows-x64-setup.exeDate: 2025-07-10 - Size: 48.8 MBRename My TV Series, for Windows (Intel 64 bit), a tool to assist in renaming TV Show episode files. Static builds of ffmpeg and ffprobe are included.
RenameMyTVSeries-2.3.2-macOS-Universal.dmgDate: 2025-07-10 - Size: 98.5 MBRename My TV Series, for macOS (Universal binary for Apple Silicon ARM and Intel 64 bit), a tool to assist in renaming TV Show episode files. Static universal binary builds of ffmpeg and ffprobe are included.
Downloads Page Find these and more Downloads on the Downloads Page, where you will also find articles references, operating system requirements and categories.
Amazon Ads
Support us by doing your shopping at Amazon.com, either click the link, or click one of the links below …
You can also sponsor us through these Amazon offerings:
Please consider disabling your ad blocker for our website.We rely on these ads to be able to run our website.You can of course support us in other ways (see Support Us on the left).