{"id":133,"date":"2015-06-02T00:41:58","date_gmt":"2015-06-01T21:41:58","guid":{"rendered":"http:\/\/home.dgrechka.net\/blog\/?p=133"},"modified":"2015-06-08T23:41:16","modified_gmt":"2015-06-08T20:41:16","slug":"toradex-oak-sensors-on-freebsd","status":"publish","type":"post","link":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/","title":{"rendered":"Toradex Oak sensors on FreeBSD"},"content":{"rendered":"<p>As the world moves toward the Internet of Things there are lots of cheap environmental sensors available at the market.<br \/>\nWhen it just started several years ago I spotted the <a href=\"http:\/\/www.toradex.com\/\">Toradex company<\/a> that sells embedded devices. I caught sight of the sensors series called <a href=\"http:\/\/developer.toradex.com\/knowledge-base\/oak-sensors-and-interfaces\">Toradex Oak sensors<\/a>. The Toradex supplied <a href=\"http:\/\/microsoft.com\/robotics\">Microsoft Robotics Studio<\/a> libraries for them which was right enough for my student project. So I ordered two.<\/p>\n<p>Now I&#8217;m building the monitoring system for a summer house based on Raspberry PI. And these sensors made by Toradex suits well for gathering environmental data.<br \/>\nThe official site provides <a href=\"http:\/\/developer.toradex.com\/knowledge-base\/oak-on-linux\">a sample<\/a> of using the sensors on linux. But I have a FreeBSD.<br \/>\nSo I started to think about constructing a simple solution to gather the data on BSD.<\/p>\n<p>The sensors identify themselves as HID devices. After short investigation I found that FreeBSD provides usbhidctl utility to communicate with HID. That looked promising as it did not require linux emulation. With a single command we are able to fetch all the immediate values from the sensor!<\/p>\n<p>Another task was data storage engine. My colleague Eugene suggested me using collectd or statsd to organize storage. Both of them appeared to be able to store the data and to stream the data to remote host for further storage. I decided to use collecd as it is in C so my Rapberry PI box will have minimal package set.<\/p>\n<p>Finally I ended up with the script that is invoked by collectd. The script enumerates HID USB devices, finds Toradex sensors, gets the values from them, applies proper units transformation and returns the data as the string compatible with collectd.<\/p>\n<p>I share it here. So you can download it, modify and extend for your needs.<\/p>\n<p>Open the post to access downloads.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As the world moves toward the Internet of Things there are lots of cheap environmental sensors available at the market. When it just started several years ago I spotted the Toradex company that sells embedded devices. I caught sight of the sensors series called Toradex Oak sensors. The Toradex supplied Microsoft Robotics Studio libraries for &hellip; <a href=\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Toradex Oak sensors on FreeBSD&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":134,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10,27,2,17],"tags":[28,26,15,30,29,13,16],"class_list":["post-133","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data","category-environment","category-hobby","category-meteo","tag-air-humidity","tag-air-temperature","tag-atmospheric-pressure","tag-collectd","tag-raspberry-pi","tag-sensor","tag-time-series"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Toradex Oak sensors on FreeBSD - Dmitry A. Grechka<\/title>\n<meta name=\"description\" content=\"Gathering environmental data with Toradex Oak sensors on FreeBSD and storing it to RRD files through collectd.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Toradex Oak sensors on FreeBSD - Dmitry A. Grechka\" \/>\n<meta property=\"og:description\" content=\"Gathering environmental data with Toradex Oak sensors on FreeBSD and storing it to RRD files through collectd.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/\" \/>\n<meta property=\"og:site_name\" content=\"Dmitry A. Grechka\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-01T21:41:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-06-08T20:41:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png\" \/>\n\t<meta property=\"og:image:width\" content=\"813\" \/>\n\t<meta property=\"og:image:height\" content=\"282\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"dmitry\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dmitry\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/\",\"url\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/\",\"name\":\"Toradex Oak sensors on FreeBSD - Dmitry A. Grechka\",\"isPartOf\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png\",\"datePublished\":\"2015-06-01T21:41:58+00:00\",\"dateModified\":\"2015-06-08T20:41:16+00:00\",\"author\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f\"},\"description\":\"Gathering environmental data with Toradex Oak sensors on FreeBSD and storing it to RRD files through collectd.\",\"breadcrumb\":{\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#primaryimage\",\"url\":\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png\",\"contentUrl\":\"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png\",\"width\":813,\"height\":282},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/grechka.family\/dmitry\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Toradex Oak sensors on FreeBSD\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#website\",\"url\":\"https:\/\/grechka.family\/dmitry\/blog\/\",\"name\":\"Dmitry A. Grechka\",\"description\":\"Personal blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/grechka.family\/dmitry\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f\",\"name\":\"dmitry\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g\",\"caption\":\"dmitry\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Toradex Oak sensors on FreeBSD - Dmitry A. Grechka","description":"Gathering environmental data with Toradex Oak sensors on FreeBSD and storing it to RRD files through collectd.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/","og_locale":"en_GB","og_type":"article","og_title":"Toradex Oak sensors on FreeBSD - Dmitry A. Grechka","og_description":"Gathering environmental data with Toradex Oak sensors on FreeBSD and storing it to RRD files through collectd.","og_url":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/","og_site_name":"Dmitry A. Grechka","article_published_time":"2015-06-01T21:41:58+00:00","article_modified_time":"2015-06-08T20:41:16+00:00","og_image":[{"width":813,"height":282,"url":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png","type":"image\/png"}],"author":"dmitry","twitter_misc":{"Written by":"dmitry","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/","url":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/","name":"Toradex Oak sensors on FreeBSD - Dmitry A. Grechka","isPartOf":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#primaryimage"},"image":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#primaryimage"},"thumbnailUrl":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png","datePublished":"2015-06-01T21:41:58+00:00","dateModified":"2015-06-08T20:41:16+00:00","author":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f"},"description":"Gathering environmental data with Toradex Oak sensors on FreeBSD and storing it to RRD files through collectd.","breadcrumb":{"@id":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#primaryimage","url":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png","contentUrl":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png","width":813,"height":282},{"@type":"BreadcrumbList","@id":"https:\/\/grechka.family\/dmitry\/blog\/2015\/06\/toradex-oak-sensors-on-freebsd\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/grechka.family\/dmitry\/blog\/"},{"@type":"ListItem","position":2,"name":"Toradex Oak sensors on FreeBSD"}]},{"@type":"WebSite","@id":"https:\/\/grechka.family\/dmitry\/blog\/#website","url":"https:\/\/grechka.family\/dmitry\/blog\/","name":"Dmitry A. Grechka","description":"Personal blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/grechka.family\/dmitry\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/63485104fdec6dbe258ea67c2e053a6f","name":"dmitry","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/grechka.family\/dmitry\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ce55dc1fed08e9a15667f56e3285826aa634c717d9c0e34809d717f699bb7b0b?s=96&d=identicon&r=g","caption":"dmitry"}}]}},"jetpack_featured_media_url":"https:\/\/grechka.family\/dmitry\/blog\/wp-content\/uploads\/2015\/06\/cube_humidity.png","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":7,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/posts\/133\/revisions\/144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/media\/134"}],"wp:attachment":[{"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grechka.family\/dmitry\/blog\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}