Knight Rider Circuit Diagram Using Microcontroller

Hi friends, today I am going to make my first microcontroller project using PIC16F84A microcontroller. I prefer  PIC16F84A microcontroller because it is quite simple to learn the basics of microcontroller family. PIC16F84A is the best microcontroller for beginners because it has following characteristics:

  • Only 35 single word instructions to learn
  • All instructions single-cycle except for program branches which are two-cycle
  • Operating speed: DC – 20 MHz clock input DC – 200 ns instruction cycle
  • 1024 words of program memory
  • 68 bytes of Data RAM
  • 64 bytes of Data EEPROM
  • 14-bit wide instruction words
  • 8-bit wide data bytes
  • 15 Special Function Hardware registers
  • Eight-level deep hardware stack
  • Direct, indirect and relative addressing modes
  • Four interrupt sources: – External RB0/INT pin – TMR0 timer overflow – PORTB<7:4> interrupt-on-change – Data EEPROM write complete
  • Schematic design of knight-rider with the PIC16F84A microcontroller:

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.

Knight Rider Circuit Diagram

knight rider circuit using PIC 16F84AP
knight rider circuit using PIC 16F84AP

The circuit can be powered by a DC voltage between 7 … 12 V. I used a 7805 regulator to create a stable 5 VDC voltage. If you want to keep the circuit very small you could use a zener diode 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 knight rider 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.

Download

Here you can download the .asm and .hex code

If you like this article, please share it with your friends and like or facebook page for future updates. Subscribe to our newsletter to get notifications about our updates via email. If you have any queries, feel free to ask in the comments section below. Have a nice day!

Leave a Reply