# Temperature

Discussion in 'Programmer's Corner' started by FroceMaster, Nov 18, 2012.

1. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
Hi,
Have my 16F690 with a big "rain" program in it.
Works fine, but i would like a temperatur in it also.
Any hint on how that could be possible ?

use TMP36GT9Z could be possible ?
Do i have enough input left for that ?

it how it was done,.

Rgds
FroceMaster.

Last edited: Nov 18, 2012
2. ### nerdegutta Moderator

Dec 15, 2009
2,515
785
Davs.

You need to read the section in the datasheet containing the Analog-to-Digital converter. I think it is chapter 9.

3. ### spinnaker AAC Fanatic!

Oct 29, 2009
4,866
991

I assume you mean thermometer and not "temperatur". Yes you can use the TMP36GT9Z but it is an analog device and you will need an available analog input.

You don't post a schematic of your circuit so there is no way to determine if you have a pin available or not. Never ask a question without providing as much information as possible. A schematic is an important piece of information.

An easier chip to use (IMHO) is something like the DS18B20. It uses one wire protocol and all that is needed is an digital I/O pin. The problem is that you will most likely need a library to talk to the chip but there are a few libraries out there.

sleet1986 likes this.
4. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
Hi.
Sorry, yes a thermometer,

i have the RC4 RA0 RA1 and RA3 free on the 16f690
Could it be possible to use one of these.
i could post a scematic, but do not have an updated version.

5. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
Yes chapter 9,
RA0 would be a great input to use.
Could i just measure from 0.1v to 2 v it would be great
could i just read out the the input voltage ?

0.1 v = -40 C, 2v= +150 C
1900 mv 190 degree.
10mv pr degree.

6. ### nerdegutta Moderator

Dec 15, 2009
2,515
785
What will be "sensing/reading" the temperature. LM35 or and NTC thermistor, or something else?

I did almost something like this in this thread:

7. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
Hi,
U could have read my post

use TMP36GT9Z could be possible ?

8. ### nerdegutta Moderator

Dec 15, 2009
2,515
785
Ooops! Missed that one...

9. ### t06afre AAC Fanatic!

May 11, 2009
5,939
1,222
From what I remember. You have still some free pins on PORTA. If your PIC is using 5 volt as supply voltage, and keep things simple. You will get about .5 degree accuracy.

10. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
Yes,
Like this

and use RA0 as input,
and in software let it shift from temperature to rain, every 5 seconds.
it shouldnt be that hard or ?
could wish some "min" and "max" temperature since last reset.

File size:
90.4 KB
Views:
85
11. ### spinnaker AAC Fanatic!

Oct 29, 2009
4,866
991
Don't blame it on nerdgutta, the fault is all yours. Too many threads with the same subject is confusing.

12. ### spinnaker AAC Fanatic!

Oct 29, 2009
4,866
991
Yes you could with the chip that I mentioned. Check your datasheet. Are one of them an analog pin? If so you could use the chip you mentioned.

You know you need to do some of the work too.

13. ### spinnaker AAC Fanatic!

Oct 29, 2009
4,866
991
According to your schematic, You would need to use RA1. Or actually AN1. Not RA0. According to the schematic it is not analog. That is if you wanted to use the chip you mentioned. To use the chip I mentioned, it does not matter.

14. ### t06afre AAC Fanatic!

May 11, 2009
5,939
1,222
Should not be any problem at all. How much RAM and ROM are you using now? But start simple just displaying the temprature. Then get the extras after that

15. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
2318 of 4096
and
64 of 255

Memory Summary:
Program space used 90Dh ( 2317) of 1000h words ( 56.6%)
Data space used 40h ( 64) of 100h bytes ( 25.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)

Should i use shielded wire or just ordinary ?

16. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
Need to change
TRISA0=0 to TRISA0=00000010 ??
ANSELH=0; to ANSELH=00000100; ???

May 11, 2009
5,939
1,222

18. ### t06afre AAC Fanatic!

May 11, 2009
5,939
1,222
The corresponding TRIS bit shall be set to input. The corresponding ANSEL(H) bit shall be set to one. The rest is quite clear in the datasheet

19. ### spinnaker AAC Fanatic!

Oct 29, 2009
4,866
991
Oh yeah seeing it now. That schematic is so tiny.

20. ### FroceMaster Thread Starter Member

Jan 28, 2012
400
4
have order the part, and awaiting,
then i will see if i can get it to work,