Frequency in very unstable | LabJack

Frequency in very unstable

3 posts / 0 new
Last post
stuartdye's picture
Frequency in very unstable

Hi I have asked about the Frequency In function of the T7 before for a hall effect speed sensor. My query today is related to a problem I am having with the stability of the frequency (1 / period measurement). Previously I had the sensor reading from a small DC fan with 2 metal contacts, this still works fine and I am able to read my frequency. When I connect my sensor up to its permanent position next to a trigger wheel which is on the brake for my dyno experiment I can't seem to get a stable signal. What I do get is a signal with ~10-20% error oscillations and frequent spikes of >100% of the signal frequency. Firstly I want to clarify my understanding of how the frequency in is read just to rule it out. Below are my configurations for the frequency in.

DIO_EF_CLOCK1_ENABLE            0



DIO_EF_CLOCK1_ENABLE           1

DIO0_EF_ENABLE                       0

DIO0_EF_INDEX                         3

DIO0_EF_OPTIONS                     1

DIO0_EF_ENABLE                       1

I am reading from DIO0_EF_READ_A_F and getting the reciprocal of that for the frequency in Hz. I am using Clock1 as I require 2 different frequency PWM signals, the Clock2 frequency (14KHz) will give me a maximum period that is too small so I am left with Clock1. Previously I was using a 50Hz source on Clock1 but that means my minimum readable frequency would be 50Hz.

Clock Frequency = Core Frequency / Divisor

Max Period = Roll Value / Clock Frequency

Hence minimum frequency is just the reciprocal of the Max period. When I was running at 50Hz I noticed that when I increased the throttle of the engine the signal read from the speed sensor stabilised a little as soon as it was reading over 50Hz. This lead me to decrease the PWM frequency such that my new minimum readable frequency is 38Hz, which I thought might have been able to read my signal at is slowest. It has improved my readings but I still get very large spikes.

I intend to try lowering the frequency of my PWM further such that the minimum is a lot less than the original 50Hz but I still need my servo to operate at this frequency. 

Do you have any advice or ideas that could help at all? Would it be a bad idea to try lowering the frequency of my PWM any further?



LabJack Support
LabJack Support's picture
Sounds like the signal might

Sounds like the signal might be picking up noise. A couple tings to try:

  • Make a twisted pair for the signal and its ground.
  • Use an RC filter near the LabJack.
  • Average several readings.
markems's picture
Hi did you get this project

Hi did you get this project working I an wanting to do the same thing but I have the U3.