I have this (PA-13) two units (https://www.progressiveautomations.com/high-force-industrial-actuator ) that has HallEffect Sensor counting gear teeth to measure displacement. At the moment, I am tinkering with U3 so I will be working with one actuator then expand with U6 later.
I understand that to keep track of absolute position while changing directions I would use quadrature decoding; however, I'd like to take a small step at this time and do a simple counting. This unit has one signal lead for extension and another separate signal lead for retraction.
BasicCounter.ctl example provides some reading but counts are not where I expect (92.075 pulses/inch - every ONE inch I should read 92.075 counts)... or do I have to go with quadrature decoding?
Good idea testing with a simple counter first. I suggest you connect your signal to both FIO4 and FIO5, and then you can use a hardware counter and firmware counter and see if they count the same. The Test panel in LJControlPanel is a good way to do this initial testing. Note the count, move your actuator 1 inch, and see if the count changed by 92.
It's not anywhere near 92; it is counting something whenever I move the actuator.
(where is this hardware counter? I didn't see it in the dropdown menu where I found firmcount.)
You have enabled 1 timer (in firmware counter mode) and 2 counters, so they will appear on FIO4/5/6 respectively:
https://labjack.com/support/datasheets/u3/hardware-description/timers-co...
Are you getting more counts or less?
counting less.
it appears to count whenever I run the motor during start-stop; it appears to be not counting at all while running continuously.
by the way, I did assume the red and black is the VS and GND (where yellow and white would be the signal; so I ran a test with white lead as the VS but behavior was the same.
counting less
The counters and timers use digital I/O, so look at the digital logic thresholds:
https://labjack.com/support/datasheets/u3/appendix-a
Say you are connected to FIO4. The voltage on FIO4 must go above 2.0 volts to be high and must go below 0.8 volts to go low. You are going to need to use a scope to look at the voltage from FIO4 versus GND and see what the signal looks like. Another option is adding a jumper from FIO4 to an analog input so you can run LJStreamUD and look at the signal. Another possible option is moving your actuator very slow so you can use a voltmeter to see the high and low voltages from FIO4 versus GND.
by the way, I did assume the red and black is the VS and GND (where yellow and white would be the signal; so I ran a test with white lead as the VS but behavior was the same.
The datasheet for your device says:
Pin1: Signal1
Pin2: GND
Pin 3: +5VDC
Pin 4: Signal2
https://www.progressiveautomations.com/media/catalog/pdf/High_Force_Indu...
It is toggling between > 2.0 volts and <0.8 volts.
actuator I received did not have connector installed - just soldered ends.
I see about 18 good falling edges in the 2 seconds of your chart, so that should have resulted in 18 counts on a hardware counter.
Note that the signal is being clipped at the 2.4 volt limit of the low voltage analog input, so the actual high voltage might be 5 volts, but regardless it looks good.
Here is a basic test:
Use "Config Defaults" in LJCP to Configure Timer0 (FIO4) as PWM output at 10 Hz and enable Counter1 (FIO5). Click "Write Values". See attached.
Close LJCP and power cycle the U3 so the new defaults take effect.
Connect a jumper from FIO4 to FIO5 and also from FIO5 to FIO6.
Run LJStreamUD as shown in attached. You should see that the counter increments about 10 counts per second which matches the pulses shown in the chart.
"Timer Clock Divisior" is greyed-out for me in LJCP.
with my TimerClockDivisior greyed-out with 0, attached is what I get with your instruction (removed actuator leads).
You have to change TimerClockBase to 48 MHz/Divisor so you have the divisor option.
I had missed to see that 48MHz/divisior.
as shown in attached; I am seeing what you'd expect; where do I go from this point on to start counting properly of the actuator?
Thank you.
This test shows you the pulses and at the same time shows you that the U3 is counting the number of pulses that do occur. Now remove the jumper to FIO4 and instead connect your signal to FIO5/6. You should see that the U3 counts the correct number of pulses.
I do see the correct number of pulses as expected; thank you.
what do I need to change the attached (U3_Timers_Counters_Sequence.ctl) to reflect the required settings for my actuator?
I made adjustments (shown below in color) accordingly but I must be missing something as I'm not getting the expected output...
//Config Sequence
//First, we do a pin config reset to set the U3 to factory defaults.
//eGet(D#, IOType, Channel, Value, x1). First 3 parameters always required.
ePut(ID,LJ_ioPIN_CONFIGURATION_RESET,0,0,0)
//Now and add/go/get block to configure the timers and counters.
//AddRequest(D#, IOType, Channel, Value, x1, UserData). First 3 parameters always required.
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_COUNTER_PIN_OFFSET,4,0,0) // Timers will start on FIO4.
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chNUMBER_TIMERS_ENABLED,2,0,0) // Enable two timers ???
AddRequest(ID,LJ_ioPUT_COUNTER_ENABLE,1,1,0,0) // Enable Counter 1
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_CLOCK_BASE,26,0,0) // Configure 48 MHz base clock with divisor (Counter0 not available)
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_CLOCK_DIVISOR,73,0,0) // Timer clock frequency = 48M/73 = 657 Hz
AddRequest(ID,LJ_ioPUT_TIMER_MODE,0,2,0,0) // Timer0 is 16-bit PWM
AddRequest(ID,LJ_ioPUT_TIMER_VALUE,0,32768,0,0) // 50% duty cycle
AddRequest(ID,LJ_ioPUT_TIMER_MODE,1,2,0,0) // Timer1 is 32-bit period measurement
GoOne(ID)
I'm not sure what you are after there. How about the following to configure 1 timer as a firmware counter:
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_COUNTER_PIN_OFFSET,4,0,0) // Timers will start on FIO4.
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chNUMBER_TIMERS_ENABLED,1,0,0) // Enable one timer
AddRequest(ID,LJ_ioPUT_TIMER_MODE,0,5,0,0) // Timer0 is firmware counter
GoOne(ID)
... or the following to configure 2 timers as a quadrature pair:
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_COUNTER_PIN_OFFSET,4,0,0) // Timers will start on FIO4.
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chNUMBER_TIMERS_ENABLED,2,0,0) // Enable one timer
AddRequest(ID,LJ_ioPUT_TIMER_MODE,0,8,0,0) // Timer0 is quadrature
AddRequest(ID,LJ_ioPUT_TIMER_MODE,1,8,0,0) // Timer1 is quadrature
GoOne(ID)
So far, we've verified the raw reading using LJStreamUD after some changes to LJCP by setting the timer clock (48MHz/ 73 divisor).
(instead of simple counting, let's look at quadrature counting)
why can't I simply use this basic quadrature sample file (U3_Quadrature_Sequence.ctl) to read the Quadrature Count (FIO4/FIO5)?
what changes to this file do I make to be able to read my actuator (having 92.075 pulses/inch) quadrature count correctly?
sample file was counting less, so I thought adding this to my config would do something different:
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_CLOCK_BASE,26,0,0) // Configure 48 MHz base clock with divisor (Counter0 not available)
AddRequest(ID,LJ_ioPUT_CONFIG,LJ_chTIMER_CLOCK_DIVISOR,73,0,0) // Timer clock frequency = 48M/73 = 657 Hz
-- it doesn't seem to.
Clock settings have no effect on quadrature. If you are still having trouble I would back out of DAQFactory and first troubleshoot in LJControlPanel where you can use the Test panel to configure and read counters/timers. First try using a hardware counter. Then try a timer configured as firmware counter. Then try quadrature.