Brooke's World The life and ramblings of Brooke.

May 9, 2017

MillaMilla_DS7505_Library for Arduino

Filed under: Uncategorized — Brooke @ 7:16 pm

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!  You can still download it and install manually if you like.  It supports the DS7505 temperature sensor.

Many thanks to Adafruit as I started with their MCP9808 library as my template.  I purchase from Adafruit several times a year.  Their products, service, and commitment to education is first class!

To add the library to your project, choose Sketch | Include Library | Manage Libraries … | Search for DS7505

The library supports basic functionality for the DS7505 Temperature Sensor.  Once you install the library, you can open the example sketch and go.

Here’s what the example looks like:

/**************************************************************************/
/*!
This is a demo for the DS7505
----> https://www.maximintegrated.com/en/products/analog/sensors-and-sensor-interface/DS7505.html

This code derived from the Adafruit_MCP9808_Library.

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
*/
/**************************************************************************/

#include <Wire.h>
#include "MillaMilla_DS7505.h"

// Create the DS7505 temperature sensor object
MillaMilla_DS7505 tempsensor = MillaMilla_DS7505();

void setup() {
  delay(2000); // helpful on Teensy debugging to give time to open the serial monitor
  Serial.begin(9600);
  Serial.println("DS7505 demo");
  
  // Make sure the sensor is found, you can also pass in a different i2c
  // address with tempsensor.begin(0x48) for example
  if (!tempsensor.begin()) {
    Serial.println("Couldn't find DS7505!");
    while (1);
  }
}

void loop() {
  //Serial.println("wake up DS7505.... "); // wake up DS7505 for normal power use
  //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.

  //tempsensor.write8(DS7505_REG_CONFIG, DS7505_REG_CONFIG_CONVRESOL_12_BITS); // change default precision from default of 9 bits

  // Read and print out the temperature, then convert to *F
  float c = tempsensor.readTempC();
  float f = c * 9.0 / 5.0 + 32;
  Serial.print("Temp: "); Serial.print(c); Serial.print("*C\t"); 
  Serial.print(f); Serial.println("*F");
  
  //Serial.println("Shutdown DS7505.... ");
  //tempsensor.shutdown(); // shutdown DS7505 for low power
  
  delay(1000);
}

 

If you have a library you would like added to the Arduino IDE, check out the Library Manager FAQ.  It is a very easy to follow reference.  It only took about 2 1/2 days from when I created my issue for it to be found by the IDE.  Thank you to the Library Manager Team!!

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress