LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to customize(reset) the Analog value? min to 0 / max to 90

Solved!
Go to solution

If I want to using a more wide range of the value, How can i customize the range?

 

For example, I wanna using a range from 0 to 90

when the values coming out : output voltage value (analog) 0V to 5V, finding min & max value.

 

and I want to reset the range by setting the minimum value to 0 and the maximum value to 90.

 

like range mapping, MAP function of Arduino !

0 Kudos
Message 1 of 11
(3,706 Views)

If you just need to change the max value to 90, multiply the input by 18 (90 / 5). If you think you will need something that needs to work more like Arduino map, calculate a scale factor and offset.

 

Scale factor is equal to (scaled max - scaled min)/(raw max - raw min)

Offset is equal to raw min - scaled min

Then the scaled output is equal to raw input * scale factor - offset

 

Raw input being your voltage input

0 Kudos
Message 2 of 11
(3,658 Views)

Hi jdb,

 


@jdb8673 wrote:

when the values coming out : output voltage value (analog) 0V to 5V, finding min & max value.

and I want to reset the range by setting the minimum value to 0 and the maximum value to 90.

like range mapping, MAP function of Arduino !


So you want to apply a simple scaling, like range(0-5V) multiplied by 18 gives range(0-90)?

I guess "MAP" applies a simple linear scaling? There are palette full of functions dedicated to (not just linear) regression and about polynomial functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(3,654 Views)

when coming out the analog signal from some sensor

 

I wanna using customized range of value, reset the range by setting the minimum value to 0 and the maximum value to 90.

 

I think, it is not just simple scaling like multiplied some number. I want to make more wide range of sensor

 

like the function of C ex) arduino : "val = map(val, min, max, 0, 100)" 
0 Kudos
Message 4 of 11
(3,659 Views)
Solution
Accepted by topic author jdb8673

IIRC, there's a VI in DAQmx that does this. I don't have it installed right now.

 

This is very easy to make yourself. Then you can make it do exactly what you want. Inputs\outputs can be arrays at will, classes, etc..

 

You can also handle limits your own way.

 

Scale.png

In short: Scale input between 0-1 by subtracting the min, dividing by range. Then scale to output by multiplying by scale, add min.

Message 5 of 11
(3,641 Views)

Hi jdb,

 

why do people start a new thread for the very same problem after they already got answers?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,612 Views)

Apparently message threads must go stale after only 2 hours!

Message 7 of 11
(3,546 Views)

If I want to using a more wide range of the value so I'll using customized range of signal

For example, I wanna using a range from 0 to 90
when the values coming out : output voltage value (analog) 0V to 5V, finding min & max value.

and I want to reset the range by setting the minimum value to 0 and the maximum value to 90.

 

I asked same problem before and I got answer that using DAQmx
But I'm not good at using labVIEW that i can using DAQmx and I don't know how it using with Arduino output signal

scaling and mapping in ratio 0~5V >> 1~90 (analog signal)

 

제목 없음.png

 

I found it min and max value from the my sensor
but I don't know how is it input for scaling factor
plz, tell me please explain easily as possible!

0 Kudos
Message 8 of 11
(3,483 Views)

Hi jdb,

 

why do you again want to start a new task for the very same problem?

Please stay with your thread until the problem is solved!

 


@jdb8673 wrote:

I asked same problem before and I got answer that using DAQmx
But I'm not good at using labVIEW that i can using DAQmx and I don't know how it using with Arduino output signal

I found it min and max value from the my sensor
but I don't know how is it input for scaling factor


You didn't mention Arduino usage before so you got DAQmx recommendations.

You also got recommendations to apply simple math: can't you apply simple linear scaling?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(3,462 Views)

Thank you for your comment
you mean that linear scaling is multiplied some number? or another thing?
Is it ok that using min & max value of senor (mearsuring value)
ex) In 0~5V range, If I mearsured min 3V value and max 4V value, I want to make 3V to 0, 4V to 90
I don't know what function needs and apply
please help

0 Kudos
Message 10 of 11
(3,405 Views)