Jump to content

Jolle

Members
  • Posts

    3
  • Joined

  • Last visited

Jolle's Achievements

  1. Maybe it helped I eventually have been able to do what I was looking for. My script might not be the prettiest and it will crash in case one forgets to connect the equipment, but I find it much easier to read and understand, so in case someone else are looking for what I did, I hope it will help them. It might cause problems if anyone tries to acquire data with large number of samples in which case one should look into JRys example. The script creates a memory buffer 1,2 times the necessary based on sample_time and sample rate. It then starts the data acquisition and sleeps in sample_time seconds and then stops sampling after which is takes out the data from the memory buffer. I have inserted comments at the places I start and stop the DC load for my application. When the sampling has ended the data is rounded to three digits and returned to the data_set variable which is plotted using matplotlib. USB-231_analog_sampling.py
  2. Thank you for your answer, i have been able to get a bit further but I am not able to get data out as I would like. First of all I would like to know if I have understood the following variables from your file correctly: rate - sampling rate in samples/second points_pr_channel - the buffer size for each of the channels which are being used for measurements (how does this correlate to the 2047 sample memory described in the USB-231 datasheet?) curr_count < 200000 - Ensures that a total of 200.000 measurements are made before measurement is finished You example prints a single value from the buffered data but I would like the entire dataset so I can look at the measured voltage at my specified sampling rate. But where is the entire data stored? My goal is to get an array (or similar) I can put into a dataframe together with other measurements and finally output a csv file with the measurements. I know how to create the dataframe and csv file, but how do I get all the measured datapoints out of the script into an array I can work on?
  3. I have bought a USB231 for voltage measurements on four batteries together with four different DC load. USB231 and all four DC loads will be controlled from python (DC load is controlled via serial commands). My wish is to do the following: Start sampling data on one channel with 2000 Samples/s turn on one DC load Ensure sampling of 1sec after DC load is turned on Turn off DC load and stop sampling Go to next analog channel and DC load and redo test above I have looked at the examples given on https://github.com/mccdaq but I find them a bit confusing and complicated as they seem to be generic codes which works for all MCC units. When trying a_in_scan_background.py i do get measurements, but I cannot figure out how to start the DC load while sampling is ongoing and ensure the correct sample rate. Do there exist any guide for the USB-231 which describes how to do what I want to accomplish?
×
×
  • Create New...