Ks0104 keyestudio EASY plug Analog Temperature Sensor: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
==EASY plug Analog Temperature Sensor ==
[[image:Ks0104-.png|thumb|600px|right|EASY plug Analog Temperature Sensor]]
<br>[[File:ks0100-1.png|500px|frameless|thumb]]<br>


<br>
==Introduction==
==Introduction==
This module is based on the working principle of a thermistor (resistance varies with temperature change in the environment). It can sense temperature change in its surrounding and send the data to the analog IO in the Arduino board. All we need to do is to convert the sensor output data to degrees Celsius temperature by simple programming and display it. It's both convenient and effective, and it’s widely applied in gardening, home alarm system and other devices. <br>
Are you still looking for a low-cost thermometer? Did you get one? Aha! Here it is! This EASY Plug analog temperature sensor is based on a thermistor. The resistance varies with surrounding temperature change. <br>
Note: this module needs to be used together with EASY plug control board.<br>
It can measure temperature change in the surroundings and send the data to Arduino analog IO. Just need to convert the output data to degrees Celsius temperature by simple programming. <br>
The sensor is convenient and cost effective, widely applied to gardening, home alarm system and other devices.  <br>
This module should be used together with EASY plug control board.<br>


<span style=color:red> '''Special Note:''' <br>
The sensor/module is equipped with the RJ11 6P6C interface, compatible with our keyestudio EASY plug Control Board with RJ11 6P6C interface. <br> If you have the control board of other brands, it is also equipped with the RJ11 6P6C interface but has different internal line sequence, can’t be used compatibly with our sensor/module. </span><br>


==Specification==
* Interface: Easy plug
* Sensor type: analog
* Working voltage: 5V
* Temperature range: -55℃~315℃
* Size: 38*20mm
* Weight: 5g


<br>


==Specification==
*Sensor type: Analog
*Working voltage: 5V
*Temperature range: -55℃~315℃
*High quality connector


==Connection Diagram ==
<br>
<br>[[File:ks0104-2.png|500px|frameless|thumb]]<br>
==Technical Details==
* Dimensions: 38mm*20mm*18mm
* Weight: 4.2g
<br>


== Connect It Up ==
Connect the EASY Plug  analog temperature sensor to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
<br>[[File:Ks0104-3.png|700px|frameless|thumb]]<br>
<br>


==Sample Code==
==Sample Code==
Copy and paste below code to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE Arduino IDE] and upload.
<pre>
<pre>
void setup()
void setup()
Line 30: Line 41:
{int sensorValue = analogRead(A1);
{int sensorValue = analogRead(A1);
Serial.println(sensorValue);
Serial.println(sensorValue);
delay(1);
 delay(1);
}
</pre>
 
<br>
We can see that the analog value is changing according to the surrounding temperature change. But it’s not very obvious. <br>
Let’s solve this by using the following equation. <br>
The value read from the serial port has little difference to normal temperature. eg. The temperature right now is about 25℃.<br>
 
<pre>
#include <math.h>
void setup()
{
   Serial.begin(9600);
}
}
void loop()
{
  double val=analogRead(1);
  double fenya=(val/1023)*5;
  // Ohm’s law r/100=fenya/(3.3-fenya)
  double r=(5-fenya)/fenya*4700;// divider resistance 4.7K,4.7K resistor to ground
  //double r=fenya/(5-fenya)*10000;//divider resistance10K,thermistor to ground
  Serial.println( 1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15);//3950 is the value B of thermistor
  delay(1000);
}
</pre>
<br>
==What You Should See==
Done uploading the code, open the serial monitor and set the baud rate to 9600,  the temperature value will display on the Arduino’s serial monitor.
<br>[[File:Ks0104-4.png|600px|frameless|thumb]]<br>
<br>


We can see that the analog value is changing according to the temperature change in the environment. But it’s not very obvious. Let’s solve this by using the following equation. The value read from the serial port is similar to normal temperature, eg. The temperature right now is 30C.
== Complete Code: ==


(display the temperature by 1602 LCD display module)
<pre>
#include <math.h>
#include <math.h>
double Thermister(int RawADC) {
#include <Wire.h>
double Temp;
#include <LiquidCrystal_I2C.h>
Temp = log(((10240000/RawADC) - 10000));
LiquidCrystal_I2C lcd(0x27,16,2);
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
float value;
Temp = Temp - 273.15; // Convert Kelvin to Celcius
void setup()
return Temp;
{
  Serial.begin(9600);
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Temperature:");
}
}
void setup()
void loop()
{Serial.begin(9600);
{
} void loop() { Serial.print(Thermister(analogRead(1))); // display Fahrenheit Serial.println("c");
  double val=analogRead(1);
delay(500);
  double fenya=(val/1023)*5;
  // Ohm’s law r/100=fenya/(3.3-fenya)
  double r=(5-fenya)/fenya*4700;// divider resistance 4.7K,4.7K resistor to ground
  //double r=fenya/(5-fenya)*10000;//divider resistance10K,thermistor to ground
  Serial.println( 1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15);//3950 is the value B of thermistor
  value =  1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15;
  if(value<10)
  {
  lcd.setCursor(0,1);
  lcd.print(value);
  lcd.setCursor(4,1);
  lcd.print("C    ");
  }
  if(value>=10)
  {
  lcd.setCursor(0,1);
  lcd.print(value);
  lcd.setCursor(5,1);
  lcd.print("C    ");
  }
  delay(1000);
}
}
</pre>
</pre>
<br>[[File:0104.png|600px|frameless|thumb]]<br>


==Resources ==
==Resources ==


'''PDF'''
Download link:


https://drive.google.com/open?id=1kSw1IcUuL0xmvvSrmTw0gmK_2489tRwh
https://fs.keyestudio.com/KS0104
 
<br>


==Buy from ==
==Buy from ==
'''Official Website'''
*[https://www.keyestudio.com/new-keyestudio-easy-plug-rj11-analog-temperature-sensor-module-for-arduino-steam-p0084-p0084.html  '''Official Website''' ]
 
*[https://www.aliexpress.com/store/product/2016-NEW-Keyestudio-EASY-plug-Analog-Temperature-Sensor-Module-for-Arduino/1452162_32638784973.html?spm=2114.12010612.8148356.64.3d2024eahxkd5R  Shop on aliexpress ]


http://www.keyestudio.com/keyestudio-easy-plug-analog-temperature-sensor-module-for-arduino.html


[[category:Module]]
[[category: EASY Plug]]

Latest revision as of 10:16, 7 August 2020

EASY plug Analog Temperature Sensor


Introduction

Are you still looking for a low-cost thermometer? Did you get one? Aha! Here it is! This EASY Plug analog temperature sensor is based on a thermistor. The resistance varies with surrounding temperature change.
It can measure temperature change in the surroundings and send the data to Arduino analog IO. Just need to convert the output data to degrees Celsius temperature by simple programming.
The sensor is convenient and cost effective, widely applied to gardening, home alarm system and other devices.  
This module should be used together with EASY plug control board.

Special Note:
The sensor/module is equipped with the RJ11 6P6C interface, compatible with our keyestudio EASY plug Control Board with RJ11 6P6C interface.
If you have the control board of other brands, it is also equipped with the RJ11 6P6C interface but has different internal line sequence, can’t be used compatibly with our sensor/module.



Specification

  • Sensor type: Analog
  • Working voltage: 5V
  • Temperature range: -55℃~315℃
  • High quality connector


Technical Details

  • Dimensions: 38mm*20mm*18mm
  • Weight: 4.2g


Connect It Up

Connect the EASY Plug analog temperature sensor to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
thumb

Sample Code

Copy and paste below code to Arduino IDE and upload.

void setup()
{Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop()
{int sensorValue = analogRead(A1);
Serial.println(sensorValue);
 delay(1);
}


We can see that the analog value is changing according to the surrounding temperature change. But it’s not very obvious.
Let’s solve this by using the following equation.
The value read from the serial port has little difference to normal temperature. eg. The temperature right now is about 25℃.

#include <math.h>
void setup()
{
   Serial.begin(9600);
}
void loop()
{
  double val=analogRead(1);
  double fenya=(val/1023)*5;
  // Ohm’s law r/100=fenya/(3.3-fenya)
  double r=(5-fenya)/fenya*4700;// divider resistance 4.7K,4.7K resistor to ground
  //double r=fenya/(5-fenya)*10000;//divider resistance10K,thermistor to ground
  Serial.println( 1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15);//3950 is the value B of thermistor
  delay(1000);
}


What You Should See

Done uploading the code, open the serial monitor and set the baud rate to 9600, the temperature value will display on the Arduino’s serial monitor.
thumb


Complete Code:

(display the temperature by 1602 LCD display module)

#include <math.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
float value;
void setup()
{
  Serial.begin(9600);
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Temperature:");
}
void loop()
{
  double val=analogRead(1);
  double fenya=(val/1023)*5;
  // Ohm’s law r/100=fenya/(3.3-fenya)
  double r=(5-fenya)/fenya*4700;// divider resistance 4.7K,4.7K resistor to ground
  //double r=fenya/(5-fenya)*10000;//divider resistance10K,thermistor to ground
  Serial.println( 1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15);//3950 is the value B of thermistor
  value =  1/(  log(r/10000) /3950 + 1/(25+273.15))-273.15;
  if(value<10)
  {
  lcd.setCursor(0,1);
  lcd.print(value);
  lcd.setCursor(4,1);
  lcd.print("C    ");
  }
  if(value>=10)
  {
  lcd.setCursor(0,1);
  lcd.print(value);
  lcd.setCursor(5,1);
  lcd.print("C    ");
  }
  delay(1000);
}


thumb

Resources

Download link:

https://fs.keyestudio.com/KS0104


Buy from