Posted: July 1, 2010
This is a dual project for reading the temperature from a DS18S20 1-Wire digital temperature sensor and an analog LM34 temperature sensor. Since the Atmel ATtiny2313 doesn't have A/D converters, I used this chip to read the DS18S20. For the analog I used the dsPIC30F3012. This is my first time using a dsPIC chip and my first time writing code for a microcontroller in C. I'm an assembly guy when it comes to hardware :).
Update: August 25, 2011 - I've been working on a new circuits using a DS18B20 temperature sensor /w MSP430's. I have a bluetooth thermometer and a talking clock thermomter along with some small sample programs the naken_asm page.
Related Projects @mikekohn.net
Top: DS18S20 digital temperature sensor with an Atmel ATtiny2313
microcontroller. The 2 BCD to 7 seg display show the current temperature
So basically both circuits read the temperature from their 3 pin sensors and display the data using MC14511 BCD to 7 seg display chips. For a minus sign I used a flat LED. The DS18S20 (which I believe is discontinued? SparkFun still sells the DS18B20 which should be 100% compatible as a part of the DS1820 family). I probably overkilled it pretty badly. I used a kind of state machine linked list of interrupt routines to bitbang to and from the 1-Wire bus. Probably I could have run it at 1MHz and used a bunch of NOP's or a tight loop to do the timings, which seem to not need to be that accurate for this chip.
The LM34 seems to be a pretty common chip. It outputs an analog voltage which represents the temperature in fahrenheit. I was originally going to convert it to celcius, but that would cause more precision loss on a 16 bit mpu, so I decided to leave it with the evil fahrenheit measurement.
Here is a newer circuit I made with a DS18B20, MSP430, and a bubble LED. I'll post a schematic and the code sometime later. https://youtu.be/2whr1bs_aDs
Copyright 1997-2021 - Michael Kohn