Skip to main content


Showing posts from September, 2010

Centigrade and Fahrenheit Scale Digital Thermometer with LCD Display

Digital thermometers are cool devices as they show temperatures in human readable formats. This digital thermometer project is based on a PIC16F688 microcontroller and a DS1820 temperature sensor, and it displays temperature on a character LCD screen in both Celsius and Fahrenheit scales. I selected PIC16F688 for this project because it is cheap (I bought one for $1.50). DS1820 is a 3-pin digital temperature sensor from Dallas semiconductors (now Maxim) which is designed to measure temperatures ranging from -55 to +125 °C in 0.5 °C increments. The firmware I have written is able to read and display the entire temperature range of DS1820. In order to test for temperature measurements below 0°C, I put the sensor inside my freezer. While trying this, don’t put the whole unit inside the freezer as LCD display unit may stop working at the freezer temperature. Similarly, bringing a soldering iron tip close to the sensor can do testing for the higher range temperature values.

Make your own Serial LCD for PIC Microcontrollers

HD44780 based character LCD displays are very popular among hobbyists. They are easy to interface with microcontrollers and most of the present day high-level compilers have in-built routines for them. However, the bad part is at least 6 I/O pins of microcontroller are required to use them in your project. Therefore, they are not applicable for 8-pin devices like PIC12F series microchips. The aim of this project is to allow LCD interfacing to such devices using 3-wires. I am going to demonstrate this with PIC12F683 microcontroller. The character data or command from the microcontroller will be transferred serially to an 8-bit serial-in parallel-out shift register (74HC595), and the parallel output will be fed to the LCD driver pins.

Using PIC Timer1 Module for Counting Frequency of an External Clock Source

The Timer1 module inside PIC12F683 is a 16-bit timer/counter. If used as an asynchronous counter, this module can be used for counting the frequency of an external clock source applied to its GP5/T1CKI port. The following example is a 0-65535 Hz frequency counter using Timer1 module of PIC12F683. The Timer1 module is reset first and then turned ON for 1 sec to count the clock pulses arrived at its T1CKI port during that period. The number of pulses arrived in  second is frequency itself. The measured frequency value is sent to PC through serial port and displayed on a hyperterminal receiver window. If the external clock frequency is over 65535 Hz, Timer1 overflows and an interrupt is generated. In case of the overflow, "Frequency out of range " message is displayed on the window. A 555 Timer IC running as an astable multivibrator is used as the external clock source.

00-99 Minutes Timer

This project describes how to program PIC16F628A to function as a 00-99 min programmable timer. User can set any time between 00-99 minutes and can turn ON a device for that period. The device will be automatically turned OFF after the time expires. For demonstration, the ON/OFF condition of device is simulated by switching LED ON and OFF. With the use of three input switches (unit, ten, start/stop) the user can set ON time of the timer and can also control Start/Stop operation. The two time set switches are for selecting unit and tens digit of minute time interval (00-99). Once you set the value of minute interval, pressing the Start/Stop will turn the timer ON (LED will glow), and pressing the same button again at any point of time during timer operation will interrupt the process (LED will turn OFF) and the timer will be reset. LCD display will provide timer status and user interface for setting time.

Connect SW1, SW2, and SW3 to RB0, RB1, and RB2 respectively. S…

Neat LED Chaser for Hobbyists

Besides just turning ON and OFF, there are lot of other stuff that you can do with LEDs. In one of my experiments, I showed how to control the intensity of an LED using PWM. Here's a project that uses the similar concept to generate 8-channel PWM signals through PIC16F628A ports and drive 8 LEDs with 4 levels of intensity. A number of visual effects and chase sequences are programmed into the firmware. Enjoy watching this video! 

Experiment No. 12: Timer0 Counting AC Line Frequency

The Timer0 module in PIC16F628A is both 8-bit Timer and Counter. When used as Counter, the Timer0 module will increment on every rising or falling edge of the T0CKI (RA4, pin 3) pin. The incrementing edge is determined by the T0SE bit of the OPTION register.

PIC16F628A Experiments

Here's the list of all the experiments I have posted on this blog. I have performed these experiments on my PIC16F628A development board.
(First read about my PIC16F628A Development Board)

PIC16F628A + DS1820 + 4-Digit Seven Segment C/F Thermometer

This project describes how to read temperature from a DS1820 sensor with a PIC16F628A microcontroller and display the temperature value in a multiplexed 4-digit seven segment display. The temperature will be displayed in both Centigrade and Fahrenheit units switching back and forth. The temperature resolution is 1 degree in both the units. Out of 4-digits, the most significant three digits will display numeric temperature values from 00 to 125. The most significant digit will show '-' for negative temperatures, and the least significant digit will display C or F.

On my PIC16F628A board, connect D1 to RA2, D2 to RA1, D3 to RA0, and D4 to RA3. DS1820 data will be read at RA4 port. The seven segments a-g will be driven by RB0-RB6.


/* Project name:
     Seven-segment display digital thermometer
 * Copyright:
     (c) Rajendra Bhatt, 2010.
      MCU:             PIC16F628A
     Oscillator:      XT, 4.0 MHz

// Temperature digits
unsigned short i, DD0=0x3f, DD…

Gear Clock Controlled by PIC16F628A

I was browsing internet for PIC16F628A related projects and I saw this. This guy came up with an amazing idea. He made some wooden gears, tied them up, and drove with a stepper motor from a floppy drive, and turn it into a Gear Clock. The stepper motor is controlled by a PIC16F628A Microchip that also keeps track of time. You can set time with the help of two switches that control clockwise and anti-clockwise motion of the minute gear. If both the switches are pressed, the stepper motor is de-energized and the minute gear is free to rotate by hand.


Digital Thermometer on a Nokia LCD Screen

If you have an old Nokia 3310 cell phone, don't throw it away. You can use its LCD screen for this cool project. This project describes the use of such a LCD to display temperature.  It uses PIC12F629 microchip as a brain that reads temperature measurement from a DS18B20 sensor, and displays it on a Nokia 3310 LCD screen.