Phidgets Plugin Discussion

Posted on
Sat Aug 18, 2018 4:26 pm
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin Discussion Wether station

Hi Birkinet
Hate to flood you with stuff

Is there any pug in selections for the frequency counter P/N 1054( Interface kit selection) and the absolute pressure p/n1140 ?


I am pretty sure the Current DC p/n 1122 is giving me 21.xx milliamps not amps...thats what my meter tells me can't imagine there is 20 amps an where in my build.

Thanks for ant input.

Posted on
Mon Aug 20, 2018 7:41 am
berkinet offline
User avatar
Posts: 3114
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin Discussion Weather station

First, landry wrote:
... I have a pressure sensor with no selection in the plug in menu. I see you have generic voltage with formula.
Can you give me an example of a formula, for examlpe if i want to take the (voltage x A +B) 10 How do I write that formula in the bank field.
Do I just enter (XA+B)10. A and B are constants that I will put the value in upon entry. ...

See this post in the Phidgets plugin announcement thread.

and then, landry wrote:
...Is there any pug in selections for the frequency counter P/N 1054( Interface kit selection) and the absolute pressure p/n1140 ?... ...I am pretty sure the Current DC p/n 1122 is giving me 21.xx milliamps not amps....

There is support for the 1054. For the device, select Phidget Standalone Device, and then choose the frequency counter from the model pulldown.

There is no support for the 1140. However, you can enter your own formula. Depending on what you want as output, you could adapt this formula provided by Phidgets in the original 1140 user guide
    Pressure (psi) = Sensor_Value/16.697 + 0.504
I will look at the formula for the 1122 and make sure it is correct.

Posted on
Tue Aug 21, 2018 5:19 pm
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin DiscussionWeather Station

Ho Berkinet

Finally almost finished. Need to set up scheduling for my python scripts. For the pressure sensor did not use a formula in field suppled by plug in , just wrote a python script just like the some of other sensors. and pule values from a variabe list. ( could not get an format of a formula to work in your field entry pane).

Good job on your plug in!!
Attachments
Personal Weather Station.png
Personal Weather Station.png (315.92 KiB) Viewed 811 times

Posted on
Tue Aug 21, 2018 5:34 pm
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin Discussion

Birkinet

Just a heads up
Notice my amps, I put a meter to it and it is milliamps.

Also I would love to see a phidget plug in for the sonar. I would like to build a snow depth sensor.

I built one with the sharp IR and it worked until later in the day the Sun started blasting the surface I was focusing the IR on. It created an off scale signal that caused the phidgetsbc to freeze under an hour. Had to do a firmware reboot every time. Tested the set up several times with same problem. I really cant move the sensor to a shady spot. And I think in the winter the sun would be lower and the surface will have snow on it. However i would need to disconnect the sensor during other seasons.

If anyone needs the python scripts for the sensors and calculations I can post them,. All you need to do is create variables in Indigo and put the right ID in the scripts with out any other changes. Create some schedules to run scripts and then set ups control page.

Posted on
Thu Aug 30, 2018 11:09 am
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin Discussion Weather Station

Hi Berkinet
Quick question; with python. Is there a script that can reload the phidget plug in . i wold like to put it in a Action Group so I can access with Indigo touch.

I had a power failure when i was away and when power came back on the server rebooted and Indigo was relaunched however the the phidget plugins were not connected. i had to wait till I ca e home to reload the plug in .

Thanks in advance for help in writing a script for the reload function.

Posted on
Thu Aug 30, 2018 12:03 pm
berkinet offline
User avatar
Posts: 3114
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin Discussion Weather station

I wrote:
[size=75]...I will look at the formula for the 1122 and make sure it is correct.

Sorry, I have been away from the keyboard. I have rechecked the original documentation for the 1122 (for the Phidgetslib21) and the formulas entered in the plugin are correct, at least they are the same as in the Phidgets docs:
Screen Shot 2018-08-30 at 19.56.25.png
Screen Shot 2018-08-30 at 19.56.25.png (11.56 KiB) Viewed 718 times

I do not have an 1122 to test with. However, if you are willing to edit the file that contains the sensor formula, you can try changing the value for the DC calculation and see what happens. I'd suggest trying 132 instead of 13.2. For example, try changing
    lambda x: (x / 13.2) - 37.8787
to
    lambda x: (x / 132) - 37.8787
    or 1320, etc.
If you get the right value, I can change it and get out a new release.

The file is phidgets.dict in the plugin's Resources directory. And the formula you want is on line 107.

Posted on
Thu Aug 30, 2018 12:10 pm
berkinet offline
User avatar
Posts: 3114
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin Discussion Weather Station

landry wrote:
Hi Berkinet
Quick question; with python. Is there a script that can reload the phidget plug in .

Try using this code in an Action Group embedded Python script (Server Actions->Script and File Actions->Execute Script)
Code: Select all
plugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.Phidgets")
if plugin.isEnabled():
   plugin.restart()

Posted on
Thu Aug 30, 2018 5:54 pm
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin Discussion

Hi Berkinet
No problem and no woerries....cant expect you to live by the key board.

My two set ups is a SolarHot Water (SHW) set up which uses a 1122 to measure the amperage in AC for pump circulator and a Personal Weather Station (PWS) that uses a 1122 to measure the amperage in DC for a the phidget sbc board. I use the sensor in the latter set to get actual power use of the weather station sbc din order to be able to develop an solar application later. ( I also installed the the 1122 in the PWS to be able measure voltage from the wind speed sensor ( with a resistor) just in case the frequency sensor did not work)

I always work with empirically when trying to figure out the formulas to calculate the values in other words i compare the calculated value to an actual measured value with a meter.

Not fully understanding ration metric voltage verses voltage regarding Sensor Value , for both sensors AC and DC I set the sensor to
0999b-Generic Sensor Value 0-1000.

And I use the the following phidget scripts to calculate an indigo variable representing amperage:

AC script:
#Script Calculates SHW Pump Amperage from
#analog voltage input 7 phidgetsbc3

dev = indigo.devices[375865471]
indigo.server.log("states dict is: " + str(dev.states))
analoginput = int(dev.states["state"])

myvar=(((analoginput/1000.00)*5.00)*8.403)*1.0
myvar=(round(myvar, 2))
indigo.variable.updateValue(529512899, value=unicode(myvar))

DC script:
Script Calculates PWS sbc3 Amperage from
#analog voltage input 7 phidgetsbc3

dev = indigo.devices[834271710]
indigo.server.log("states dict is: " + str(dev.states))
analoginput = int(dev.states["state"])

myvar=(((analoginput/1000.00)*75.76)-37.8787)*1.0
myvar=(round(myvar, 2))
indigo.variable.updateValue(801431812, value=unicode(myvar))

these scripts with the the formulas used have even me the correct values.

i hope this helps and I appreciate the script suggestion you sent me reloading the plug in..i'll try it tonight.

Thanks again Berkinet!

Posted on
Thu Aug 30, 2018 5:56 pm
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin Discussion

Sorry Berkinet
these scripts with the the formulas used have even me the correct values.

should be
these scripts with the the formulas used have given me the correct values.

Posted on
Fri Aug 31, 2018 1:59 am
berkinet offline
User avatar
Posts: 3114
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin Discussion

landry wrote:
... Not fully understanding ration metric voltage verses voltage regarding Sensor Value , for both sensors AC and DC I set the sensor to 0999b-Generic Sensor Value 0-1000.

And I use the the following phidget scripts to calculate an indigo variable representing amperage:

AC script:
#Script Calculates SHW Pump Amperage from
...myvar=(((analoginput/1000.00)*5.00)*8.403)*1.0
...
DC script:
...myvar=(((analoginput/1000.00)*75.76)-37.8787)*1.0

It is not clear why you are calculating the value outside the plugin rather than just selecting the 1122 type sensor and letting the plugin do all the work.

If you really don't want to select the 1122 for some reason, then why not just use the 0999c type and enter the lambda formulas. They are the same as I noted in my previous post regarding the phidgets.dict file.
    DC: (x / 13.2) - 37.8787
    AC: x * 0.04204
However, given the way you are doing it, with Python code, I believe you have the wrong formulas. You need to use the formulas noted above, which are derived from the original 1122 phidgets21 libs documentation. The formulas you have used are from the phidgets22 libs. The results will be similar, but not the same.

So,
    DC: myvar=((analoginput/13.2) -37.8787)
    AC: myvar=(analoginput * 0.04204)
Also, In your code it is not clear why you enter the divisor as a whole number with 2 decimal places, and why you multiply the results by 1. Finally, just removing the division by 1000 would change the result from milliamps to amps.

Posted on
Fri Aug 31, 2018 2:18 pm
landry offline
Posts: 25
Joined: Jul 30, 2017

Re: Phidgets Plugin Discussion Wether Station

Thanks for your input Berkinet

I'll play wit your formulas and compare.

I stopped using the 1122 selection because it did not work ... it gave the wrong values. Thats I why went with 1099b selection.

I did notice if i use the phidget control panel you need to choose DC or AC in submenu to get the amperage Choosing the DC for my DC application gives me the right amperage if I choose the AC when using DC, the value matches your plug in. I do not know how your getting the plug int to work correctly since in the control panel you have select the right type of voltage. There is no selection in the plug in so i do not how you are determining which formula to use in your code since there are different formulas in Phidget manual for DC vs AC. I f you look at my earlier dicusssion the value was getting the weather staton is 22.9 Amps, that value came directly from 1122 , no scripts.

Regarding my scripts during my steep learning curve to use Python, was multiplying the calculated value by 1.0 to see if ii can the significant figures, then i discover the Round command and never removed the X1.0. Not really an expert with Python , been learning it since Indigo will be dropping AppleScript soon.

Not really a programmer at all but did stay at a Best western.

Posted on
Fri Aug 31, 2018 3:15 pm
berkinet offline
User avatar
Posts: 3114
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Phidgets Plugin Discussion Wether Station

landry wrote:
...I did notice if i use the phidget control panel you need to choose DC or AC in submenu to get the amperage Choosing the DC for my DC application gives me the right amperage if I choose the AC when using DC, the value matches your plug in. I do not know how your getting the plug int to work correctly since in the control panel you have select the right type of voltage. There is no selection in the plug in...

You are right. I have never tried the 1122 since I do not own one and you are the first person who has actually tried to use it. I will look at the code and see if I can make it work. But, as long as you can get it working with the 999b or 999c I may just leave it.

Posted on
Sun Oct 21, 2018 12:43 pm
berkinet offline
User avatar
Posts: 3114
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Phidgets Plugin v 0.7.4 now available

Phidgets plugin v 0.7.4 is now available in the Indigo Plugin Store
This release contains a rewrite of the phidgets device attachment code and resolves a problem in which any phidget that did not attach at startup would block all following phidgets from attaching. A new property has been added to the plugin config to set the attach wait time. The default is 10 seconds.

Who is online

Users browsing this forum: No registered users and 1 guest