Skip to main content

Posts

Showing posts with the label DS1820

Experiment No. 11: Temperature Data Logger Using PIC16F628A Microcontroller

This project is the combination of the two experiments that we already did in past: Experiment No. 4 and 10. In experiment 4, we demonstrated how to use the mikroC 1-wire library to read temperature data from a digital sensor DS1820, and display the value on a LCD screen. Now we are going to use the hardware UART to transfer the temperature data from the PIC to a PC (Exp. No. 10). The Hyper-Terminal program running on a PC will receive the temperature values and display on screen. The temperature data from the microcontroller will be sent in every 15 sec. Experimental Setup: The setup for this experiment is same as the Experiment no. 10 with a DS1820 inserted in its 3-pin female header receiver on the board. The data output of DS1820 is connected to RB.0 (see articles  Exp. No. 4 and 1-Wire Protocol for detail). You need to rebuild the same TTL to RS232 level shifter circuit on a breadboard and set up a hyper-terminal to receive data at 9600 baud rate.

Experiment No. 4 : Reading Temperature Values from DS1820 using 1-Wire Protocol

In this experiment, we are going to build a digital temperature meter using DS1820 connected to our PIC16F628A development board. The temperature value will be displayed on the LCD display. I have modified the sample program that comes with the compiler according to our PIC board requirements. Also I have elaborated comments in the program so that every step will be more clear to the readers. Experimental Setup: The experimental setup is very straight-forward. Place DS1820 device on the three-pin female header that we recently added to our board. And also connect the data pin of DS1820 to RB.0 pin of PIC16F628A using a jumper wire.  

The 1-Wire Communication Protocol

The 1-Wire is a registered trademark of Dallas Semiconductor Corp (now Maxim) for a serial communication protocol using a single data line and a ground reference. A 1-Wire Master (a microcontroller) initiates and controls the communication with one or more 1-Wire Slave devices (usually sensors). Each 1-Wire slave device has a unique, factory-programmed , 64-bit identifier, which serves as device address on the 1-Wire bus. This globally unique address is composed of eight bytes divided into three main sections. Starting with the LSB, the first byte stores the 8-bit family codes that identify the device type. The next six bytes store a customizable 48-bit individual address. The last byte, the most significant byte (MSB), contains a cyclic redundancy check (CRC) with a value based on the data contained in the first seven bytes. This allows the master to determine if an address was read without error. With a 248 serial number pool, conflicting or duplicate node addresses on the net are ne...