{"id":231,"date":"2017-05-09T19:16:14","date_gmt":"2017-05-10T00:16:14","guid":{"rendered":"http:\/\/www.millamilla.com\/?p=231"},"modified":"2017-05-13T17:42:07","modified_gmt":"2017-05-13T22:42:07","slug":"millamilla_ds7505_library-for-arduino","status":"publish","type":"post","link":"https:\/\/www.millamilla.com:443\/?p=231","title":{"rendered":"MillaMilla_DS7505_Library for Arduino"},"content":{"rendered":"<p>I released my very first Arduino library that can be found right in the Arduino IDE without having to download it and install it manually! \u00a0You can still download it and install manually if you like. \u00a0It supports the <a href=\"https:\/\/www.maximintegrated.com\/en\/products\/analog\/sensors-and-sensor-interface\/DS7505.html\">DS7505 <\/a>temperature sensor.<\/p>\n<p>Many thanks to <a href=\"https:\/\/www.adafruit.com\/\">Adafruit<\/a> as I started with their <a href=\"https:\/\/github.com\/adafruit\/Adafruit_MCP9808_Library\">MCP9808<\/a> library as my template. \u00a0I purchase from Adafruit several times a year. \u00a0Their products, service, and commitment to education is first class!<\/p>\n<p>To add the library to your project, choose Sketch | Include Library | Manage Libraries &#8230; | Search for DS7505<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-233\" src=\"http:\/\/ostrich.hedrickfam.com:8081\/wp-content\/uploads\/2017\/05\/arduino_add_library-300x123.png\" alt=\"\" width=\"600\" height=\"246\" srcset=\"https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_add_library-300x123.png 300w, https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_add_library.png 465w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-229\" src=\"http:\/\/ostrich.hedrickfam.com:8081\/wp-content\/uploads\/2017\/05\/arduino_ds7505_library-300x81.jpg\" alt=\"\" width=\"598\" height=\"162\" srcset=\"https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_ds7505_library-300x81.jpg 300w, https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_ds7505_library-768x208.jpg 768w, https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_ds7505_library.jpg 783w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/p>\n<p>The library supports basic functionality for the DS7505 Temperature Sensor. \u00a0Once you install the library, you can open the example sketch and go.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-232\" src=\"http:\/\/ostrich.hedrickfam.com:8081\/wp-content\/uploads\/2017\/05\/arduino_open_example-300x114.png\" alt=\"\" width=\"600\" height=\"228\" srcset=\"https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_open_example-300x114.png 300w, https:\/\/www.millamilla.com:443\/wp-content\/uploads\/2017\/05\/arduino_open_example.png 514w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Here&#8217;s what the example looks like:<\/p>\n<pre class=\"lang:arduino decode:true \">\/**************************************************************************\/\r\n\/*!\r\nThis is a demo for the DS7505\r\n----&gt; https:\/\/www.maximintegrated.com\/en\/products\/analog\/sensors-and-sensor-interface\/DS7505.html\r\n\r\nThis code derived from the Adafruit_MCP9808_Library.\r\n\r\nAdafruit invests time and resources providing this open source code,\r\nplease support Adafruit and open-source hardware by purchasing\r\nproducts from Adafruit!\r\n*\/\r\n\/**************************************************************************\/\r\n\r\n#include &lt;Wire.h&gt;\r\n#include \"MillaMilla_DS7505.h\"\r\n\r\n\/\/ Create the DS7505 temperature sensor object\r\nMillaMilla_DS7505 tempsensor = MillaMilla_DS7505();\r\n\r\nvoid setup() {\r\n  delay(2000); \/\/ helpful on Teensy debugging to give time to open the serial monitor\r\n  Serial.begin(9600);\r\n  Serial.println(\"DS7505 demo\");\r\n  \r\n  \/\/ Make sure the sensor is found, you can also pass in a different i2c\r\n  \/\/ address with tempsensor.begin(0x48) for example\r\n  if (!tempsensor.begin()) {\r\n    Serial.println(\"Couldn't find DS7505!\");\r\n    while (1);\r\n  }\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Serial.println(\"wake up DS7505.... \"); \/\/ wake up DS7505 for normal power use\r\n  \/\/tempsensor.wake();   \/\/ wake up, ready to read!  If you don't wake when shutdown, you still get a temp reading, it will be the last reading while awake.\r\n\r\n  \/\/tempsensor.write8(DS7505_REG_CONFIG, DS7505_REG_CONFIG_CONVRESOL_12_BITS); \/\/ change default precision from default of 9 bits\r\n\r\n  \/\/ Read and print out the temperature, then convert to *F\r\n  float c = tempsensor.readTempC();\r\n  float f = c * 9.0 \/ 5.0 + 32;\r\n  Serial.print(\"Temp: \"); Serial.print(c); Serial.print(\"*C\\t\"); \r\n  Serial.print(f); Serial.println(\"*F\");\r\n  \r\n  \/\/Serial.println(\"Shutdown DS7505.... \");\r\n  \/\/tempsensor.shutdown(); \/\/ shutdown DS7505 for low power\r\n  \r\n  delay(1000);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>If you have a library you would like added to the Arduino IDE, check out the <a href=\"https:\/\/github.com\/arduino\/Arduino\/wiki\/Library-Manager-FAQ\">Library Manager FAQ<\/a>. \u00a0It is a very easy to follow reference. \u00a0It only took about 2 1\/2 days from when I created <a href=\"https:\/\/github.com\/arduino\/Arduino\/issues\/6268\">my issue<\/a> for it to be found by the IDE. \u00a0Thank you to the Library Manager Team!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I released my very first Arduino library that can be found right in the Arduino IDE without having to download it and install it manually! \u00a0You can still download it and install manually if you like. \u00a0It supports the DS7505 temperature sensor. Many thanks to Adafruit as I started with their MCP9808 library as my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-231","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=231"}],"version-history":[{"count":3,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":237,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions\/237"}],"wp:attachment":[{"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.millamilla.com:443\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}