Go Down

Topic: KY028 Temperature Sensor example (Read 3423 times) previous topic - next topic

bruedney

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

dc42

What is the part number on the 8-pin chip on that board?
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.

bruedney

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

dc42

#3
Oct 06, 2012, 11:26 pm Last Edit: Oct 06, 2012, 11:28 pm by dc42 Reason: 1
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.
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.

bruedney

Thanks DC

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

FarmerMark

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

dc42

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.
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.

Go Up