PIC16F84A PROJECTS

PIC Microcontroller Projects

PIC16F84A PROJECTS

PIC16F84A is a powerful PIC micro-controller chip . CPU Card of most of the electronic Devices and Machines use PIC16F84A Micro-controller. You can find the basic PIC16F84A Projects with short explanation in this article which are definitely going to work for Engineering students .

Following are the main Features of PIC16F877A Micro-controller

  • 200 nanosecond instruction execution
  • Easy-to-program (only 35 single word instructions)
  • CMOS Flash/EEPROMbased 8-bit micro-controller
  • It assembleMicrochip’s powerful PIC architecture into an 18-pin package
  • Use inprototyping and production
  • The end application can be easily updated without removing the device from the end product via the ICSP
  • Easily adapted for automotive, industrial, appliances low power remote sensors, electronic locks and security applications

Furthermore it is the advanced version of PIC16F84 Micro-controller

The PIC16F84A Parameters:

Parameter Name  Value
Program Memory Type Flash
Program Memory Size (KB) 1.75
SRAM Bytes 68
CPU Speed (MIPS/DMIPS) 5
Data EEPROM/HEF (bytes) 64
Timers 1*8 bit
Operating Voltage Range (V) 2 to 6
Temperature Range (C) -40 to 85
Pin Count 18

 

You can refer and download the PIC16F84A Data-sheet for carrying out the projects.

Download PIC16F84A Data-sheet

It is interesting to work on projects and the PIC programming. One can design and implement his or her own ideas on various projects with the reference to the PIC16F84A Fundamentals. Here is the content for your project idea search.

10+ PIC16F84A Projects for engineering students

  • Interfacing PIC16F84A with SD Card

We can Interface the SD Card and PIC16F84A Using MPLAB IDE or C-Aware. MPLAB IDE Uses XC series of compilers and similarly C-Aware uses CCS C series of Compilers. CCS C also provides the compilers to launch with MPLAB IDE.

Hardware Requirements

PIC16F84A microcontroller, 8 MHz crystal, 2 x 22pF ceramic capacitors, SD Card, AMS1117 3.3V voltage regulator, 3 x 3.3K ohm resistor, 3 x 2.2K ohm resistor, 2 x 10K ohm resistor, 5 x 10uF polarized capacitor, 100nF ceramic capacitor, MAX232 chip, Female RS232 connector, Male-female RS232 cable, 5V Power source, Breadboard, Jumper wires. Let us use RA0 for TX(Transmission) and RB0 for RX(Reception) in software UART. Enable External interrupt in RB0 pin. Whenever RB0 pin receives a high to low transition then PIC16F84A goes to Interrupt Service Routine (ISR).

  • Software UART for PIC16F84A microcontroller

The PIC16F84 does not have built in UART module. This UART Functionality can be enabled in PIC16F84 by writing a code for the same in MPLAB IDE using Hitech-C Compiler.

The UART Baud rate can be set to desired value.

You can use a simple 2GB SD card for interfacing with PIC16F84A. PIC16F84A reads raw data from SD card which doesn’t need high RAM or ROM. As there is no built in SPI module in the PIC16F84A , use a software SPI. (Serial Peripheral Interface (SPI) is an interface bus commonly used to send data between micro-controllers and small peripherals such as shift SD cards, sensors, shift registers. It uses separate clock and data lines, along with a select line to choose the device to interface.)

There is no need for the file systems (FAT16, FAT32… ) as we are using the raw data which is stored in the SD card memory spaces.( The FAT file system was first introduced during MS-DOS was prevalent way back in 1981. The purpose of the File Allocation Table – FAT is to provide the mapping between clusters which is the basic unit of logical storage on a disk at the operating system level and the physical location of data in terms of cylinders, tracks and sectors – the form of addressing used by the drive’s hardware controller.)

Furthermore use a UART software because PIC16F84A also doesn’t have built in UART module.

For Circuit Design use Proteus Professional Suit or ORCad and make necessary connections between Micro-controller and peripherals. Write code in either CCS C or XC compiler and go for execution in your Proteus Circuit. Watch the Output in the Output monitor window.

Hardware Requirements

PIC16F84A micro-controller, 8MHz crystal, 2 x 22pF ceramic capacitors, 10K ohm resistor, MAX232 — Refer datasheet, Female RS232 connector, 4 x 10uF polarized capacitor, 5V power source, Jumper wires, Breadboard.

  • PIC16F84A with HC-SR04 ultrasonic sensor example

We can build Distant meter using PIC16F84A interface with Ultrasonic Sensors.

An ultrasonic sensor HC-SR04 can measure distances form 2cm to 400cm with an accuracy of 3mm. This sensor module includes ultrasonic transmitter, ultrasonic receiver and control circuit.

The HC-SR04 ultrasonic sensor has 4 pins as follows:
VCC – Positive power supply (+5V)
Trig – Trigger input pin
Echo – Echo output pin
GND – Ground (0V)

Reference: HC-SR04 Datasheet

First of all supply the sensor trigger pin with a pulse of 10KHz . The sensor will automatically send 8 cycles burst of ultrasound at 40 kHz and raise its echo pin. The Echo is a distance object that is pulse width and the range in proportion. We can calculate the range through the time interval between sending trigger signal and receiving echo signal.

Formula: uS / 58 = centimeters or uS / 148 =inch;
the range = high level time * velocity (340M/S) / 2.

  • NEC Remote control decoder with PIC16F84A

National Electrical Code- NEC IR transmission protocol uses Pulse Distance Encoding of the message bits. Each pulse burst (mark – RC transmitter ON) is 562.5µs in length, at a carrier frequency of 38kHz (26.3µs). Logical bits are transmitted as follows:

Logic ‘0’ – a 562.5µs pulse burst followed by a 562.5µs space, with a total transmit time of 1.125ms

Logic ‘1’ – a 562.5µs pulse burst followed by a 1.6875ms space, with a total transmit time of 2.25ms

When transmitting or receiving remote control codes using the NEC IR transmission protocol, the WB_IRRC performs optimally when the carrier frequency (used for modulation/demodulation) is set to 38.222kHz.

When a key is pressed on the remote control, the transmitted message contains following in order:  a 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit) followed by a 4.5ms space, then an 8-bit address for the receiving device, then the 8-bit logical inverse of the address, then the 8-bit command, followed by the 8-bit logical inverse of the command a final 562.5 uS pulse burst to signify the end of message transmission.

The 4 bytes of data bits are each sent least significant bit first. The following figure illustrate the format of an NEC IR transmission frame, for an address of 00h (00000000b) and a command of ADh (10101101b).

The Microchip PIC16F84A microcontroller decode IR remote controls which uses NEC and extended NEC protocol.

  • Bipolar stepper motor drive with PIC16F84A

The following circuit schematic shows the connection between the microcontroller PIC16F84A and the stepper motor where a dual H-bridge circuit which is L293D chip is used between them.

The two pushbuttons are used to choose motor rotation direction.
The PIC16F84A needs +5V between its VDD and VSS pins.

  • Interfacing PIC16F84A with DHT22 sensor

Required components

DHT22 Sensor, PIC16F84A Micro-controller, LCD Display, 8MHz Crystal Oscillator, Capacitors, Resistors Connecting Wires, Breadboard, Power Supply.

Software Requirements

MPLAB IDE with XC series of compilers or C-Aware with CCS C series of compilers for coding purpose. Proteus Design Suit for virtual circuit design.

Reference: DHT22 Datasheet

  • Interfacing PIC16F84A with DS1307 real time clock

The DS1307 is an 8-pin integrated circuit that uses I2C communication protocol to communicate with master device which is in our case the PIC16F84A microcontroller. This small chip can count seconds, minutes, hours, day, date, month and year with leap-year up to year 2100.
The DS1307 receives and transfers data (clock data and calendar data) as BCD format, so after receiving data we have to convert these data into decimal data, and before writing data to the DS1307 we have to convert this data from decimal to BCD format. For example we have the BCD number 33, converting this number into decimal gives 21.
The following image shows the DS1307 pin configurations:

A 3V battery can be connected between VBAT and GND as a backup supply input.
The DS1307 uses an external 32.768KHz crystal and there is no need to add any resistors or capacitors with it.
More information are in the DS1307 RTC datasheet.

Reference: DS1307 RTC datasheet

The PIC16F84A must be supplied with 5V on pins VDD and VSS.
The circuit is clear and simple. The LCD is used to display the time as well as the date.

  • PIC16F84A + DHT22 (AM2302, RHT03) sensor Proteus simulation

About DHT22 (AM2302, RHT03) relative humidity and temperature sensor:
The DHT22(AM2302, RHT03) sensor comes in a single row 4-pin package and operates from 3.3 to 5.5V power supply. It can measure temperature from -40-80 °C with an accuracy of ±0.5°C and relative humidity ranging from 0-100% with an accuracy of  ±2%. The sensor provides fully calibrated digital outputs for the two measurements. It has got its own proprietary 1-wire protocol, and therefore, the communication between the sensor and a microcontroller is not possible through a direct interface with any of its peripherals. The protocol must be implemented in the firmware of the MCU with precise timing required by the sensor.

  • PIC16F84A + DHT11 digital sensor Proteus simulation

Reference: DHT11 digital sensor

The simulation Proteus version should be 8.1 or higher. With these versions there is no need to install Proteus DHT11 library, it is included with the software, so don’t waste your time searching for dht11 Proteus library or dhtxx.mdf or dht11 module for Proteus, just use Proteus version 8.1 or higher.

About DHT11 (RHT01) relative humidity and temperature sensor:
The DHT11 sensor has a single row 4-pin package and operates from 3.3 to 5.5V power supply. It can measure temperature from 0-50 °C with an accuracy of ±2°C and relative humidity ranging from 20-90% with an accuracy of  ±5%. Furthermore,the sensor provides fully calibrated digital outputs for the two measurements. It has  its own proprietary 1-wire protocol, likewise the communication between the sensor and a microcontroller is not possible via a direct interface with any of its peripherals. We  must implement the protocol  in the firmware of the MCU with precise timing required by the sensor.

  • DC motor control with PIC16F84A and L293D

Reference: L293D Datasheet

We can easily control low power DC motors can with half H-bridge IC L293D. This is a 16-pin IC which can control 2 motors in both directions.

The nominal voltage of the motor is 12V as well as L293D VS input voltage. Always L293D VS voltage is the same as the DC motor voltage and L293D VSS voltage is +5V.

  • RC5 IR remote control decoder with PIC16F84A

The RC-5 protocol was developed by Philips in the late 1980s as a semi-proprietary consumer IR (infrared) remote control communication protocol for consumer electronics.
The RC5 has 14 bits per 1 code transmission, the 14 bits are divided into 4 parts:
The first 2 bits are start bits and they are always logic 1.
The third bit called toggle bit, it can be logic 1 or logic 0.
The next 5 bits are address bits, each device type has its address number for example TV address number is 0, CD player address = 20
Finally,  the last 6 bits are command bits, each button has its command number.

This uses manchester coding:


For the same device for example TV all the remote control buttons has the same address but each button has its command.
The toggle bit changes whenever a button is pressed.

  • DC Motor speed and direction control with PIC16F84A

We can control DC motor speed and direction using H-bridge circuit, the H-bridge circuit allows us to reverse power supply polarity and with PWM technique we can easily control the speed of the motor. This topic shows how to control the speed and direction of 12V DC motor using PIC16F84A microcontroller and H-bridge circuit.

The basic elements of the H-bridge are the four MOSFETs (2 N-type and 2 P-type).
In the circuit there are 5 buttons, the first button which is connected to RB0 pin is used to speed up the motor, and speed down button to decrease motor speed. Third and fourth buttons are used to choose direction rotation of the motor (direction 1 or direction 2). The last button stops the motor no matter what speed or direction.

  • LCD interfacing with PIC16F84A

CD interfacing with PIC16F84A

It is easy to interface LCD displays with PIC16F84A microcontroller using CCS PIC C compiler since the compiler has the LCD driver.
There are 7 data lines between the microcontroller and the LCD display which are: RS, R/W, E, D4, D5, D6 and D7

Reference: LCD Datasheet

  • Micro-controller PIC16F84A and multiplexed 7-Segment display with shift register

A serial-in parallel-out shift register (74HC164, 74HC595, CD4094…..) can be added to a 7-segment display. The adding of the shift register minimizes the number of pins used by the 7-segment display.

Reference: 74HC164 Datasheet, 74HC595 DatasheetCD4094 Datasheet

  • PIC16F84A 7-Segment display example (4-Digit digital counter)

We can build a digital counter that counts from 0 to 9999 using PIC16F84A.

The 4-digit 7-segment display uses multiplexing technique which means all the data lines from a to g are connected together for all the four digits.The 7-segment display is of two types: common anode and common cathode.

Reference: 7 Segment Display Datasheet

  • Micro-controller PIC16F84A Enable PORTB internal pull-ups

For PIC16F84A each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. We can perform this by clearing bit RBPU (OPTION<7>). The weak pull-up is automatically turned off when the port pin is configures as an output.

  • PIC16F84A Timer0 interrupt example

Timer0 interruput

The microcontroller PIC16F84A has 1 timer which is Timer0, this timer has a resolution of 8 bits and an interrupt-on-overflow from FFh to 00h. We can use Timer0 interrupt to blink an LED.
This interrupt is generated when the TMR0 register overflows from FFh to 00h.
To enable the Timer0 interrupt GIE bit (INTCON<7>) must be 1.

  • Micro-controller PIC16F84A PORTB interrupt on change (IOC) example

The PORTB change interrupt occurs when an input port changes its state. The pins responsible for this interrupt are RB4, RB5, RB6 and RB7.

  • PIC16F84A external hardware interrupt example

The microcontroller PIC16F84A has a unique external interrupt at RB0 pin (hardware interrupt). When an interrupt occurrs, the microcontroller immediately executes the code attached with the interrupt, after finishing the interrupt code the microcontroller returns to the main code.

  • Micro-controller PIC16F84A LED blink example using push buttons

Pushbutt

This is a simple project which is used to blink LEDs connected to PIC16F84A . The push buttons control the LED blinking.

Don't miss out!
Subscribe To Our Newsletter

Learn new things. Get an article everyday.

Invalid email address
Give it a try. You can unsubscribe at any time.

Comments

comments