rpm measuring


Recommended Posts

I have a problem,

I'm using the U3 with analoge signals now for a few months, with good results.

The next step for me is to use the U3, to measure rpm's with a pulse sensor.

The software i'm using is DAQFactory

So I have tried many things, with no results until now.

Witch settings do I have to make to measure (positive) pulses in a time period ?

With a automatic reset from the counter/clock.

When I set the U3 to counter mode, it counts the pulses but there is now time setting......... or an option for a reset from that counter after a time period......

When I set the U3 to clock mode (it dosn't matter which one), there is nothing happening !! DAQFactory dos'nt cound anything.......

So there can be different problems (In mine opinion), I made a mistake by programming the U3 in combination with the DAQFactory software or the positive pulse is in clock mode not good !?

> Edit The pulses are not the problem I've tested this in the "U3 test panel", end there it cound OK

See this picture 1

My U3 settings > the first 2 ports are set to digital (For clock mode) Al other ports are set to analog

See this picture 2

My DAQ factory settings > I have tried different clock settings but DAQFactory dus not show any result. I have checked the 2 clocks on the Labjack U3 settings in the pulldown menu on top of DAQFactory with a setting (I have tried different settings). By the way, the U3 dus not remember the settings with the puldown menu !

Anyone a answer ?

(Sorry for my bad englisch)

Link to comment
Share on other sites

Thank you for the try, but I can't load this file in DAQFactory 5 !

When I open it,DAQFactory com's with a little screen that says "Unable to load file, return to blank" .........

Is there an option to make a screen dump of it ? or make some screen dumps in a word document....

Link to comment
Share on other sites

Yes, 99.99% of the time, if you get "unable to load document", it means you are trying to load a document that was created with a newer version of DAQFactory. The latest version of DAQFactory Express is available from www.daqexpress.com

The other 0.01% is people with file corruption, usually caused by a power fail in the middle of a save, and thus the reason to always keep backups!

Link to comment
Share on other sites

Thank you ! After the update it goes fine, but that's not easy to program !

Programming is not my stongest so this will be a puzzle for me.

But that don't mather me, I will tri and it must be done !

Som little questions about the file :

- there are 4 sequences but one (the Pin_Config_Reset sequence) of them is not in use (I think),

where is this one used for ?

- The sequence StartUp give's a Alert in the second row, I 've checked the path and that seems to be OK !

so what can there else be wrong ?

- Can I find a "help dodument" .pdf or others what gives me a handheld to the program methode ?

Is this an specifiek program languge ? or DAQFactory only ?

thanks for so far !

Link to comment
Share on other sites

- there are 4 sequences but one (the Pin_Config_Reset sequence) of them is not in use (I think),

where is this one used for ?

Yes, it looks like this one is not used as the same command is in the Config sequence.

- The sequence StartUp give's a Alert in the second row, I 've checked the path and that seems to be OK !

so what can there else be wrong ?

I'm not seeing that. Are you using the latest verson of DAQFactory?

- Can I find a "help dodument" .pdf or others what gives me a handheld to the program methode ?

Is this an specifiek program languge ? or DAQFactory only ?

DAQFactory scripting is loosely modeled on C I suppose. The help file and user manual PDF have a description of the language in the chapters called "Expressions" and "Sequences".

With release 5.7+, we've made it so much of LabJack specific code looks almost identical to the C code and pseudocode that LabJack provides. You just need those first few lines "using(...)" and "include(...)" that are in the startup sequence. There are some other small differences as well, but these are described in the help under the LabJack section of the Devices Chapter.

Link to comment
Share on other sites

Ok, I have reinstalled the DAQFactoryExpress software and have upgraded it to the latest version !

When I now open te file I becom a Alert > C1033 Unable to load device driver LabJackN.dll check file path and maken sure manufacturer's drivers are installed.

I've checked location of this file and I find it in C:\program files\DAQFActoryExpress\LabJackN.dll

When I load the file it looks like it works (there is the alert but the sequence read is running), but it don't cound !

What's wrong now ?

Link to comment
Share on other sites

If you upgrade Express (or any version of DAQFactory) to the 5.7+ release, you must also update your LabJack drivers to the latest version. This is a good idea anyway. The LabJack drivers are available from LabJack.com's download site.

Link to comment
Share on other sites

  • 3 weeks later...

Bringing that thread back to life,

I just got my U3 and I'm trying to monitor rpm from an anemometer (reed switch type).

I'm a mechanical guy and all that programming stuff is very confusing for me.

After lots of trial and error, I'm able to count the pulses.

I'd like some hints to continue my learning.

What are the next steps to put thoses pulses into RPM

Thanks

Alex

Link to comment
Share on other sites

Did you have problems with the example attached above? It should count and time pulses. Looking at that example, I think two quick changes could be done to give you RPM.

For the period timer, take 1/(microseconds*0.000001) to get Hz, and then multiply by 60 to get RPM.

For the counter, it looks like the example is doing a reset & read once per second, so the value you get each second is Hz. Multiply by 60 to get RPM.

Make sure you look at Section 2.8.1.3 of the U3 User's Guide since you are connecting to a mechanical switch and might need to worry about bouncing. Also see the following general topic about frequency measurement:

http://www.labjack.com/forums/index.php?showtopic=1105

Link to comment
Share on other sites

Hi,

Haven't looked much at the example attached above, seemed way too complicated to be what I'm looking for but I'll take further look.

As for the bouncing, I'm reading 2 pulses for each revolution of my anemometer and I should read one. I'll look into that either.

After sending my previous post, I tried something and I was surprised to see that it's working.

The counter timing is set to 0.1s

A sequence reset the counter every 0.1s:

time 0

Device.LabJack.eGet(1,"LJ_ioPUT_COUNTER_RESET",0,1,0)

delay(0.1)

goto 0

That gives me revolution per seconds

Besides lack in precision, what are the problems of doing it like that.

Thanks a lot for answering my questions

Alex

Link to comment
Share on other sites

The problem with reseting the counter each time is that there is a deadband time when the counter won't count. The LabJack guys will have to tell you how long that is, but it means that during that time, if another count occurs, it won't be counted. If you never reset the counter and instead calc differences between consecutive count readings, then this doesn't happen. The worse part is that whether it misses a count or not is a bit random (really not, but it looks that way) and can't be back calculated out. For something like wind speed, it will just make your measurements slightly low (maybe 10%). For something that needs precise counting, like counting forms printed on a printing press, this is a serious issue and only the delta / no reset method should be used.

As for your double counts, if you are using a mechanical switch you almost certainly have a bounce issue and should follow LabJack's advice. This exists really on just about any mechanical switch, even simple push button switches, so, for example, all the keys on your keyboard and your mouse buttons have debounce circuitry in them. If your signal was real slow, i.e. slower than the counter read rate, then you could debounce in software because you know that you should only get a maximum of one count per reading, and so you can just take the double (or often more than double) count as a single count. In your case you probably don't know this, so you'll have to debounce in hardware.

Link to comment
Share on other sites

For the period timer, take 1/(microseconds*0.000001) to get Hz, and then multiply by 60 to get RPM.

For the counter, it looks like the example is doing a reset & read once per second, so the value you get each second is Hz. Multiply by 60 to get RPM.

Ok so to be sure I'm not missing something:

I don't need any counter to get RPM, right?

Thanks

Alex

Link to comment
Share on other sites

No, you can often use a timer instead of a counter. The decision comes back to a lot of the stuff discussed in topic #1105. To help you decide the best method, we would need to know more about the following:

What is the frequency range of your signal?

Over what time period do you want to measure the frequency? A single cycle, 1 second average, 10 second average?

What is the duty cycle of your pulse and is it positive or negative?

Link to comment
Share on other sites

No, you can often use a timer instead of a counter. The decision comes back to a lot of the stuff discussed in topic #1105. To help you decide the best method, we would need to know more about the following:

What is the frequency range of your signal?

From 0 to 25 Hz

Over what time period do you want to measure the frequency? A single cycle, 1 second average, 10 second average?

I'm not sure I understand that but lets sy that I want to see as soon as possible any change in speed so I should measure each single cycle.

What is the duty cycle of your pulse and is it positive or negative?

The duty cycle, I got no idea, I asked the guy that sold me the anemometer.

As for the pulse being positive or negative, I dont know. If it can helps, I know that the switch is normally open and that I connect my switch to GND and FIO0 and the counter of the "U3_Counter_Simple" counts the pulses.

Thanks again

Alex

Link to comment
Share on other sites

Based on that, I think the period measurement timer will work great for you as configured in the example. With a counter you would have to count for a while to get many pulses at 25 Hz max, but with the timer you can read the period of every pulse if you feel like it.

One possible advantage to counting, is that you could use a timer in the "firmware counter with debounce" mode, if you wind up having a problem with switch bounce. If you have bounce issues and want to use the timer, you will have to clean up the signal with an RC filter or other external hardware as mentioned in Section 2.8.1.3 of the U3 User's Guide.

Link to comment
Share on other sites

Based on that, I think the period measurement timer will work great for you as configured in the example. With a counter you would have to count for a while to get many pulses at 25 Hz max, but with the timer you can read the period of every pulse if you feel like it.

One possible advantage to counting, is that you could use a timer in the "firmware counter with debounce" mode, if you wind up having a problem with switch bounce. If you have bounce issues and want to use the timer, you will have to clean up the signal with an RC filter or other external hardware as mentioned in Section 2.8.1.3 of the U3 User's Guide.

Thanks,

I built a passive hardware debounce thing and tested it by running two anemometers on my car, I compared the readings got through the U3 and the debounce thing and readings got through the anemometers factory software and it looks to be fine. Only difference I can see is that the U3 is faster than the software.

Now, since I succeded in getting RPM by modifying the example, I tried something from scratch by myself.

I enabled a timer channel, copied the StartUp sequence from the example minus the line calling the config sequence and I copied the read sequence minus the lines refering to the counter. I also changed some value here and there so it would match the channel I'm using, FIO0.

I can't make it work. Am I doing anything wrong. Is there any reasons for the eaxample to be "sequence based"? And is there any reason why the offset pin is set to 4?

I attached my work so you can see.

Thanks again to teach me.

Alex

Link to comment
Share on other sites

Do you get an error when you run? I get the following:

"The device's hardware version doesn't support the value parameter for this request"

The most common cause of that error is using the wrong timer clock base. In this case, it looks like you are using the device configuration wizard and it is setting the clock base to 24 MHz w/ divisor which is not valid on hardware revision 1.21.

Is there any reasons for the example to be "sequence based"? And is there any reason why the offset pin is set to 4?

The plan was to make 2 different versions of many examples. One that is mostly sequence based and one that uses as few sequences as possible. One advantage of the sequence based examples is that they better following the UD programming reference in Section 4 of the U3/UE9 User's Guide.

A U3 timer/counter pin offset value of 4-8 is recommended for future compatibility, so we are trying to change all examples to use a value of 4.

Link to comment
Share on other sites

Do you get an error when you run? I get the following:

"The device's hardware version doesn't support the value parameter for this request"

The most common cause of that error is using the wrong timer clock base. In this case, it looks like you are using the device configuration wizard and it is setting the clock base to 24 MHz w/ divisor which is not valid on hardware revision 1.21.

Yes I was getting that error too.

Thanks for pointing me the reason of that error.

I added a the following Config sequence and everything is fine now.

AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_CLOCK_BASE,26,0,0)divisor (Counter0 not available)

AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_CLOCK_DIVISOR,48,0,0)

AddRequest(ID,LJ_ioPUT_TIMER_MODE,0,2,0,0)

GoOne(ID)

What comes next is to get data from my load cell.

Thanks alot.

Alex

Link to comment
Share on other sites

  • 1 month later...

Ok, I got some time to work on that project again.

I'm able to measure RPM using two timers as configured in the example.

I just realised that using this method I can't measure two different RPM from two different sensor.

Which is the best option?

Using the counters?

Convert to voltage?

Buy a UE9?

Any other idea?

Thanks

Alex

Link to comment
Share on other sites

Why are you using 2 timers to measure 1 RPM? I looked at our example and it looks like only Timer1 is used to measure frequency. Timer0 is used to generate PWM output.

Yeah, your right, my mistake.

I'm still not able to display more than one RPM. When I right-click on a "Variable Value Object", I got to write "period" to see some reading and it seems to refer to timer 0.

Link to comment
Share on other sites

I don't understand what you are saying. Here is a list of what I can think of that you need to do:

StartUp Sequence - Add another variable such as "period2".

Config Sequence - Change Timer0 mode to 2. Don't need command setting Timer0 value.

Read Sequence - Add requests to read and reset Timer0. Add a getresult to get the Timer0 value and put it in period2.

Main Page - Make a display for period2.

Link to comment
Share on other sites

StartUp Sequence - Add another variable such as "period2".

Config Sequence - Change Timer0 mode to 2. Don't need command setting Timer0 value.

Read Sequence - Add requests to read and reset Timer0. Add a getresult to get the Timer0 value and put it in period2.

Main Page - Make a display for period2.

At first, it wasn't working but now it is.

Thanks a lot

Link to comment
Share on other sites

Archived

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