Author |
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 06 2010 at 19:15 | IP Logged
|
|
|
I just added a SimpleHomeNet EZ-Eye light sensor to my system to measure the actual real-time sky light level rather than depending on Sunrise/Sunset for my lighting timings.
Problem is I can't seem to get any Analog readings from the EZIO.
I can read the digital inputs with a
Code:
ph_insteonwithret ( "OUT GDR EZIO2X4", 73, 0 ) |
|
|
command, but a
Code:
ph_insteonwithret ( "OUT GDR EZIO2X4", 74, 0 ) |
|
|
command (using a Byte-2 value of 0 for Sensor 1) just returns a zero (as do all the Byte-2 values from 0-3)
When I use the SimpleHomeNet Utility I get a "299" value returned from the Analog-1 input so I know the EZIO device is working.
But, no matter what I do I can't seem to get anything other than a "0" value returned by PH.
Has anyone successfully read an Analog value from the EZIO2X4, and if so how does one access the Analog-1 Input readings?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 06 2010 at 19:46 | IP Logged
|
|
|
Been there, done that! ;)
This is what I do to get the two bytes from AN1 ...
Code:
Set System | [LOCAL1] | right( ph_numtohex( ph_insteon("EZIO", ph_hextonum("28"), ph_hextonum("0")) + ph_delay(1)+ ph_insteonwithret("EZIO", ph_hextonum("2b"), ph_hextonum("4c"))), 2)
Set System | [LOCAL2] | right( ph_numtohex( ph_insteon("EZIO", ph_hextonum("28"), ph_hextonum("0")) + ph_delay(1)+ ph_insteonwithret("EZIO", ph_hextonum("2b"), ph_hextonum("4d"))), 2)
Set System | [LOCAL3] | ph_hextonum("[LOCAL2][LOCAL1]") |
|
|
This is what I use to initialize the EZIO (Report Status Changes & Use Analog: Convert on command)...
Code:
ph_insteon("EZIO", ph_hextonum("4d"), ph_hextonum("41")) |
|
|
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 06 2010 at 20:07 | IP Logged
|
|
|
Roger that Tony.
I started experimenting and arrived, I believe, at the same result.
Turns out that one can not "read" the Sensor values with a 0X4A command to the EZIO. It requires a Peek command to read the contents of the EZIO's memory locations where the analog values are saved.
My approach was as follows . . .
where Seq 10 sets the high-memory register byte to 0, and Seq20 reads the contents of memory location 4D (high analog value) and saves it in LOCAL1, and Seq30 grabs the low byte of the analog value in memory location 4C (of the EZIO2X4).
Seq40 then just combines the two bytes into a full 16 bit value (only 10 of which are needed for the analog value).
This yields the real-time analog value of the light intensity as read by the EZ-Eye sensor.
Thanks for your confirmation of my approach.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: December 06 2010 at 22:27 | IP Logged
|
|
|
You folks have figured out the solution for retrieving the actual analog value. As an FYI, the 74 0x4A command is used to return Sensor data, such as a 1-wire Sensor. It returns a single byte of data. It cannot be used to return the 2 bytes of analog data. The EZIOxx family of devices uses the same command set. The EZIO2X4 has no Sensor inputs so the 0x4A command does not apply.
__________________ Lee G
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 07 2010 at 07:02 | IP Logged
|
|
|
Lee - Had I been able to find more information about the EZIO Command set than the 2 page PDF document they publish, thhis probably would have been a simple matter.
Unfortunately the 2 pager is just a bit too brief and devoid of term definitions to be as useful as needed. Good for someone just using the device to link to other Insteon controller/responders but not very useful when one starts going beyond that environment.
Have you ever run across a "EZIO for Dummies" document that might go a little deeper into their capabilities. I have a slew of the various models and it has always been a matter of trial and error, coupled with a dash of dumb luck, to get them going.
Sure would be nice to understand the little puppies!
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 07 2010 at 07:10 | IP Logged
|
|
|
TonyNo wrote:
This is what I do to get the two bytes from AN1 ...
Set System | [LOCAL1] | . . . ph_hextonum("0")) + ph_delay(1) + ph_ . . . |
|
|
I note that you inserted a Delay between the write and read efforts. Was this just for "good measure" or did you run into problems and find you needed the delay?
So far, I have had no data issues and thus did not incorporate a delay. Do you recommend one based on experience?
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 07 2010 at 08:13 | IP Logged
|
|
|
Lee -
If I understand correctly the EZIO2X4 reads the Analog input automatically at the time the analog memory locations are "peeked" at.
I ask because it appears that the reading I am getting may be "one" behind. That is, the analog value digitized by the prior read. The only way I've found to test this is to peek in total darkness and then when daylight is restored, to peek again. I seem to get a "0" value then, but a non-zero value on the next read.
Should I be turning on the "Continuous A/D Conversion" (it is not now) to get accurate light level values?
Edited by GadgetGuy - December 07 2010 at 08:14
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: December 07 2010 at 10:36 | IP Logged
|
|
|
Ken,
I have not seen more documentation than what can be downloaded from the SHN web site. It is a little better than the command set information that can be downloaded from the Smarthome site. There is some detail in the SHN forum but that requires some digging. I’ve found the search facility is limiting compared to search on other forums. Feel free to ask questions. I have gained some knowledge from working with the SHN devices over the years.
I do use continuous conversion where I want the most current analog value. Have not tried the total darkness to light test you ran. To be sure I understand your results, the Peek in total dark returned zero, the first peek after turning on some light returned zero. The second peek returned the analog from the lighted condition. Does sound like the peek ACK is returning an analog value and then doing an analog to digital conversion after sending the ACK. Perhaps the time to do the analog to digital conversion would exceed the time allowed for a device to send back the ACK. I don't remember the maximum time a device has to send back an ACK but it is relatively short (milliseconds). If the time is exceeded it is taken as a failure of the device to respond at all.
Lee
__________________ Lee G
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 07 2010 at 11:13 | IP Logged
|
|
|
Lee,
Your understanding of my 'test' is correct, and the results make sense to me. I assumed the same timing issues as you did, although a good A/D converter can make the conversion in microseconds. But that said, I suspect there isn't one that good in the EZIO.
I see no issues with just letting the EZIO run A/D continuously. That way the peek'd value returned will be current.
I have been getting my manuals from the SimpleHomeNet site, but found that their "Advanced Developers Manual" was pretty devoid of meaty details. For instance, it would have been 'nice' to know what the definition of a 'Sensor' was!
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|