Page 1 of 1

Be notified when a sensor is plugged on a VoltageInput

Posted: Wed Nov 07, 2018 4:15 am
by natvaugien
Hello,

I was wondering if it is possible to be notified every time a sensor is plugged on a VoltageInput.
I would like to know when a sensor is being plugged or unplugged and the type of sensor I'm dealing with.
I'm working with multiple SBCs and Phidgets Interfaces so I use a PhidgetManager to open every Inputs/Outputs of the whole system.

I've already looked on the API documentation but haven't really seen anything that would work.

Thanks a lot.

Re: Be notified when a sensor is plugged on a VoltageInput

Posted: Wed Nov 07, 2018 9:10 am
by mparadis
Unfortunately, since analog sensors only provide a voltage from 0 to 5V and no other information to the InterfaceKit or Hub they're connected to, you have no way of knowing what kind of sensor it is without looking at what is physically connected.

For the same reason, you can't know for sure whether there's even a sensor plugged in, since the VoltageInput is constantly measuring the voltage difference between the white and black pins regardless of whether there's a cable connected or not.

You may be able to write a part of your program that is able to make a guess as to whether a sensor is plugged in or not based on looking at the voltage values for a second or two. Typically, disconnected voltage inputs will have a value near 0 and will not fluctuate that much. If this behaviour is significantly different than a sensor you have plugged in, your program will have a good guess as to whether a sensor is connected.

Depending on what kind of sensors you're interested in using, you may be able to solve this problem by switching to a VINT Hub and using the "smart" VINT device equivalents of those sensors. For example, instead of using an 1125 temperature/humidity sensor, you could use a HUM1000. These smart devices do tell the hub what kind of device they are and you'll get events when they connect and disconnect. They can be monitored using the Phidget Manager, which is the same thing our control panel example uses to tell which Phidgets are connected.

Re: Be notified when a sensor is plugged on a VoltageInput

Posted: Thu Nov 08, 2018 2:34 am
by natvaugien
Thanks a lot for your answer.
I'm going to test looking at the value to detect a change and if it doesn't work I'll try the smart VINT device.

Thanks again !

Re: Be notified when a sensor is plugged on a VoltageInput

Posted: Mon Nov 12, 2018 2:30 am
by elnova
Thanks for the answer i am looking for similar solution in another experiment :)