Schematic design with the PIC16F84A microcontroller

Summary of Schematic design with the PIC16F84A microcontroller


The article describes a compact PIC16F84A-based knightrider LED driver as an alternative to CD4017 designs, powered by 7–12 V with a 7805 (or zener) regulator. It uses an RC oscillator (10k resistor, optional capacitor) and drives LEDs on PORTB (RB0–RB7) with two LEDs active at once. Speed is set by resistor R1 (measured on-time 0.14 s). Two firmware versions exist: an assembler ON/OFF variant and a C version with PWM-based trailing dim LEDs.

Parts used in the PIC16F84A knightrider project:

  • PIC16F84A microcontroller
  • LEDs (connected to RB0 ... RB7)
  • 7805 voltage regulator
  • Zener diode (optional for voltage stabilization)
  • Resistor R1 (10k for oscillator; adjustable to change speed)
  • RC oscillator resistor (10k)
  • Oscillator capacitor (optional, between OSC1 and GND)
  • Power supply 7 ... 12 V DC

Many circuits on the Internet are built with a CD4017 counter IC. I myself chose to use a microcontroller for this job: the PIC16F84A. A microcontroller increases the complexity but it allows you to build a very flexible light computer. The circuit can be kept very small, this was a requirement for this circuit.

Schematic design with the PIC16F84A microcontrollerThe circuit can be powered by a DC voltage between 7 … 12 V. I used a 7805 regulator to create a stable 5 VDC voltage. It you want to keep the circuit very small you could use a zenerdiode for the stabilization.

The microcontroller is oscillated by an external RC oscillator. The capacitor was left away. This can be done but it decreases the stability of the frequency. The resistor has a value of 10k.

The microcontroller drives LEDs through output ports RB0 … RB7.. During the execution of a knightrider effect there are always 2 LEDs active at a time.

I did some measurements on the circuit and the LEDs are active for a period of 0.14 seconds. To change the speed you can simply change the value of resistor R1. You could also add a capacitor between OSC1 and the GND.

Schematic design with the PIC16F84A microcontroller SchematicSoftware Design

Over time I wrote two different versions of the software for this light computer.

  • A basic version in the assembler language. It runs the knight-rider light effect with only two possible output states: ON or OFF. Download the assembler source code.
  • An extended version in the C Language. This software generates a little trail before and after the active LEDs. The intensity of the LEDs in the trail is lower. This is done by implementing some sort of PWM (pulse width modulation). Download the High-TECH C source code.

 

For more detail: Schematic design with the PIC16F84A microcontroller

Quick Solutions to Questions related to PIC16F84A knightrider project:

  • What microcontroller is used in the project?
    The project uses a PIC16F84A microcontroller.
  • What supply voltage does the circuit require?
    The circuit can be powered by a DC voltage between 7 and 12 V.
  • How is the 5 V supply generated?
    A 7805 regulator is used to create a stable 5 VDC; a zener diode can be used for a smaller circuit instead.
  • How is the microcontroller clocked?
    The microcontroller uses an external RC oscillator with a 10k resistor; the capacitor is optional.
  • How many LEDs are active during the knightrider effect?
    There are always two LEDs active at a time during the knightrider effect.
  • How can the speed of the effect be changed?
    Change the value of resistor R1 or add a capacitor between OSC1 and GND to change the speed.
  • What is the measured on-time of the LEDs?
    The LEDs are active for a period of 0.14 seconds based on measurements.
  • What software versions are available for the project?
    There is a basic assembler version with simple ON/OFF outputs and an extended C version that implements PWM for dimmed trailing LEDs.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter