03-13-2015 10:06 AM
I'm attempting to use the USB-6215 to determine the speed/direction of a fan using two optical sensors. I'm using the following code in a .NET library to take get 1000 samples from two lines and use the data from when the optical sensors are activated to determine speed/direction.
using (Task ctr0 = new Task()) { using (ctr0.DIChannels.CreateChannel("usb6215/port0/line1:2", "", ChannelLineGrouping.OneChannelForAllLines)) { ctr0.Stream.Timeout = 500; DigitalSingleChannelReader dReader = new DigitalSingleChannelReader(ctr0.Stream); try { // Start the task ctr0.Start(); byte[] results = dReader.ReadMultiSamplePortByte(1000); ctr0.Stop(); } catch (DaqException e) { Console.WriteLine("DAQ Exception: " + e.Message); } } } // Analyze sample data and calculate speed/direction //...
This seems to work fine, except for one thing: the samples only appear to be taken at a rate of 2 kHz. This means that at some higher RPM's, the DAQ will sometimes miss one of the optical sensors being activated. According to the datasheet, the USB-6215 has a max sample rate of 250 kS/s, and looking through some other threads, this rate is divided by the number of channels you are sampling (ie, sampling two channels gives you a rate of 125 kS/s for each channel). My question is, why is my sample rate so low, and how can I sample at a faster rate?
Solved! Go to Solution.
03-13-2015 12:20 PM
03-13-2015 02:40 PM
Dennis,
Thanks for your reply! I do see now that I was looking at the sample rate listed for Analog Input. I must have missed the mention of DI/DO being software timed in the User Manual. It unfortunately doesn't seem to be listed in the data sheet. I may look into converting my measurement to an analog input to get the speed I need...