RPM / Frequency using a Tachometer | LabJack
 

RPM / Frequency using a Tachometer

4 posts / 0 new
Last post
peteretep
peteretep's picture
RPM / Frequency using a Tachometer

Hello, I'm new to the forum and new to LabJack so please be gentle :-)

I'm trying to configure this optical speed sensor as a tachometer to measure the rpm of a rotating blade.

http://www.omniinstruments.co.uk/displacement-position-sensors/optical-a...

The signal is connected to the FIO0 port on my labjack T7-Pro, and in the Kipling dashboard I see the FIO0 input go from low to high when the sensor senses the blade above it.

I want to get the frequency of this. I am trying to script this in the Lua, following the guide here:

https://labjack.com/support/datasheets/t-series/digital-io/extended-feat...

 

My Lua code looks like this:

print("connect the tacho signal wire (Yellow) to FIO0")
print("connect the tacho red wire to VS")
print("connect the tacho green wire to GND")

local mbRead=MB.R
local mbWrite=MB.W

local freq_seconds = 0
local freq_hertz = 0

mbWrite(44900, 1, 1) -- DIO_EF_CLOCK0_ENABLE = 1
mbWrite(44000, 1, 0) -- DIO_EF_ENABLE = 0
mbWrite(44100, 1, 11) -- DIO_EF_INDEX = 3
mbWrite(44000, 1, 1) -- DIO_EF_ENABLE = 1


while true do
  freq_seconds = mbRead(3500, 3)
  freq_hertz = mbRead(3700, 3)
  print("frequency in seconds: ", freq_seconds)
end

It doesn't seem to work - I get 0 for both the frequency in seconds and hertz.

Can anyone suggest where I have gone wrong?

Thanks,

Peter

 

LabJack Support
labjack support's picture
Nothing jumps out at me in

Nothing jumps out at me in your script.  Before we look to close please try it using the Register Matrix in Kipling, before moving on to Lua script:

https://labjack.com/support/software/applications/t-series/kipling/regis...

 

Guerrero
Luis_Guerrero's picture
Hello Peter, I am having the

Hello Peter, I am having the same problem that you had.

Could you solve the problem?

LabJack Support
labjack support's picture
Before you try using Lua go

Before you try using Lua go through the following tutorial and see if everything works using the Register Matrix in Kipling:

https://labjack.com/support/software/applications/t-series/kipling/regis...