Phidgets Plugin Discussion

Posted on
Wed Jan 09, 2013 11:35 pm
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

1142 bugs maybe? Overall, it seems to be working, after setting up a couple sensors on my SBC2. I have the combined temp/humidity (1125) hooked to sensor ports 0 an 1, and I have the 1142 0-1000 light sensor in port 4.

Temp and humidity look about right to me, based on another instrument in the room (though not in the same exact location). They also change, if say I hold the sensor in my hand for a bit.

The light sensor has a couple things going on:
- the values it reports do not match the values I see in the phidgets app, if I open the interface kit from the phidgets preference pane. In the preference pane app, using an LED lamp I have at my desk, it reads a maximum of about 775 if I hold the sensor to the bulb. With the Indigo plugin, it reads almost 1200 with the sensor in the same spot. At the low end, I can get the phidget app to show down to 6-7, and in Indigo, it shows 38-40.

- For a short period after reloading the plugin, I was getting this message in the Indigo log, any time the light sensor value changed (the same error streamed over and over to the log). Then, it quit showing up, but I didn't change anything:
Error device state key brightness not defined (ignoring update request)

- When I define the light sensor device, all the selection options are as you would expect. I see all 8 sensor ports to choose from when I need to tell the plugin what port my light sensor is on. However, if I edit the light sensor after I've created it, it only gives the options of ports 0 or 1.

I have a few other sensors to experiment with over the next few days. Thanks again for the work on this!

Posted on
Thu Jan 10, 2013 12:52 am
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

OK, so now that I dig into that light sensor more, I see that to calculate a lux value, there's a formula that's most accurate using a couple values printed on the back of the sensor. I also see that sensor is a non-ratiometric sensor. It's not jumping out at me where any of that could be set in the device setup, so I guess I just need to know what value the device is actually reporting back, to know if I need to apply a formula or not.

Posted on
Thu Jan 10, 2013 1:43 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin

Yeah, you got me. I sort of punted and used the default value they gave in the docs. I need to add the ability to use the real value from the Phidget. If you send me that value I can make a one-off build that will work for you, at least for that one sensor. I'll take a look at this over the weekend and see if I can decide how I am going to accomplish this.

In case you are interested, the real issue here is that I am trying to get by with a generic sensor device for analog sensors and then use a Sensor database with formulas, labels, etc in the back end. That way I don't have to write device descriptions for a whole mess of Phidgets, and then device specific handlers in the plugin. The down side of that approach is that sensor specific attributes are hard to support.

I knew I'd have to bite the bullet and deal with this sooner or later, I guess it's time.

Posted on
Thu Jan 10, 2013 3:30 am
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

I just figured all that out by digging around in the plugin. I switched out the 1142 with an 1143, and ran into a similar issue, in that the formula you have coded for the 1143 is not correct.

You have 'm*value + b', and the formula for that one is e^(m*value + b). Creates a little different outcome...

I tried editing your dictionary to correct it, but it doesn't like it when I do that. If I edit that file and reload the plugin, I can't get anything but a zero reading for the 1143.

In my situation, I'm actually going to have multiple light sensors. Right now, I'm planning on one of the 1142 units, and 3 of the 1143 units. Can you provide input in the device setup for m and b, and then use those as substitutions in the formulas? Right now it looks like your formula use one variable, which is the sensor value. Can you have them use multiple variables for these types of sensors? I suppose the device ID could differentiate between different sensors of the same type?

Posted on
Thu Jan 10, 2013 12:24 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin

Actually, the formula for the 1143 was totally messed up. Try pasting the following in place of the current formula:
Code: Select all
'1143':{'states':1, 'descr':'1142_0 - Light Sensor 70,000 lux', 'model':'phIfKitSensor',
   1:{'Disabled':'false', 'Key':'brightness', 'StateLabel':'Brightness (lux)', 'TriggerLabel':'Brightness (lux)', 'Type':100, 'formula':lambda x:  2.71828**(0.02385*x+-0.56905), 'decimalPlaces':0}},

I think the problem you were having in your edit is because you used ^ in place of **

BTW, the formula provided in the user-guide is:
    Luminosity (lux) = e^m*SensorValue+b
I took a stab at a value for e with 2.71828. But, that is Euler's number and could be altogether wrong.

I will address the problem of needing unique values for each sensor. It just is going to take some thinking on how to best go about it:
    Elegant Interface = lots of code vs easier coding = less intuitive interface

Posted on
Thu Jan 10, 2013 5:17 pm
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

Thanks, I'm in business now. Should have figured that out about the formula, but it was too late to think straight.

There's no problem adding multiple sensors of the same kind, correct? They'll just all use the same generic formula values at the moment?

Posted on
Thu Jan 10, 2013 6:06 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin

Yes, you can as many of the 1143s as you want. Are the reading you are getting reasonably close to what is expected?


BTW, I think I may have an approach to allowing special inputs for sensors. Stay tuned.

Posted on
Thu Jan 10, 2013 6:22 pm
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

I don't actually know what to expect on the light level readings, and I don't have a regular light meter to calibrate against. I think it's in the right ballpark. I'm kind of trusting the fine folks at phidgets on the accuracy...

For the one sensor I have hooked up and am testing with, I did put my m and b values in the equation when I edited it.

Posted on
Sat Jan 12, 2013 1:48 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Phidgets plugin Beta 0.3.0 now available

β 0.3.1 of the Phidgets plugin is now available on dropbox.

ALL USERS SHOULD UPGRADE TO THIS VERSION
It fixes several bugs, in particular, problems in creating and editing sensor devices.

After upgrading you should re-configure all your Phidget devices:
  1. Open the device
  2. Click Edit Device Settings...
    <optionally make any changes you wish>
  3. Click Save
  4. Close the device window.

The following changes have been made since the last release:
  • Fixed bugs in the threading model that limited the plugin to 1 phidget per type.
  • Fixed bug in which subsequent attempts to configure a sensor/input/output only showed 2 ports.
  • Fixed bug requiring redefinition of a sensor to set states
  • Fixed bug in decimal display for some ifkit attached sensors
  • Added support for 2 generic sensors: 0999a: 0-5 volts and 0999b: 0-1000 sensor value
  • Added values for Indigo DEVICE table 'address' column. Sensors = ifkit device name, others = IP Address or "USB" for direct connected devices.
  • Added support for ambient temp sensor on 1048 - PhidgetTemperatureSensor 4-Input
  • Added support for calibration/configuration info for sensors (1134, 1142 & 1143)
  • For sensor type devices (attached to an ifKit) you may now change the sensor type without deleting and recreating the device

The following issues still exist:
  • After adding a new interface kit or standalone Phidget you must reload the plugin
  • You must reload the plugin after changing the logging level (plugin config)
  • All sensor values display with 2 decimal places in the state column (this may be an Indigo issue)

As usual, please post any issues, questions, problems, ideas and suggestions to this forum.

And finally, special thanks to @gtreece for his help in resolving a number of issues.

Posted on
Sat Jan 12, 2013 6:00 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets plugin Beta 0.3.1 now available

β 0.3.1 of the Phidgets plugin is now available on dropbox.

I found, and removed, some debugging code that logged testing data as errors. I also added support for the Indigo DEVICES window "address" column for interface kits and standalone devices connected directly to the Indigo computer. These will now show an "address" of CPU.

The preceding announcement has been updated.

Posted on
Sun Jan 13, 2013 12:41 am
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

Thanks for your quick work on this!

During upgrade I noticed a couple minor items:

- In my case, since I was using the 1000 generic sensor, I had to select the 0999 when I edited device settings. I might be the only one that was using the 1000 sensor type though.

- When I edited/saved the device settings for my phidgetssbc, it did not put it's IP address in the address column. It shows me "- n/a -". In my case, I have the sbc running on it's wireless adapter, so I'm using the web service.

- I did notice that if the state value is say, 1.40, that Indigo displays just 1.4. That may not be of much value in your troubleshooting the two decimal place issue, but I thought I'd mention it.

I got the vegetronix soil moisture and temperature sensors hooked up as generic devices, and created triggers that update variables with the actual soil temperature and water content value whenever the sensor value changes. Seems to be working great.

I have the 1048. Let me know if you need it tested.

Posted on
Sun Jan 13, 2013 12:57 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin

gtreece wrote:
...During upgrade I noticed a couple minor items:
- In my case, since I was using the 1000 generic sensor, I had to select the 0999 when I edited device settings. I might be the only one that was using the 1000 sensor type though.

It's just you :wink: I changed the numbering so I did not conflict with the Phidgets numbering scheme. I won't change it again, promise.

gtreece wrote:
- When I edited/saved the device settings for my phidgetssbc, it did not put it's IP address in the address column. It shows me "- n/a -". In my case, I have the sbc running on it's wireless adapter, so I'm using the web service.

That should work. My SBC is wired and shows up properly. I'll email you tomorrow with a build that should show what the problem is.

gtreece wrote:
- I did notice that if the state value is say, 1.40, that Indigo displays just 1.4. That may not be of much value in your troubleshooting the two decimal place issue, but I thought I'd mention it.

Also odd. Are you on Indigo 5 or 6?

gtreece wrote:
I got the vegetronix soil moisture and temperature sensors hooked up as generic devices, and created triggers that update variables with the actual soil temperature and water content value whenever the sensor value changes. Seems to be working great.

I have the 1048. Let me know if you need it tested.


I should look into soil moisture monitoring for use here. Thanks for the offer of testing the 1048. I have one here and that's why I know it works :wink: OTOH, lots of things work only here!

Posted on
Sun Jan 13, 2013 1:06 am
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

I'm on Indigo 6b3. I didn't pay close enough attention to the state value in the states box below the device list. I just happened to be watching the State column in the device list when one of my devices changed from 1.38 to 1.4, and noticed that it didn't show the trailing zero.

Posted on
Sun Jan 13, 2013 1:08 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin

Is this on all Phidgets sensors, or just some. If some,which ones?

Posted on
Sun Jan 13, 2013 1:21 am
gtreece offline
Posts: 171
Joined: Sep 26, 2011

Re: Phidgets Plugin

The one I noticed it on was the 0999a 0-5v generic sensor. I'll keep an eye on it and see if I notice it with others.

Page 5 of 39 1, 2, 3, 4, 5, 6, 7, 8 ... 39

Who is online

Users browsing this forum: No registered users and 5 guests