Sensor value is ouside the valid range...

Supporting 2.7 and 3.2+
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Sensor value is ouside the valid range...

Post by berkinet »

Python 2.7, Phidget22.

I am seeing a general issue using 0-5vdc voltage-input(classic) Phidgets. If I define a specif voltage-input Phidget (eg, an 1127) if the sensor value reaches 0, I receive "Sensor value is ouside the valid range" errors. In fact, it is not just my code, the Phidget Control Panel reports the same errors.

To test this, in the Phidget Control Panel, open a voltage-input port on an unused Interface Kit or VINT hub and set the Sensor-Type to an 1127.

I have found I can generally reduce the problem by setting Voltage change trigger to some small value, like 0.02.
. However, it really seems this issue should be addressed in the Phigdet22 libs. Perhaps it might just be a change to allow 0vdc (or getMinVoltageChangeTrigger) as a valid reading, or perhaps to allow the user to set the low Sensor value threshold (perhaps on a device basis).

BTW, I considered using setVoltageChangeTrigger() to getMinVoltageChangeTrigger() for the devices I am having trouble with. However,they all report 0.0 as the minimum.

But, first, am I missing something here?

BTW, note the spelling error in the error message: ouside
fraser
Engineering
Posts: 324
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by fraser »

This scenario has to do with the calculation of the sensorValue from the actual voltage. The voltage is typically limited to 0-5V, so the bounds of the sensor (ie min lux and max lux from the 1127, or min temperature and max temperature for an 1114) need to be within that specification. The hardware defines the equations used and are not so perfect as to precisely fit the min value and max value we define in specification to the 0V and 5V limits of the voltage input. So there will generally be a bit of head room at the extremes of the sensor value, and the error is simply letting you know when you've gone beyond the min and max value of the sensor.

Regarding change trigger: This works by limiting the maximum reported delta from the current sensor value. (ie, if changeTrigger = 0.5, and your last reported value was 1.2, you won't get a newly reported value unless the value exceeds 1.2 +/- 0.5). So setting it to 0.02 was likely just preventing it from getting to a value between 0V and 0.02V (which on the 1127 is where the saturation point of the sensor value is).

Hope that helps clear things up
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by berkinet »

Thank you for the explanation of the underlying happenings. However, I am still left with the dilemma of separating signal from noise. In other words, a random reported error every now and then is probably not an error at all. However, a series of the same errors would likely indicate a missing sensor. Is there a way to resolve this?
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by berkinet »

I now have a real world problem. A 3501 AC 0-25 amp current sensor. When the circuit being measured is off, I get a constant stream of out-of-range errors.
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by berkinet »

I would like to bump this issue. I now have a few cases in which 4103 out-of-range errors are thrown continuously for normal operating situations.
  • The example above of the 350x current sensors with no current flowing.
  • The 1101 distance sensor with no target in range
  • The 1127 light sensor in absolute darkness
And, I am sure there are more. The only solution is to not use the libs to interpret the voltageRatio or voltage reading and do it myself. But, this defeats much of the advantage of using the Phidget22 libs.

It seems the simple solution would be to change the range settings on these sensors (analogsensor.c). However, there might be hidden downsides to that. The other option would be to add API methods to get and set the sensor range. Of course, I could just trap these errors. But, then I lose the ability to spot real problems.

In the meantime, do you have any ideas on how I might deal with this?
User avatar
Patrick
Lead Developer
Posts: 3403
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Sensor value is ouside the valid range...

Post by Patrick »

If a sensor reports an out of spec value, we can't report a value, and so we report an error event - in some cases, it would be helpful to know whether the analog value is for example too low or too high, but this is out of scope of the analog sensor API. The Sensor Types are meant as a convenience - if they don't meet your requirements, the formulas for each analog sensor are posted so you can do your own conversion.

-Patrick
User avatar
Patrick
Lead Developer
Posts: 3403
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Sensor value is ouside the valid range...

Post by Patrick »

Ok as a follow up - there does seem to be a problem with the analog sensors, where the lower range especially is coded as '> 0', but it should be '>= 0' - this is why you are getting out of range errors for 0A on your current sensor, so we'll get that fixed.

-Patrick
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by berkinet »

Thanks!!
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by berkinet »

While we are on the subject (and in the context of another thread I started. I find that with the 1124/1125 analog temperature sensors the initial sensorValue sent after setting sensorType always yields this error:

Code: Select all

Sensor value is ouside the valid range for this sensor.
Any ideas?
berkinet
Phidget Mastermind
Posts: 212
Joined: Thu Sep 17, 2009 12:17 pm
Contact:

Re: Sensor value is ouside the valid range...

Post by berkinet »

A little additional information on my preceding post. At the time the range error was reported, the 1124 was showing a temperature around 57° (0.535 V/V) in the Phidget Control Panel. With no errors being reported. Interestingly, if the phidget is actually open in the control panel, I do not see the error in the Python code. But, I still do not get a sensor change event.

And, one more oddity.The formula described for t he 11240 & 11252 is the same (x * 222.2 - 61.111). Yet, setting the control panel to the 1124 shows the correct temperature (57.766) while the 1125 shows 61.748.
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests