2 'counters' on U12+logging in excel


Teken1

Recommended Posts

Hello,

Yesterday I've buyed a Labjack U12 which I want to use to measure 2 rpm's with and one force. The rpm's are very low (180).

I want to measure the rpm with the counter and Digital Input. Or maybe 2 digital inputs. Also I want to count the number of given pulses (9/rotation; prox sensor)

I have a few questions about this situation working with DAQFactory:

- How can I count the number of pulses and view it in page view? (digital input)

- (How) Can I reset the counter after 1 min and write the number of pulses to a log file?

- If I open my Log file in Excel, all the information (time & force) is written in one column.

To make nice graphics I want to have time in 1 column & force in 1 column. Whats the best way to realise that.

Thanks for your time.

Mark K.

Holland

Link to comment
Share on other sites

9 pulses/rev times 180 revs/min = 1620 pulses/min = 27 Hz

Counting two 27 Hz pulse trains on the U12 by polling is cutting it close, and you will probably miss some pulses. The only way you could do it is to do a stream of 4 analog inputs at the max scan rate of 300 scans/second, as that will also bring in the 4 IO lines at 300 scans/second. Then you can process that data in software to count the pulses.

A better bet would be to use the U3, as it has 2 counters and 2 firmware counters (timers) that could count up to 4 of your signals.

Link to comment
Share on other sites

Actually, its not even cutting it close, but rather is impossible with the U12 using software polling. The pulses are at 27 hz, but in order to count them you have to sample at at least twice the frequency so that you see both the high and the low of the pulse (think nyquist). This means you have to sample at 54 hz which is too fast for the U12.

The streaming mode mentioned would work, but processing it would be more difficult. As mentioned, your best bet is to get a U3, or another U12. You can use the counter on the U12 for this, but there is only one per, while the U3 has several.

Now assuming you do use a counter I recommend NOT resetting the counter, except perhaps when you application loads. The reason is that during the reset period, which is rather short, there is a possibility that you will miss a count. With a slower pulse rate like you have, this is rare, but probably would happen 1 out of ever 1000 resets. At higher rates, this goes way up. So instead, you should record the difference between consequtive counts. To do this in DAQFactory is pretty easy:

1) Create two channels, one called RawCount and one called ActualCount. The RawCount channel should specify the counter to be read with the appropriate timing information. The ActualCount channel should be a non-existant counter number (say 10), and have a timing of 0.

2) In the event of RawCount put:

ActualCount.AddValue(RawCount[0] - RawCount[1])

That's it. From then on, use ActualCount for display and logging. The event code gets called with every reading of RawCount. The code simply takes the difference between the most recent point ([0]) and the next most recent point ([1]) and puts it into ActualCount.

As to how to log it, I recommend going through the guided tour as that will walk you through basic logging. If Excel is putting time and force in the same column then you are probably importing the file incorrectly. Make sure you specify in Excel the delimiter as comma instead of the default of tab.

Link to comment
Share on other sites

If the 27 Hz signal was 50% duty cycle you would probably catch most of the pulses, as most systems can get 16 ms function call times with the U12, but with your prox sensor you probably just get quick pulses and thus would need to sample much faster to catch the pulses. In fact, the 300 scans/second might not work either. We would have to know the high and low times of your pulses. Your solution is a U3 or UE9, or 2 U12s.

Link to comment
Share on other sites

The reason I wanted to measure 2 rpm's is because I have a driving drum for a conveyor which is making a misstap.

The misstaps are increasing in time sow maybe I can log the rotations per second in the beginning situation and further in time.

If I want to log every second his RPM (number of pulses counted in a second/number of pulses for a rotation), I think I've got to search the solution in the channel menu.

Is that right?

Thanks for your answers.

Mark

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.