LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring Agilent 34980A to measure encoder frequency

Solved!
Go to solution

Hello,

 

I have Labview 2017 and 2018 (depending on the computer) and Agilent 34980A connected working fine for relays activation and many current and voltages measurements. Everything works fine. However, I recently discovered that it's possible to measure frequency directly with the 34921A module. Since then I have been trying to change my Labview code to read the encoder output directly. Currently the encoder output is measured by a device, that converts the frequency into current and this signal is measured. But my plan is to remove this extra device and measure the frequency directly.

I have downloaded the only examples I could find on NI website and tried to measure frequency using the blocks from the library, more specifically the "Measure Frequency and Period". I got some results, however, very wrong results. when the encoder is off I measure around 10000 or 9000 Hz and I couldn't figure out how to properly configure it. I have also tried a little bit with the counter block, but these I could not get anything.

 

Can anybody help me with that?

0 Kudos
Message 1 of 8
(2,431 Views)

Hi Lucas

 

Please can you post some VI's showing what you have done please.

 

This link is good reading for frequency measurement techniques.

https://www.ni.com/en-gb/support/documentation/supplemental/06/making-accurate-frequency-measurement...

 

What is the encoder you are measuring?

 


when the encoder is off I measure around 10000 or 9000 Hz and I couldn't figure out how to properly configure it. 

 


What do you mean 'When the encoder is off'? Have you unplugged it, disconnected power, it just isn't moving.

 

If you have disconnected it/possibly removed the power I wouldn't be surprised if you are reading high frequencies. As the inputs to your device are effectively floating they will be all over the place (They are now an antenna picking up all sorts of EMI)

 

If you are reading those frequencies when the encoder is stopped it could be a wiring or software issue. Do you see any change in measurement when the encoder moves? 

0 Kudos
Message 2 of 8
(2,391 Views)

Hi,

 

Sorry, I forgot to send a picture (I cannot show much). But the rest of the code works perfect, it's just the frequency value that it's wrong.

 

If you look at the picture, I have even tried to configure the measurement before, since the channel configuration in the Agilent do not follow exactly what I am configuring in LAbview. I also tried to include an scaling block, but it has no affect at all.

 

I meant the encoder off, when it's not spinning, but it is always connected. With it not spinning I get this value around 8000, with it spinning I get 18000 more or less, it's variable, but withing a 2000 range. Also, both values in LAbview code and Agilent webpage, where I can monitor the input, I get the same value, so that's why I suspect it's a matter of configuration...

0 Kudos
Message 3 of 8
(2,346 Views)
Solution
Accepted by topic author Lucas1451

I don't seem to be able to download the Agilent drivers from their website so I can't help I am afraid.

 

Can I suggest that you try to separate out your problematic code into a separate VI that you can post here to give us a better chance of helping. If you do a save for previous version it should include the drivers as well, although I am not sure.

 

Having said this I do suspect it is a wiring problem not a software, especially if you are using examples from Agilent.

 

It is probably worth double checking your wiring and posting a schematic of what you have done. Hand drawn is fine

0 Kudos
Message 4 of 8
(2,342 Views)

HI I hope I manage to get everything you asked.

 

Actually I took a look at my wiring and I made a correction. Initially, there was a component in between the receiver (of the encoder's signal) and the agilent, converting the pulsed squared wave signal in current. When I bypassed the connection, connecting the receiver directly to the agilent, I just moved the signal wire, not the reference.

However, after changing the reference, now I got even weirder result. When the encoder is not sending anything I read around 30k, and when it's spinning, around 20k O.o 

 

Inside the zip file there is a picture of the physical connection, a vi only with the frequency measurement part (I cannot share more due to company policy) and the whole agilent 34980A library (just include it at C/program files/national instruments/labview 2018/instr.lib)

 

 

0 Kudos
Message 5 of 8
(2,340 Views)

Hi again,

 

I figured out what was wrong! I had a wrong connection in my panel, now it's working fine.

 

Only thing is that the configuration and scaling blocks in Labview does not change anything, so it's reading everything in auto, which is fine, but it could be nice to be able to change if wanted.

 

Also, there is another issue that I managed to solve it, but maybe there is another way. When I first start the process, with the encoder off, it measures correctly 0 Hz, then I start the motor, I measure correctly the 1500 rpm (very precise btw), but then when I turn off the motor, after the rpm slowly dropping to 0, then it starts to read 40kHz... I fixed it by including a pull down resistor in the input, but in case you know another way of fixing it, please let me know :).

 

Anyway thanks for the help!

0 Kudos
Message 6 of 8
(2,333 Views)

I am glad that you got it sorted. Just to clarify, by wrong connection in your panel you are talking about physical wiring, not a connection in LabVIEW.

 

It sounds like there is some low pass filtering been applied to the encoder reading. Why you are reading 40kHz I have got no idea. Could be an electrical noise issue as well. Pulldown resistor sounds like a good solution.

0 Kudos
Message 7 of 8
(2,324 Views)

Hi,

 

Sorry for the delay in my reply, I have been a little busy recently.

But yes, by wrong connection I meant the physical wiring...I didn't even had the encoder connected, I mistakenly connected a completely unrelated wire instead of the encoder. After this correction, and including a pull down resistor, the reading is working very well.

 

But as I said before, the scan configuration vi, and scaling, have no influence in the result, so I am only using the measurement vi. But it's enough for what I need.

 

Thanks again for replying and the help!

0 Kudos
Message 8 of 8
(2,300 Views)