KY-013 Analog Thermistor (Arduino)

9.2K168

Intro: KY-013 Analog Thermistor (Arduino)

I had a hard time finding "plug&play" info and codes, pinouts, etc. regarding the KY-013 Analog Temperature Sensor. I'm not a programmer for I just do a lot of trials & errors, mostly errors, but I finally got something going quite good. Well, good enough for me..
Here's how to get the temperature reading (in °Celsius) displayed on the Nokia 5110 LCD with an Arduino Uno (or compatible).
I will not explain anything, such as datasheets info, why this line there in the code, how to switch from Celsius to Faraneight (and so on for ever..) but rather show the pinouts & the code (below). There should be a free picture of my set-up included in this instructable. Not a nice one, I give you the point, but we're here for something more important than watching pictures. This is not Pinterest... ;)

STEP 1: The Force "itself"

<br>

-PINOUT FOR THE KY-013-
1-The pin near the "S" is the signal

2-Middle pin is grounded

3-Pin near the "-" is to 5Vcc -If you switch the Ground with the 5Vcc, the temperature will rise instead of dropping and vice-versa. Don't ask, it's like that. I even asked my GF but she does'nt know what the heck I'm talking about. I have the only woman who does'nt know everything in this world... Maybe it's something wrong in the code, but it works. If someone can provide any info about that, fell free to share the secret..

-PINOUT FOR THE NOKIA 5110 LCD SCREEN-

(all pins are Digital.)

8-(Ground) = If you need this info, put your Arduino stuff in it's original box and get a refund.

7-(Light) = I use a 220 Ohms resistor from this pin to the ground. (Backlight is optional, but usefull when it's dark, like let's say, at night, or if you're sitting in the fridge, door closed, to check how cold your beer is or any other scientific situations.)

6-(Vcc) = To 5V pin. Some say this LCD is 3.3V, some say 5.. I say "it works just fine this way."

5-(CLK) = Pin 7

4-(DIN) = Pin 6

3-(DC) = Pin 5

2-(CE) = Pin 4

1-(RST) = Pin 3

From here you'll need to use the Force.

I hope (I know..) that this should (will) help. Once again, I'm open for comments, greetings, donations, signed blank checks,cash or even Paypall. If you want to send me a life-size poster of Samantha Fox, I'll p.m. you my adress. Have fun, enjoy.
Comments are more than welcome.

8 Comments

Change line 16 from
Temp = log(((10240000 / RawADC) - 10000));
to
Temp = log(1000.0 / (1024.0 / rawADC - 1));
and you won't need to reverse polarity. KY-013 is a pull-up module.

Awesome brother :),

Anyway, u must change 1000.0 to 10000.0

Temp = log(10000.0 / (1024.0 / rawADC - 1));

u made my day!

LoL... the temperature will rise when switching + & -... did you feel how hot the sensor becomes then? :)

No, not at all.. It did'nt do much with this, I ripped it appart the same day. One of my first arduino project, so when it worked, I changed project.
But why would you invert the + with the - on the thermistor?

I have no clue why you would wanna do that... to melt the pcb? lol

Just dont do it..

Ok I reassembled it to check.. .. not really.. but.. warm.. or hot..?.. I did'nt noticed that before your comment.. I think it's the resistors on the board that gets hot, my fingers are too big.. But all in all, this circuit is simply a variable resistance with a reff. resistance.. And it's a next to zero amp value..

I remember using thermistors a few years ago. Lot's of fun!

Finding a way to make it work is just as (if not more) funnier than the application itself.. It's great to know how things work.