KY-001 temperature sensor module OLED DISPLAY

Click Here to View Step by Step

KY-001 temperature sensor module OLED DISPLAY


short description :

KY-001 Temperature Sensor Module allows ambient temperature measurement using the digital serial bus.  

ARDUINO CODE 

Case 1 : 

#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 2 on the Arduino
#define Temperature_wire 4
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(Temperature_wire);
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");
  // Start up the library
  sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
}
void loop(void)

  // call sensors.requestTemperatures() to issue a global temperature 
  // request to all devices on the bus
  //Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
  //Serial.print("Temperature  ");
    Serial.print("Temperature: ");
  Serial.println(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
  delay(10000);
}

Case 2 with OLED DISPLAY

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display(-1);
// Data wire is plugged into pin 2 on the Arduino
#define Temperature_wire 4
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(Temperature_wire);
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");
  // Start up the library
  sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement

  // initialize with the I2C addr 0x3C
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  

  // Clear the buffer.
  display.clearDisplay();

  // Display Text
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(10,0);
  display.println("Hello world!");
  display.display();
  delay(2000);
  display.clearDisplay();
}
void loop(void)

  // call sensors.requestTemperatures() to issue a global temperature 
  // request to all devices on the bus
  //Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures

  //Serial.print("Temperature  ");
    Serial.print("Temperature: ");
  Serial.println(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(10,0);
  display.println( String(sensors.getTempCByIndex(0)) +" C");
  display.display();
  delay(2000);
  display.clearDisplay();
  delay(1000);
}

 

SPECIFICATIONS : 

Operating Voltage 3.0V to 5.5V
Temperature Measurement Range -55°C to 125°C [-57°F to 257°F]
Measurement Accuracy Range ±0.5°C
Board Dimensions 18.5mm x 15mm [0.728in x 0.591in]