Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Connecting a Wovyn sensor to the Internet of Things using a Pico and KRL.

Opening up the sensor, we can see model, serial, and version numbers. Besides its internal sensors, this device has an external temperature probe on a nine foot cable.

Image Removed

Turning over the plastic-shielded printed circuit board, and pulling out the battery pack gives us access to everything we need to proceed.

Image Removed

...

. The small black chip is the temperature sensor.

...

Step-by-step guide

To configure the sensor's endpoint, we must turn the sensor into a wifi hotspot and connect to it.

Before doing this, find and record the ip address your pico engine is running on, the port number, pico ECI (channel) for the incoming event from the Wovyn device, and the domain/type of the event you would like to send (e.g. wovyn/heartbeat). Use this information to create a Sky Event API URL

Code Block
http://<yourIPaddress>:<yourPort>/sky/event/<yourECI>/<eventID>/<domain>/<type> 

You can test this URL in your browser to ensure it connects to your pico and raises the right event.

Configuring the sensor to send its the event:

  1. Get its attention by interrupting the power. We removed one of the batteries and replaced it. Immediately after restoring power, press the small black button beside the largest chip on the board. This will cause the device to become, for a short time, a WiFi hotspot

    To turn the sensor into a hotspot, interrupt the power by disconnecting the power cable. After a few seconds, reapply power. As soon as you see the first blue LED flash (it will be a rapid flash), hold down the white button on the board. There will be a pause, then some rapid blue LED flashes for 3 seconds or so. After the rapid flashes end, release the button. The window to hold down the button after you reapply power is short, so be ready.

  2. Select the WiFi hotspot using your personal computer. In our case, its advertised name is Wovyn_

    0EC86F

    2C2025.

    After

     After a brief moment, the capture screen appears.

     Image RemovedSelect the network which the device should use to communicate to the Internet. If

    See step 4 if it does not automatically appear.

  3. On some operating systems, the capture screen does not appear automatically, and you'll need to open a browser, navigate somewhere (doesn't matter where), and the capture will then open.

    Image Added
  4. If you click on the button "Configure WiFi", the device will scan for WiFi hotspots and present a list, from which you can select one. Select the network which the device should use to communicate to the Internet. If you know the SSID, you could instead choose the button "Configure WiFi (No Scan)", and enter the SSID manually.

    With nothing in the configuration boxes, you

    You will enter the Sky Event URL you created above as the Endpoint URI. You will see these prompts:

    Image Removed

    Image RemovedImage AddedEnter the password for that network, and the pieces of the URL which the device will use to send its event. In this case, we were wanting the device to send a `sky/event` to a pico engine running on an EC2 host named "ec2-54-145-165-7.compute-1.amazonaws.com" but found that the device only retained the first 39 characters, so we set up a sub-domain to reach the same server using a shorter name as the hostname. The engine was listening on port 3000. The complete path for our experimental "sky/event" was

  5. set up as "/sky/event/ECI/EID/post/test", with "ECI" replaced with an actual event channel identifier of a pico running on that engine, and we used the digit "5" as an event identifier. Note that the leading slash is necessary in the path. With all the information provided, click the "save" button.

    Save the configuration. If you do not hit save, but rather hit cancel, then the device will remain as a hotspot for a little while and you may wonder why it is not sending any events.

  6. The device responds with this acknowledgement page.


    Image Removed

    The page will close automatically after a few seconds.

    Image Added
  7. Of course the pico identified by the ECI will need a ruleset to receive the event. This is the KRL code that we used initially. 

    linenumbers
    Code Block
    true
    ruleset post_test {
      meta {
        shares __testing
      }
      global {
        __testing = { "queries": [ { "name": "__testing" } ],
                      "events": [ { "domain": "post", "type": "test",
                                  "attrs": [ "temp", "baro" ] } ] }
      }
    
      rule post_test {
        select when post test
        pre {
          never_used = event:attrs().klog("attrs")
        }
      }
    }
    
    

    The rule selected does nothing but log the event attributes. Notice that the ruleset shares a test harness which allows us to easily send a test event from the "Testing" tab of the "My Picos" page.

  8. We used the "Logging" tab to see what happens when the device sends an event. Image Modified
    Notice that several attributes are sent by the device. The first of these are "version", "eventDomain", "eventName", and "emitterGUID". The horizontal scrollbar indicates that there is much more. Capturing and re-formatting all of it, we see that the remaining attributes are named "genericThing", "specificThing", and "property". The following data structure is current as of 1/21/18.

    Code Block
    {
      	"versionemitterGUID": 2"5CCF7F2BD537",
      	"eventDomain": "wovyn.emitter",
      	"eventName": "sensorHeartbeat",
      "emitterGUID": "5CCF7F0EC86F",
      "	"genericThing": {
        		"typeId": "2.1.2.1",
        		"typeName": "generic.compoundsimple.arraytemperature",
        		"healthPercent": 5256.5789,
        		"heartbeatSeconds": 60010,
        		"data": {
          			"temperature": [
            {
              "name": "probe temperature",
              "transducerGUID": "5CCF7F0EC86F.1.1",
              "units": "degrees",
              "temperatureF": 72.72,
              "temperatureC": 22.62
            },
            {
              "name": 				{
    					"name":"ambient temperature",
              					"transducerGUID": "5CCF7F0EC86F.1.228E3A5680900008D",
              					"units": "degrees",
              					"temperatureF": 75.67,
              31,
    					"temperatureC": 24.2606
    				}
    			]
          }
          ],
          "humidity": [
            {
              		}
    	},
    	"property":{
    		"name": "ambient humidity"Wovyn_2BD537",
              "transducerGUID		"description": "5CCF7F0EC86F.1.3Temp1000",
              "units": "percent",
              "humidity": 22.59
            }
          ],
          "pressure": [
            {
              "name": "ambient pressure",
              "transducerGUID": "5CCF7F0EC86F.1.4",
              "units": "mmHg",
              "pressure": 854.27
            }
          ]
        }
      },
      "specificThing": {
        "make": 		"location":{
    			"description":"Timbuktu",
    			"imageURL":"http://www.wovyn.com/assets/img/wovyn-logo-small.png",
    			"latitude":"16.77078",
    			"longitude":"-3.00819"
    		}
    	},
    	"specificThing":{
    		"make":"Wovyn ESProto",
        		"model": "WTemp2001Temp1000",
        		"typeId": "1.1.2.12.20011000",
        		"typeName": "enterprise.wovyn.esproto.wtemp.20011000",
        		"thingGUID": "5CCF7F0EC86F5CCF7F2BD537.1",
        		"firmwareVersion": "Wovyn-WTEMP2001WTEMP1000-1.714",
        		"transducer": [
          {
            			{
    				"name": "Maxim DS18B20 Digital Thermometer",
            				"transducerGUID": "5CCF7F0EC86F.1.128E3A5680900008D",
            				"transducerType": "Maxim Integrated.DS18B20",
            				"units": "degrees",
            "temperatureC": 22.62
          },
          {
            "name": "Bosch Sensortec BME280 Digital Humidity, Pressure, and Temperature Sensor",
            "transducerGUID": "5CCF7F0EC86F.1.2",
            "transducerType": "temperature.Bosche Sensortec.BME280",
            "units": "degrees",
            "temperatureC": 24.26
          },
          {
            "name": "Bosch Sensortec BME280 Digital Humidity, Pressure, and Temperature Sensor",
            "transducerGUID": "5CCF7F0EC86F.1.3",
            "transducerType": "humidity.Bosche Sensortec.BME280",
            "units": "percent",
            "humidity": 22.59
          },
          {
            "name": "Bosch Sensortec BME280 Digital Humidity, Pressure, and Temperature Sensor",
            "transducerGUID": "5CCF7F0EC86F.1.4",
            "transducerType": "pressure.Bosche Sensortec.BME280",
            "units": "mmHg",
            "pressure": 854.27
          }
        ],
        "battery": {
          "maximumVoltage": 3.4,
          "minimumVoltage": 2.7,
          "currentVoltage": 3.07
        }
      },
      "property": {
        "name": "Wovyn WTEMP2001: 5CCF7F0EC86F",
        "description": "WTEMP2001",
        "location": {
          "description": "Timbuktu",
          "imageURL": "http://www.wovyn.com/assets/img/wovyn-logo-small.png",
          "latitude": 16.77078,
          "longitude": -3.00819
        }
      }
    				"temperatureC":24.06
    			}
    		],
    		"battery":{
    			"maximumVoltage":3.6,
    			"minimumVoltage":2.7,
    			"currentVoltage":3.21
    		}
    	},
    	"version":2
    }
    
    


  9. We also tried out the "Reset" option, which apparently forgets only the WiFi hotspot the device uses to send its heartbeat events, but retains the endpoint information.

  10. Finally, the "Info" button presents some internal information.

    Image Removed

...


  1. Image Added



Filter by label (Content by label)
showLabelsfalse
max5
spacesdocs
sortmodified
showSpacefalsesortmodified
reversetrue
typepage
cqllabel in ( "esproto" , "iot" ) and type = "page" and space = "docs"
labelsESProto IoT
Page Properties
hiddentrue


Related issues