Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: New 1-Wire Support Doesn’t Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 30 2014 at 06:32 | IP Logged Quote GadgetGuy

I have had no success getting the new 1-wire support in 2.1.5 to work. Bummer, as now that I have developed extensive charting support for PH, I am anxious to read my various 1-wire sensors and chart them for easy review.

I get a "-2" (error) returned from every attempt to read a temperature sensor.

I am suspicious of the fact that the device types in the controller pull-down list do not mention my Maxim USB 1-Wire controller, which is a type DS2490, which is not listed.

I have thus tried the "Default",and "USB Port" options(which yield '-2') errors, and the "DS90907U Serial" which yields a "..error returned while performing setup for 1-wire controller.. Return code:3"


Has anyone had success yet, and if so where might I have gone astray?   

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 30 2014 at 13:49 | IP Logged Quote GadgetGuy

Here's more info, and it is strange.

The 1Wire devices are set up to both Poll (120 sec time) and Trigger and thus update their respective Variables.

I have verified that the 1WIRE setup is correctly using USB port1 and it is using Port Type "USB Port".

However the results are very bazaar.


The Device Status frame shows 2 of 3 temperature readings, none of which have changed since they were initially read.

The TEMP-OUT was scanned yesterday at 2:24PM when I first entered it into the Analog I/O Detail Table, and the other two were scanned today at ~1:46PM when I first entered them in the Table, but the TEMP-FRZR temp was apparently not read as it is null.

The one Global Var that holds a value is the TEMP-OUT which occurred at about 2AM this morning, but resulted in a (-2) error.

The two Device Status readings seem to be in an expected data value range, so appear to be valid readings.

All attempts to read a 1WIRE device { eg, ph_getanalog("1WIRE-FRIG") } result in a (-2) error return.

Hopefully Dave you see this post and can advise regarding the "Care & Feeding" of 1WIRE setups.



__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 30 2014 at 15:10 | IP Logged Quote dhoward

Ken,

First thing to do is open Help->About->Controllers and verify that your 1-wire controller is properly connected and lists your connected 1-wire devices. Without this working, you can go no farther.

In the Analog I/O, set your "Point" column for all your 1-wire devices to 0. Also, the "Poll Interval" column is not the actual poll interval (1-wire polls devices continuously) and instead is a "deadband" value. See this post for more details concerning 1-wire setup: http://www.power-home.com/forum/forum_posts.asp?TID=3408&KW= 1-wire.

You won't be able to use the ph_getanalog function with 1-wire devices as it forces the controller to do a "poll" which the 1-wire controller doesnt support since its all done automatically. Use the ph_getanalogcalcstat function instead.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 30 2014 at 18:17 | IP Logged Quote GadgetGuy

Thanks Dave.

The Help>About>Controllers verified I have everything connected OK.

Once I changed the "Polling" time from 600 (which I thought was a 10 minute poll cycle, but obviously prevented any 1wire output until the temp changed 6 degrees, which didn't happen) to 20, I seem to be getting updates in the Device Status window now.

But my Globals aren't getting updated. Perhaps it isn't a Trigger issue but a data gathering issue. :-)

Here is what I am using in my Trigger. Is this the wrong approach?




__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 30 2014 at 18:29 | IP Logged Quote GadgetGuy

OK

Got things all working, I think.

Changed the Trigger formulas to...


Code:
ie, ph_setglobal_s("TEMP-FRIG",ph_getanalogcalcstat("1WIRE-FRIG" ))


Now everything correlates. Hopefully this will now happen more than just one time.   


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 30 2014 at 18:30 | IP Logged Quote GadgetGuy

PS-

Assuming this works, I'll be doing a major FAQ Help document on this one! :-)


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 30 2014 at 19:10 | IP Logged Quote dhoward

Ken,

You've got the triggers setup properly. A trigger ID number of 0 would mean to trigger on any change (that has caused an update in Device Status).

However, having the poll interval set to 20 means that the Device status will not be updated unless the temperature changes by 2 degrees. If you want a deadband of 0.2 degrees, you need to change the poll interval to 2. You won't get any trigger firing until the temp changes by at least 2 degrees.

Another thing is that the TEMP4 variable will contain the raw value (a temp of 32.4 will be 324). You may instead want TEMP5 which contains the calced value (32.4 will be 32.4).

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 31 2014 at 07:15 | IP Logged Quote GadgetGuy

Thanks Dave. I woke up in the middle of the night and
realized I was off by a factor of 10 on my deadband, and
changed it this morning.

It didn't seem like I was getting any Trigger results
using the TEMP vars so changed to the ph_getanalogcalcs
function, which was giving me results. I just figured
that the TEMPS probably weren't used for the 1_WIRE
support. To minimize extra CPU loading, I'll try the
TEMP3 approach once again.


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 31 2014 at 09:12 | IP Logged Quote dhoward

Ken,

Instead of TEMP3, use TEMP5. That should give you the temperature as it appears in the Device Status screen .

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 31 2014 at 09:28 | IP Logged Quote GadgetGuy

SWEET! That works perfectly.

Things are coming together fast now.

I have almost completed the rewrite of all my old 1-
wire handling routines (eliminating most of them in
the process).

My PH macro code is getting shorter and shorter with
every passing hour, now, and the overall performance
of PH has gone up a notch.

Life is GOOD!


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 31 2014 at 10:21 | IP Logged Quote GadgetGuy

Dave-

Now that I have things working, I have discovered that
PH reads the 1-wire sensors raw data without
correction. Using my previous 1-wire software
(LogTemp) I had entered a correction factor on the
sensors as several of them were reading several
degrees high.

How does one do this? I assume the "Raw to Corrected
Formula" plays a role, but what is the syntax of the
correction formula to be entered there? For example,
say you needed to subtract 1.6 degrees from the
sensor.

Also how does one then make that corrected data, the
data that PH uses everywhere instead of the raw data
values?

Thanks.

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 31 2014 at 12:19 | IP Logged Quote GadgetGuy

Thought I figured it out after extensive Forum searching.

I entered [DATA]-100 in the "Raw To Calculated Formula" field expecting that to produce a dramatic 10 degree drop in read temperature, but it appeared to do nothing. I even rebooted PH just in case that was needed, but again no change.

I observed this thru at lease two updates to the temp presentation in the Device Status window, to make sure I was actually getting new readings.


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 31 2014 at 13:04 | IP Logged Quote dhoward

Ken,

The "Raw to Calculated" formula is indeed the place to do a correction. Alas, it does not work for 1-wire data in 2.1.5b due to the 1-wire controller running in its own thread due to the large amount of overhead required by the controller. The code is in there but commented out due to errors it was causing because of the multi-threading.

However, I have gone in and rewritten the routines to enable the use of the "Raw to Calculated" formula and it will be available in 2.1.5c. Once that version is out, then you would use something like this to make a 2.5 degree correction:

string(([DATA] - 25) / 10.0,"##0.0")

This is very similar to the default calculated formula for 1-wire temperatures that is hardcoded into PowerHome. Specifying a raw to calculated formula overrides any built-in default formulas. The built-in for 1-wire temperature is:

string([DATA] / 10.0,"##0.0")

One key to remember is that the raw data has no mechanism for correction and is essentially the raw data. Only the calculated field will hold any corrections, tweaks, or modifications to the raw data.

Hope this helps. You can go ahead and place the correction formulas in 2.1.5b if you like as they are ignored for 1-wire devices and when you upgrade to 2.1.5c, they should automatically take effect.

Also, once this is all working with 2.1.5c, if you make tweaks to the formula while PowerHome is running, you won't see the change reflected until the rawvalue actually changes. The calc formula is ONLY applied when a change is detected in the raw value (or when the controller connects). To see the results of these types of changes instantly, you need to either restart/reinit PowerHome, disconnect/reconnect the controller, or wait for the raw value to register a change.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 31 2014 at 13:48 | IP Logged Quote GadgetGuy

THANKS Dave! -

That answer at least gives me "peace of mind". I get bummed out when the actions I've taken just seem like they have to be right, but things don't work.

I will put the correct formulas in, and eagerly await 2.1.5c

PS - Roger that on the changed value updates. That part was clear from the get-go. That's why I waited for two temp updates (where the values actually changed),

HAPPY NEW YEAR. Hope you are planning a fun evening. We are out for dinner and then back here to watch a Las Vegas Celine Dion (DVD) Concert on our 12' home theater screen with full surround sound for a better than life experience.

We get to sit on the stage, just feet away from Celine for virtually free, while concert goer's paid $1000/seat to sit on only the front rows.   


Edited by GadgetGuy - December 31 2014 at 13:50


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum