KY028 Temperature Sensor example

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

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

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

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.

Thanks DC

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

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

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.