Pages: [1]   Go Down
Author Topic: KY028 Temperature Sensor example  (Read 3197 times)
0 Members and 1 Guest are viewing this topic.
Wellington
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
I am an Arduino newbee and have a Sensor set from DX.

I am trying to work my way through all the sensors but I can not find any example code for the KY028 (4 pin) Temperature module.

It looks like this
http://www.aliexpress.com/item-img/Temperature-sensor-module-KY028-ARDUINO-applicable/596737283.html

Any help gratefully accepted.

Bruce
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6639
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the part number on the 8-pin chip on that board?
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Wellington
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

It is a LM393.

7 of the modules in the kit have the same board. They all differ from the ones in the cutedigi kit in that these are all Red and have 4 pins labelled A0, G, + & D0.

They are Keyes Modules but I can not find any datasheets on any Keyes boards anywhere.

Thanks
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6639
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The LM393 is a comparator. My guess is that the temperature sensor is a thermistor, and the output of the module is high or low depending on whether the temperature is above or below a target temperature, which you can select by adjusting the potentiometer on the board. So you can try connecting the power (+?) and ground (G?) pins of the module to Arduino +5V and ground respectively, and the output (D0?) to a digital input pin. The A0 pin is possibly an analogue output that you could connect to an analogue input pin to get a reading of temperature rather than just an above/below status.
« Last Edit: October 06, 2012, 04:28:31 pm by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Wellington
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks DC

I'll give it a go and see what I end up with
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If I dump the analog output straight to the serial output I get numbers such as 220 for my household temp, 170 for my finger tip and 300+ after touching the tip with ice.  How would I translate this to actual temps?  Of course I must consider that these may be F temps, not C temps but higher for colder??  Do I need to us 'map' to convert values? Thanks.
Mark
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6639
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds as though the thermistor is the lower resistor (the one connected to ground) in a potential divider. If so, the resistance of the thermistor relative to the fixed resistor is equal to a/(1024 - a), where a is the analog reading, assuming the potential divider is being fed from +5V and you are using the default 5V analog reference. You can then calculate the temperature using the Steinhart-Hart equation, see http://www.daycounter.com/Calculators/Steinhart-Hart-Thermistor-Calculator.phtml.

Temperature sensors that give an output voltage linear in temperature (e.g. LM34, LM35, LM335), or that give a digital output (e.g. DS1820B) are easier to work with.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: