sedtronic light intensity sensor



  • Hi Tomas,

    please find attached e-mails from sedtronic. It seems, that there is a problem with the one wire evok interface.
    unipi print out:

    Humidity:
    {'vdd': '4.99', 'temp': '19.875', 'circuit': '266B64140200002D', 'typ': 'DS2438', 'interval': 15, 'vad': '1.81', 'dev': 'temp', 'lost': False, 'humidity': 59.7449061115105, 'time': 1516545061.085347}
    
    Light intensity:
    {'vdd': '4.97', 'temp': '15.7812', 'circuit': '2616BF0A020000FC', 'typ': 'DS2438', 'interval': 15, 'vad': '0.66', 'dev': 'temp', 'lost': False, 'humidity': 21.686466468323243, 'time': 1516545066.358944} 
    

    e-mails:

    Hi Johannes,

    you can read 4 different values from the DS2438 chip - Vdd, Vad, Vcurr and Temp.

    My sensors ude these values as follows: Vdd is supply voltage, Vad is humidity, Vcurr is light intensity or digital input, Temp is temperature.

    I cannot see the Vcurr value at you picture.

    so as far as I am not familiar with Unipi system, I have to redirect you to the Unipi to question them.

    S přátelským pozdravem
    Ing. Pavel Sedláček


    SED tronic
    Jana Koziny 1628/31, Teplice, 415 01, Česká republika
    Tel.: +420 777 729 833
    E-mail: info@sedtronic.cz
    Www: http://www.sedtronic.cz
    IČ: 74343688 DIČ: CZ8007222850


    Vývoj elektroniky a software pro domácí automatizaci

    Dne 22.01.2018 v 13:44 Johannes Untiedt napsal(a):
    Hi Pavel,
    many thanks for your extremly quick response!
    What you gave me is exactly what I understood from the data sheet. But the voltage I get is higher then what you are telling me.
    Please have a look at my attached print-out from the unipi system.
    regards
    Johannes

    Am 22.01.2018 um 13:14 schrieb Ing. Sedláček Pavel:
    Hi Johannes,

    the formula is simple. When Vcurr (light sensor output) voltage is:

    0 V = 0% light intensity
    0,25 V = 100% light intensity

    Hope this helps

    S přátelským pozdravem
    Ing. Pavel Sedláček


    SED tronic
    Jana Koziny 1628/31, Teplice, 415 01, Česká republika
    Tel.: +420 777 729 833
    E-mail: info@sedtronic.cz
    Www: http://www.sedtronic.cz
    IČ: 74343688 DIČ: CZ8007222850


    Vývoj elektroniky a software pro domácí automatizaci
    Dne 22.01.2018 v 13:07 Johannes Untiedt napsal(a):
    First and last name: Johannes Untiedt
    Telephone: +49 172 8222714
    I bought your U1WTS sensor from UniPi Technology. Unfortunately I don't understand your data sheet very well regarding the calculation of the light intensity 0 to 100 %. I would very much appreciate if you could e-mail me the formula for this calculation. kind regards Johannes Untiedt



  • hi Tomas,

    in evok Github owclient.py I found that the DS2438 class is a specific humidity sensor. Vcurr is not read in and is missing for the correct function of a light sensor, which needs Vcurr as input.

    I would suggest to change the DS2438 class to be more generic, as there are many different 1w sensors on the market simulating DS2438. Just return the 4 values to the user and let him do the calculation for humidity, light and so on.

    This would alow me to use my recently aquired sedtronic light sensor.

    I found an interesing page on the web regarding 1w. Have a look:

    http://www.tm3d.de
    https://www.tm3d.de/elektronik-projekte/1-wire-simulation-v2/konfigurationscode/berschreibung

    interesting library:
    https://smho.de/gw/?p=public/owPython.git;a=blob;f=owlib.py;h=7dee3e66b34b6bda392512b82477e87f4e3e892c;hb=HEAD


  • administrators

    Hi @juntiedt!

    You are right, we don't export the VCurr. I've pushed an update to Evok on Github to fix this. You can just replace the owclient.py file with the new version to get it working quickly.


  • administrators

    It turns out that OWFS know about any VCURR value for DS2438. (as per http://owfs.org/index.php?page=ds2438) This poses us with a rather sizable problem - do you believe that any of the other variable as per the OWFS documentation would be appropriate?


  • administrators

    After further investigation the VIS value is similar to VCURR - VCURR is not a value standard for owfs. I will make EVOK provide the VIS value, but unfortunately the VCURR value depends on the resistor used - I attempted to contant mister Sedlacek regarding this, but I hadn't gotten a reply as of yet.



  • HiTomas,
    in the library, that I mentioned above, they called Vcurr just I which means current. As sedtronic said, I = 0 means 0% and I=0,250 mens 100%. Knowing this, I don't care about the resistor.

    Also have a look at the many conversation calculations in the library above. Actualy one can read the code for the formula from the 1w device.


  • administrators

    You should be able to use the latest owclient.py to read the VCurr/VIS value. After a call to Mr. Sedlacek, the value and calculation is the same, just the naming scheme is different.

    To be clear I should note VIS is not I, but rather voltage delta between the two VSens inputs into ds2438 (http://pdf1.alldatasheet.com/datasheet-pdf/view/58618/DALLAS/DS2438.html). To compute I one does in fact need the resistor value.

    I did have a look at the website you sent me, but while interesting it a) does not have all the sensors that can be connected to the DS2438 and b) 1Wire does not have any way of identifying which sensors are connected to it, which means the user would have to specify which formula to use anyhow.

    Apologies for it being so difficult to read the value. The sensor has been primarily tested with Mervis rather than EVOK.



  • i just changed owclient.py in /opt/evok/ but had no success. The http Client interface crashes when now reading ds2438 device.


  • administrators

    @juntiedt

    That's odd. I haven't had that happen myself when I tested the change. In fact the client interface does not read any of the sensor data aside from temperature and humidity, here:

    case "1wdevice": {
    	if (device_properties["typ"] == "DS2438") {
    		device_properties["device_name"] = "" + device_properties["typ"] + " - " + circuit_display_name;
            if (msg.value == null) {
            	device_properties["value"] = "N/A";
            	device_properties["humidity"] = "N/A";
            }
            else {
            	device_properties["value"] = msg.temp.toFixed(1);
            	device_properties["humidity"] = msg.humidity.toFixed(1);
            	device_properties["unit"] = "°C";
            }   	
    	} else {
    		device_properties["device_name"] = "Sensor " + device_properties["typ"] + " - " + circuit_display_name;
            if (msg.value == null) {
            	device_properties["value"] = "N/A";
            }
            else {
            	device_properties["value"] = msg.value.toFixed(1);
            	device_properties["unit"] = "°C";
            }
    	}
    	break;
    }
    

    When you say it crashes, what do you mean exactly?



  • Hi Tomas,

    this is what I get with the new owclient.py when calling temp device:

    {'code': 500, 'status': 'error', 'message': 'Internal Server Error'}
    

    All other devices are ok


  • administrators

    I've now pushed a fix for the display issue. The device type of the DS2438 has been changed to temp, but the interface which verifies the requests wasn't updated properly for it, and the GUI had trouble dealing with it as well.

    Replacing the devices.py (in /opt/evok) and main.js (in /var/www/evok/js/) with the latest versions should do the trick now.



  • Hi Tomas,

    thanks for your fast response, but that's what I get now:

    Traceback (most recent call last):
      File "/home/pi/part_10/webapp/UniPi_devices.py", line 9, in <module>
        records = unipi.get_all_devices("j")
      File "/home/pi/part_10/webapp/UniPi_interface_class.py", line 56, in get_all_devices
        res = urllib.request.urlopen(url_rest).read()
      File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python3.5/urllib/request.py", line 472, in open
        response = meth(req, response)
      File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python3.5/urllib/request.py", line 510, in error
        return self._call_chain(*args)
      File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
        result = func(*args)
      File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 502: Bad Gateway
    

    Hope the problem is not to bad ...


  • administrators

    I tested it with a clean Raspberry Pi image using the latest GH master. You shouldn't need to use a clean image, however; it was more to check that everything else works as it should.

    It might help if you replace all of EVOK source code with the latest version (i.e. the .py files, evok.py and schemas.py in particular). I've tested both the REST and WebSocket API so it should work. The error could be from verification code in evok.py/schemas.py, where if you use a newer version of the other files they fail to work properly together.



  • Hi Tomas,

    after reinstalling evok everything is ok!
    Many thanks for your professional support.
    have alook at my trainings unipi control panel 188.194.138.174
    temp devices get updated every minute and the other devices uses evok websocket events.

    Hannes


  • administrators

    @juntiedt said in sedtronic light intensity sensor:

    Hi Tomas,

    after reinstalling evok everything is ok!
    Many thanks for your professional support.
    have alook at my trainings unipi control panel 188.194.138.174
    temp devices get updated every minute and the other devices uses evok websocket events.

    Hannes

    That looks really excellent! Glad you got it working well now.

    Apologies for the issues with EVOK.
    Kind Regards
    Tomas