PIC as temperature sensor, some code

This is the one guys, it gives you the option to set the temp alert in degrees C or in timer counts. and it also displays the temp in degrees C. ftp://panteltje.com/pub/temp3.asm

Should be accurate enough without any calibration as an over-temperature guard.

I've tried it with 75°C and it does it nicely, went up to 100°C and still going fine.

Should display negative temps as -xx°C too.

I have followed a bit different strategy then the Microchip app note suggests, and that seems to work just fine. Is the math in that paper wrong? ;-)

There are a couple of defines and equ statement at the top of the asm that you can play with and use to calibrate if needed.

It now displays room temperature here, could be used in a thermostat :-)

Reply to
Jan Panteltje
Loading thread data ...

Nice, but what is the point of using this instead of e.g. a cheap SE95, which is more accurate and doesn't need to be calibrated?

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

On a sunny day (Mon, 10 Aug 2009 19:07:08 +0200) it happened Frank Buss wrote in :

guard.

One or more points would be;

1) I have this in the drawer. 2) It can do other tasks too. 3) I do not have to order it, so saves shipping, makes it cheaper then XXX chip. 4) I have it immediately available. 5) It does not have a minimum order quantity of 2500:
formatting link
and even then a cheap PIC is cheaper. 6) It does not have a boring i2c interface, but sends RS232 at 9600 Baud in ASCII like this: 26°C 7) That RS232 output is always there, so you can have many of these PICs and just stick your terminal interface on one if you need to know °C. 8) It is portable to just about _any_ PIC, so is in a way second sourced. 9) You do not have to study those i2c registers to use it, just specify the temp, program it, and solder it in. 10) You can change the program at any time as it is in the public domain and not read protected. 11) ... 99999) I wrote it, so I have something to be proud about, other then gluing YAAC (Yet An Other Chip) on a board.

Hope that answers you question !

Reply to
Jan Panteltje

XXX chip.

formatting link

You don't have to buy 2,500. There is another item at Digikey:

formatting link

Is there a PIC which you can get for $0.84 for one piece?

in ASCII like this:

and just stick your terminal interface on one if you need to know °C.

the temp, program it, and solder it in.

This is not much of a problem, even a PIC can read the registers with I2C. Default values are ok after reset. A short C program for calculating the temperature:

formatting link

Shoudl be easy to convert it to PIC assembler, if you really want to program in assembler :-)

and not read protected.

YAAC (Yet An Other Chip) on a board.

Yes, I understand you and sometimes I do such small hobby projects, too :-) But maybe it is not a good idea for a commercial mass product.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

On a sunny day (Mon, 10 Aug 2009 21:04:44 +0200) it happened Frank Buss wrote in :

XXX chip.

formatting link

The cheapest PIC this will work in costs 41 cent in quantity.

formatting link

You conveniently forget that you need an EXTRA micro plus programming ($$$) for the i2c.

Baud in ASCII like this:

PICs and just stick your terminal interface on one

sourced.

the temp, program it, and solder it in.

You need the extra processor, this PIC you can use stand-alone (more then one if you need to sense more temp points). You can OR the pin 2 together, add one cap, and it will stay high if any of the PIC sees a too high temp, use it for example to shut down the supply. I have an orange LED on it now for test, it flashes too :-)

Well, Program memory loaded: 635 word(s) Configuration loaded: 1 word(s) ID memory loaded: 0 word(s) Data memory loaded: 0 byte(s) Loading complete.

So, few resources used... why use C, makes no sense so close to the hardware with this sort of memory organisation.

and not read protected.

YAAC (Yet An Other Chip) on a board.

There are zillions of PICs in use, from mice (the thing you click with), to all sorts of gadgets. For a temp alert you need no high accuracy, 70 degrees C versus 75 C is OK. All things have their use, and I would not want a part that you cannot get in a few years. PICs are the universal building blocks :-)

hehe

Reply to
Jan Panteltje

formatting link

You are right, even in smaller quantities it is cheaper than the SE95:

formatting link

with this sort of memory organisation.

635 words doesn't fit in a PIC12F508-I/SN-ND :-)

all sorts of gadgets.

a few years.

Ok, if you have a stable voltage supply, 5°C might work. But a change in

0.5 VDC can result in a change of 10°C. So if you use the internal oscillator as a reference for measuring the WDT and a battery supply, it would be very difficult to measure the temperature. And the application note doesn't say anything about aging.

But using the WDT is a nice idea. I wonder if this is possible for other microcontrollers, too, with independant free running RC oscillators.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

formatting link

with this sort of memory organisation.

all sorts of gadgets.

a few years.

Maybe you could use the WDT as a voltage reference to control its own power supply.

Usually they try to make the RC oscillators more stable with temperature and voltage.

Reply to
Spehro Pefhany

This would require some external parts, which maybe would be more expensive than a small voltage regulator. And I think it would be difficult and the control loop could oscillate with a low frequency.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Reply to
Frank Buss

On a sunny day (Mon, 10 Aug 2009 22:18:25 +0200) it happened Frank Buss wrote in :

formatting link

They even want to program it for you :-)

with this sort of memory organisation.

OK, have to spend 4 cents more for a 12F509. But I was sort of generous with including a lot of extra code.. drop the RS232 out and you are there.

all sorts of gadgets.

a few years.

Yea, but you would most likely use this on a PCB with high power stuff, like power amps, or switching stuff.. Battery (like in AA or AAA type) stuff is usually made to use extremely low power.

Yes, it is just for fun I tried it, after Phil Hobbs needed something like that. It is in itself not a bad idea to have a temp alert in a case.

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.