11 Microcontroller based Projects

There are hundreds of projects available on the WWW based on microcontroller. The projects of industrial and commercial importance are found very rare. Here is the list of few microcontroller projects that have their applications in industry and having commercial value. 
  • Microcontroller based Ethernet Industrial Automation
  • Microcontroller based wireless network of industrial sensors
  • Microcontroller based Data Acquisition system on a large scale
  • Microcontroller based soft start of induction motor
  • Microcontroller based home automation over wi-fi
  • Microcontroller based Power Monitoring and management system
  • Microcontroller based UGV (unmanned ground vehicle)
  • Microcontroller based Office Security System
  • Microcontroller based Auto Gear Shifting System
  • Microcontroller based brain wave for tension relief
  • Microcontroller based Bi- Directional Visitor Counter
More to follow!

20:27 | Posted in , | Read More »

DC Motor Speed Control: DAC v PWM

If you don't know how to control the speed of a Permanent Magnet DC motor, then let me tell you there are two basic methods to do it. One is using DAC (Digital to Analog Converter) and the other method is using PWM (Pulse width modulation). 

Using DAC method, the output of the DAC varies as the input binary pattern varies: the transistor is biased at the output of DAC and hence changes the speed of the motor connected across. Whereas in the later, PWM instead of giving fixed voltage provides an average change in voltage by changing the duty cycle - giving you ones's and zero's instead the fixed analog voltege. As the duty cycle varies the average voltage varies and hence the speed of DC motor.
DC motor speed control using DAC or PWM

PWM or DAC ?
PWM method to control the speed of DC Motor has certain advantages over the DAC method. Though DAC can provide you precise reading, but the disadvantage is that the transistor biased at the output of DAC works in linear region which is responsible for the continuous power loss due to Collector to Emitter drop (Vce). This might weaken the batteries over a long run. On the other hand, the transistor at the output of PWM generator, say microcontroller, works in saturated or cutoff region only, due to the fact that PWM generates alternating ones and zeros on contrary to fixed analog voltage in the case of DAC. 

Due to the reasons mentioned above , PWM is preferred over DAC. 

More to Follow

16:22 | Posted in , | Read More »

Touch Screen - Types and Comparison

Many engineering projects developed now-a-days involves touch panel screen. Different algorithms  are implemented to sense the location on different touch panels appended below: Algorithms will be discussed later.

In todays post, I will discuss types different technologies that are commonly used in touch screen. A touch is an electronic display that can detect the location of a touch. Touch usually refers to touching the device with hand or pen. These touch panels are used widely in HMIs, PDA and other devices etc. 

Following are the different technologies most widely used :-
  • Resistive: Resistive touch screen consist of different layers of which important two layers metallic conductors. Whenever a user touch the panel these two metallic layers behaves as voltage divider and thus causing a change in electric current. This change in electric current is sense by the controller for processing.
  • Surface Acoustic Wave: In Surface Acoustic Technology, whenever a user touch the panel, a portion of a wave is absorbed, which is used to sense the position and send to controller for processing
  • Capacitive: An insulator covered with a transparent conductive layer can behave as capacitive touch screen. When a user touch the panel, electrostatic field of the body gets disturbed which is measurable as the change in capacitance. 
  • Infrared: Infrared touch screen is simplest to understand. There is X-Y array of Infrared sender and receiver. Whenever a user touch the panel, the disturbance in array sense the position. From X-Y, I mean the two different perpendicular directions.
  • Optical Imaging: This is recent technology, getting popular these days. Mostly couple or two image sensors are placed to detect the location of the touch.
  • Disperse Signal Technology: Came into existence in the year 2002, that detects the mechanical energy of a glass that gets change during the touch. The technology claims that this touch screen is also unaffected by the dust and scratches.

17:27 | Posted in , | Read More »

My Final Year Project - Electronics Engineering

Project Advisor:   Mr. Muhammad Farhan
  • Muhammad Ahmed (NUST-PNEC-Fall-2007)
  • Ahmad Fawad  (NUST-PNEC-Fall-2007)
  • Muhammad Asif  (NUST-PNEC-Fall-2007)

Aim of Project: Design and Fabrication of ethernet based interactive electrical appliances control and power monitoring with touch panel interface.

Pre-requisites of the Project: 
  • Microcontroller
  • Networking
  • Instrumentation
  • Industrial Electronics
  • C/C++ Programming
Budgetary Estimates: Twenty-Two Thousand (PKR).

This is the very first post of this blog. Any developments to the above project will be updated on this blog. Thanks.

12:11 | Posted in , | Read More »

Download PonyProg for Windows - Free

dowload ponyprog 200 free

Besides the recent popularity of ISP Programmer, Ponyprog has still its advantages over other programmers. In fact it is one of the famous EEPROM programmer available free on the WWW. Here are few direct links to download PonyProg2000 absolutely for free.

For all those who are unaware of PonyProg, its a software rather a EEPROM programmer for microcontrollers. It can handle majority of microcontrollers and its reliability has been tested successfully so far. Might be you are able to grasp more after reading following post.

21:36 | Posted in , | Read More »

MSN Gadget - Goodwill would be a place to recycle computers

While scrolling down in multimedia section under category MSN gadget, I came across a video news which I have embed below for you guys. Bo Hussey from Goodwill industries has announced that they are offering a place to recycle old and donated computers. All computer accessories along with systems and monitors would be recycled here as shown in the video. The video explains different parts of recycling of computer systems starting from the casing and ending up with hard disk and other stuff. Check it out....a great economical thinking!!

15:35 | Posted in , | Read More »

Matlab GUI Video Tutorial -1

Its the fact that you can not grasp the things from the articles than you get it from the video tutorials. Here is the video tutorial for Matlab GUI which I searched from the youtube and placed it here. This video tutorial regarding Matlab GUI will teach you about the basics of Graphical User Interface. And by the end of the day you would be able to make the plots like mesh, surf as asked by the GUI setup made by you. After practicing it, you may move on to  Calculator in Matlab GUI. Leave your comments, if you feel difficulty. Thanks.

src="http://www.youtube.com/v/D_hmws6dwgg?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385">

12:48 | Posted in , , | Read More »

MSN Gadget - Wall Climbing Robot

While scrolling down in technology section at MSN Gadget, I cam across a wall climbing robot developed by an Engineer from Ultah. Interestingly the robot is powered by batteries and the nick name given to it is ROCKER. I was surprised to see that it can climb the eight feet wall in 15 seconds and once the camera are installed on it, the robot from MSN Gadget can be used to inspect Bridges, dams and other hard areas. The gadget is under test and may be handed over to military for their use in future. Check out the video here.

20:02 | Posted in | Read More »

How Wireless Mouse works ?

It is necessary for a wireless mouse to have a transmitter inside it and a receiver installed on the sytem to which it is (to be) connected. Line of  Sight communication is not needed in this case, as required in infrared communication. The receiver and the sender works on the radio frequency usually the microwave frequency i-e 2.4 GHz. At such a high frequency, the chances of interference is almost negligible. These frequencies also provide a range of almost 150 ft which is sufficient for a hand-held mouse. What happens is, that the RF signals sent from the transmitter are received at the receiver and the decoded and given to the processor to execute the task.The wireless technology in mouse are mostly accomplished on the optical mouse and not on the old mechanical ball mouse of early 1970's.
Do you have any idea about 802.11b or 802.11g ? These are also related to the wireless technology and the protocols that I will discuss later. 

Lets talk about the advantages of the wireless mouse, it has over the others. First of all, it provides you a user friendly environment - no wires - no headache. Secondly they are not powered by your system supply, they have  their inbuilt rechargeable or disposable batteries. Thirdly the wireless mouse do not require Line of Sight communication and thus provide you a feasible environment  Lastly they are inexpensive and and you can buy one for less than US$ 25. 

16:38 | Posted in , | Read More »

Download Alarm Gadget for Windows Vista

Here is that alarm clock gadget that I got from one of my favourite website. Its for windows 7 users. Users of other operating system might wait for another week. This alarm gadget provides animated visual feed back and give you the flexibility to choose amongst five colours and different alarm tones. Here's the snapshot for it.
Download the video from here

12:06 | Posted in , | Read More »

Optical Mouse Working

Today, on 7th of Aug 2010, I will tell you how actually the optical mouse works. The technology is not old enough to be discussed here. In the year 1999 optical mouse technology replaced its mechanical version, that came in early 70's. 
There is a kind of a camera that captures tens of hundreds of images in a second to determine the position. There is a LED (Light Emitting diode) that sends a signal to receiver after being reflected from the mouse pad or any other surface. The signals being reflected is then put into DSP (Digital Signal Processing) module, which after being analyzed send the co-ordinates to the computer to which it is connected to. This is all about the optical mouse working.
Lets glance over few of the advantages of the subject gadget. It has got many advantages over the old ball mouse. First of all there are no moving parts and hence smoother the operation. Secondly there are very rare chances for the LED to get dirty as in the case of ball mouse. Thirdly it is immaterial that which surface you are using in optical mouse. Last but not the least, optical mouse are quite inexpensive and hence easy to maintain and operate.

More to follow!

21:55 | Posted in , | Read More »

TI DSK C6713 Simulink Model for Realtime Modulation and Demodulation

Download the Real time Modulation and Demodulation Models
You can download from the links below:
This is the last post of Amplitude and Demodulation using Texas Instrument DSK 6713 and I will try to windup all the important aspects of the term assignment. We have already discussed a simple simulink model of both Amplitude Modulation and Demodulation.  You are recommended to see them first. Lets start with the basics.

We will make use of function generator and an oscilloscope. Both will be connected to the TI C6713 on line-in and line-out connectors. Frequency of Carrier Signal is fixed at 15 kHz while the message signal is varried from the function generator. Since DSK C6713 ensures realtime simulation, once the message signal is varied we will see on oscilloscope that modulated signal is also varying. Lets discuss different steps involved.

Block Diagram

C6713 Simulink Model - Amplitude Modulation

• Open a new simulink model and library browser

• Using Embedded Target For TIC6000 DSP menu select C6713 DSK Board Support.

• Using the Embedded Target For TIC6000 DSP tool in the library browser, select C6713 DSK Board Support and add ADC for Line In, DAC for Line Out and Reset Switch. You can extract all these from Simulink Library Browser.

• Implement the simulink model of AM as: You can also download from here.

• Message signal Line in parameters and carrier signal parameters can be set as following. This is very important. Set ADC Source as Line In, Sample Rate 19kHz, Word Length 16-bit. Amplitude :1.

Amplitude of the message signal can be change through function generator (up to 5KHz), whereas, frequency of the carrier signal is 15KHz.

• The output modulated signal observe in oscilloscope is:

C6713 Simulink Model - Amplitude De-Modulation
• Target the device in the similar manner as done above in amplitude modulation.

• A low pass filter has been designed in the FDA Tool in such a way that only the frequency of the message signal (5 KHz) is allow to pass through filter.

• Design the low pass filter using FDA Tool in Matlab.

• Export this filter to the simulink model

• Implement the simulink model of the demodulation. Click to enlarge please or download it from here.


• Run the model and observe the output at the oscilloscope.


This project named “AMPLITUDE MODULATION USING MATLAB SIMULINK AND TEXAS INSTRUMENT KIT C6713”, in all respect is the property of the following personnel who undertake this project as the term project in EE
  • Muhammad Ahmed
  • Jamal Ahmed
  • Muhammad Faisal 
For any queries feel free to contact

11:01 | Posted in , , , , , , | Read More »

MATLAB Simulink Model of Amplitude Demodulation

Before you read this post, see the simulink model of amplitude modulation. Demodulation is the process of extracting the baseband message signal from the carrier so that it may be processed at the receiver. Demodulation is necessary for the massage signal to be received properly at the receiver. For that purpose various methods are used like diode detector method, product detector method, filter detector etc. The same has been implemented on simulink model. That model is then applied to Texas instrument Kit, which will be discussed in the later post. Lets see the block diagram of a basic demodulator :-
Low pass filter has been implemented to extract the carrier from the modulated signal. Lowpass filter (LPF) filters  out the high frequency component and allows the low frequency component to pass. Since the carrier signal is of relatively much higher frequency than that of message signal, carrier signal is attenuated while the message signal is received at the receiver.
Here is the snapshot of MATLAB Simulink Model of Amplitude Demodulation which you can also by download it from here.


This project named “AMPLITUDE MODULATION USING MATLAB SIMULINK AND TEXAS INSTRUMENT KIT C6713”, in all respect is the property of the following personnel who undertake this project as the term project in EE-322 ‘DSP & Filters’ in summer semester 2010. However the copy of the project can be distributed upon the approval of the following members:-

1.Muhammad Ahmed (elprojects@yahoo.com)

2.Jamal Ahmed

3.Muhammad Faisal

19:00 | Posted in , , , | Read More »

Amplitude Modulation on MATLAB Simulink

Download the Simulink Model:

What is Amplitude Modulation?
This topic is the result of  Digital Signal Processing term project named Amplitude Modulation and Demodulation on Texas Instrument Kit DSK C6713 with Matlab Simulink. One of the fundamental part of our project is included in this very post. The whole term mini project will be gradually discussed in subsequent posts. Before we proceed, we must know what actually modulation and amplitude modulation is? A modulator alters the carrier waves corresponding to the variation of the modulating signals. Resulting modulated signal thus carries message information. Amplitude modulation is the process of changing the amplitude of a high frequency carrier signal corresponding to the amplitude of the modulating signal (Information). The wave whose amplitude is being varied is called the carrier wave and the signal doing the variation is called the modulating signal i-e message signal or information signal. The carrier is always almost a sinusoidal wave. The modulating or message signal can be a sine wave but it can be arbitrary waveform such as audio signal etc.

Some Mathematics :
For simplicity, suppose both carrier wave and modulating signal are sinusoidal:
vc = Vc sin wc t (c denotes carrier)
vm = Vm sin wm t (m denotes modulation)
We want the modulating signal to vary the carrier amplitude, Vc, so that:
vc = (Vc + Vm sin wmt).sin wc t
where (Vc + Vm sin wm t) is the new, varying carrier amplitude.
Expanding this equation gives:
vc = Vc sin ωc t + Vm sin ωc t. sin ωm t
which may be rewritten as:
vc = Vc [sin ωc t + m sin ωc t. sin ωm t]
where m = Vm/Vc and is called the modulation index.
sin ωc t.sin ωm t = (1/2) [cos(ωc - ωm) t - cos(ωc + ωm) t]
so, from the previous equation:
vc = Vc [sin ωc t + m sin ωc t. sin ωm t]
we can express vc as:
vc = Vc sin ωc t + (mVc/2) [cos(ωc - ωm) t] - (mVc/2) [cos(ωc + ωm) t]
  1. The original carrier waveform, at frequency ωc, containing no variations and thus carrying no information.
  2. A component at frequency (ωc - ωm) whose amplitude is proportional to the modulation index. This is called the Lower Side Frequency.
  3. A component at frequency (ωc + ωm) whose amplitude is proportional to the modulation index. This is called the Upper Side Frequency.
Lets discuss step by step the implementation of amplitude modulation on simulink modulation :-
Start the new Simulink model
Open the Simulink library browser

Create the simulation model of the AM
Message Signal:

A Sinusoidal signal of frequency 1 Hz, Amplitude=1
Carrier Signal of frequency 20 Hz and Amplitude=1

The above model is the equivalent of the mathematical expression:

m(t) represent the message signal
And cos(2πfct) represent the carrier

Run the Simulink model, the message, carrier and modulated output can be observed on the oscilloscope.
The above diagtam shows both supressed and without supressed carrier.You are recommended to see the following too :-
  1. Amplitude Modulation on Matlab Simulink Model
  2. Amplitude Demodulation on Matlab Simulink Model
  3. Real-time Amplitude Modulation and Demodulation on Texas Instrument DSK C6713

This project named “AMPLITUDE MODULATION USING MATLAB SIMULINK AND TEXAS INSTRUMENT KIT C6713”, in all respect is the property of the following personnel who undertake this project as the term project in EE-322 ‘DSP & Filters’ in summer semester 2010. However the copy of the project can be distributed upon the approval of the following members:-
  1. Muhammad Ahmed (NUST-ELECTRONICS)
  2. Jamal Ahmed(NUST-ELECTRONICS)
  3. Muhammad Faisal (NUST-ELECTRONICS)

21:48 | Posted in , , , | Read More »

Quartz Crystal - 11.059 MHz

Most of the cases crystal of 11.059 MHz is used with 8051 series microcontrollers. The higher the crystal value, faster is the microcontroller speed. This also depends upon the requirement of the device connected across the microcontroller.  In our RPM meter project, we used the same crystal. The particular value 11.059 is very important because when we used timers and counters, we make use of this value in calculations like Pulse Width Modulation and Timers etc. The crystals of such odd values are designed so that the all baud rates can be easily achieved. 

You can buy it for US $0.35 only from Dipmicro

18:08 | Posted in , | Read More »

Parallal Port DB-25 for PC interfacing

The typical parallel port socket on the computer uses 25 pins. On most peripherals like printers, the 36 pins Centronics version is used. Both connector pinouts are shown below.

                  Parallel DB25 pinout              Centronics pinout

Parallel cable for communication:

The following parallel cable can be used with file transfer. The cable uses the parallel port which makes it possible to achieve higher throughput than with a serial connection at the same low costs. The cable is amongst others compatible with the following software.

Because the parallel port on a computer was mainly designed to connect printers with one-way communication, a trick is used to achieve full two way data transfer between both sides. Five error and status message inputs are redefined as data inputs. Instead of reading full bytes, the communication software reads these five bits and combines multiple groups of data back to bytes. The sender and receiver have to use the same protocol to convert bytes to groups of 5 bits and viceversa.

DB - 25 Pin Description

18:06 | Posted in , | Read More »

Voltage Regulator LM7805

A basic voltage regulator LM7805 has three legs, converts varying input voltage and produces a constant regulated output voltage. The most common part numbers start with the numbers 78 or 79 and finish with two digits indicating the output voltage. The number 78 represents positive voltage and 79 negative one. The 78XX series of voltage regulators are designed for positive input. 
The LM78XX series typically has the ability to drive current up to 1A. As mentioned above, the component has three legs: Input leg which can hold up to 36VDC Common leg (GND) and an output leg with the regulator's voltage. For maximum voltage regulation, adding a capacitor in parallel between the common leg and the output is usually recommended. Typically a 0.1MF capacitor is used. This eliminates any high frequency AC voltage that could otherwise combine with the output voltage. The circuit diagram below shows which a typical use of a voltage regulator.

17:53 | Posted in , , | Read More »

LM324 Operational Amplifier - Comparator

The LM324 is a low voltage (2.7–5.5V) version of the dual and quad commodity op amps, The LM324 is the most cost effective solution for the applications where low voltage operation, space saving and low price are needed. The LM324 has rail-to-rail output swing capability and the input common-mode voltage range includes ground.

The small package saves space on PC boards, and enables the design of small portable electronic devices. It also allows the designer to place the device closer to the signal source to reduce noise pickup and increase signal integrity.

Here's the pinout of LM324 comparator :-


17:44 | Posted in , , , | Read More »

What is Pulse Width Modulation ?

Pulse width modulation is a technique for reducing the amount of power delivered to a DC motor. Instead of reducing the voltage operating the motor (which would reduce its power), the motor's power supply is rapidly switched on and off. The percentage of time that the power is on determines the percentage of full operating power that is accomplished. This type of motor speed control is easier to implement with digital circuitry.

To see how PWM has been implemented practically see the project named RPM meter under the electronics section or click here.

17:30 | Posted in , , | Read More »

Useful Rotary Mouse Encoder

An extract from RMP meter Project;

"We decided to try and recycle a simple ball mouse into a useful encoder for our project. Each mouse has at least 2 rotary encoders so we attempted to reuse these encoders into something that can be used with a microcontroller for an input device as a rotary pulse generator (RPG). Useful !!
After examining several types of mice, we found there was quite a range of technology used in the detector circuits. Some older mice used LEDs and phototransistors but the best units we found had an integrated detector that directly output TTL level quad rate signals. These units had 3 pin clear plastic IR LED sources and black plastic 4 pin detectors.

To interface to a microcontroller, all that was needed was one output pin to pulse the infrared emitter and two inputs to read the 2 phases of the encoder. The LED sources are pulsed on by the controller about 120 times per second (14.8µs on, 8.5ms off). When motion of the encoder wheels is detected, the pulse rate increases up to over 5000 times/second (14.8µs on, 172µs off). This operation results in three benefits. The LED life is improved, the current consumption of the mouse is minimized when it is not being used and the signal to noise ratio on the detectors is improved because the LED sources can be driven harder when using an 8.6% duty cycle.

Amazing Features of Mouse Encoder
  1. Low cost rotary pulse generator
  2. Resolution of around 256 pulses/revolution
  3. Pulse rates of up to several hundred pulses/second"

16:51 | Posted in , | Read More »

Timers and Counters in AT89S52

Diagram below shows a simplified diagram of the main peripherals present in the 89S52 or 8052 / 8051. There are 3 Timers/Counters in the 89S52. The expression "Timer/Counter" is used because this unit can act as a Counter or as a Timer as per requirement. Timer/Counter 2 is a special counter that does not behave like the two others, because of some extra functionality.

The serial port, using a UART (Universal Asynchronous Receive Transmit) protocol can be used in a wide range of communication applications. With the UART provided in the 89S52 it is easy to communicate with a serial port equipped computer, as well as communicate with another microcontroller.

If all the peripherals described above can generate interrupt signals in the CPU according to some specific events, it can be useful to generate an interrupt signal from an external device that may be a sensor or a Digital to Analog converter. For that purpose there are 2 External Interrupt sources (INT0 and INT1).

16:33 | Posted in , , , | Read More »

Microcontroller AT89S52 Description

Hello, this very post is related to the RPM meter project. In fact this is the description of  AT89S52 with reference to that context. You must first of all glance over the project here.  This is to mention here that this post is the work of all the same team members mentioned in the project. 

8051 is the name of a big family of microcontrollers. The device which we used in our project was the 'AT89S52' which is a typical 8051 microcontroller manufactured by Atmel™. The block diagram provided by Atmel™ in their datasheet that showed the architecture of 89S52 device seemed a bit complicated. A simpler architecture can be represented below.

The 89S52 has 4 different ports, each one having 8 Input/output lines providing a total of 32 I/O lines. Those ports can be used to output DATA and orders do other devices, or to read the state of a sensor, or a switch. Most of the ports of the 89S52 have 'dual function' meaning that they can be used for two different functions.

The first one is to perform input/output operations and the second one is used to implement special features of the microcontroller like counting external pulses, interrupting the execution of the program according to external events, performing serial data transfer or connecting the chip to a computer to update the software. Each port has 8 pins, and will be treated from the software point of view as an 8-bit variable called 'register', each bit being connected to a different Input/Output pin.

There are two different memory types: RAM and EEPROM. Shortly, RAM is used to store variable during program execution, while the EEPROM memory is used to store the program itself, that's why it is often referred to as the 'program memory'. It is clear that the CPU (Central Processing Unit) is the heart of the micro controllers. It is the CPU that will Read the program from the FLASH memory and Execute it by interacting with the different peripherals

Diagram below shows the pin configuration of the 89S52, where the function of each pin is written next to it, and, if it exists, the dual function is written between brackets. Note that the pins that have dual functions can still be used normally as an input/output pin. Unless the program uses their dual functions, all the 32 I/O pins of the microcontroller are configured as input/output pins.

16:23 | Posted in , , | Read More »

8051/AT89S52 based RPM meter using Mouse Encoder

Problem Definition:
The task at hand was to create an RPM meter using AT89S52 microcontroller that displays the generated RPM count.

Life Cycle of a Microcontroller Project:
It was important for us to have a general idea of the steps that are followed to realize a project, from the very beginning of an idea to the very end of project completion.

The figure below shows the steps that were followed by us after we settled on the choice of our project in the 'brain storming' part. It was imperative for us to imagine how it could be implemented from the hardware point of view, before we passed on to the programming phase, because programming is much more flexible than the hardware design. In other words, we started by designing the hardware, then worked on the programming while taking in consideration the eventual constraints imposed by the hardware design.

The hardware design includes all the aspects of the electronic connections between Microcontroller and other devices, like the compatibility of the voltage levels, or the required number of pins, etc.

After completion of the hardware, we diverted our attention towards the programming phase. When the first program was developed, the HEX file was generated by the compiler, and was sent to the 'program memory' of the microcontroller. Eventual errors were corrected and performance was enhanced gradually, taking in account the famous rule which states that

Any project never works the first time; at least it does not work as you expect it to do.”

Hardware Design:

Click to enlarge.

Module 1 – Devices:
This section contains the devices that are connected externally. In our case there is only a small DC motor of rating 5V. It is basically used to drive the mouse encoder that generates the revolutions.

Module 2 – Input:
This section implements a small ball mouse rotary encoder that is being driven by the DC motor. The amount of revolutions depends upon how fast the DC motor spins the encoder. These analog revolutions result in a difference in voltage at the input of the Comparator IC LM324 that basically compares and converts the voltage difference into pulses of 0’s and 1’s. This data is fed into the microcontroller 89S52 that calculates the RPM Count.

Module 3 – Output:
The generated RPM needs to be displayed on and output device. But before that it is fed to the Buffer IC 74LS245 by the microcontroller that boosts the current. It is further connected to the PC screen via parallel port interfacing.

Each of the above component will be discussed in different sections of the blog. Lets take a quick overview of Software execution of the above project.

Component Discussion
The RPM meter project consists of the following main components. Click to see the details please.
This section deals with the software aspects of out project. The coding required in this project was a mixture of C languae and Assembly language. For that we used the Turbo C and KEIL uVision Softwares.

From the C program to the machine language:
The C source code is very high level language, meaning that it is far from being at the base level of the machine language that can be executed by a processor. This machine language is basically just zero's and one's and is written in Hexadecimal format, that why they are called HEX files.There are several types of HEX files.

Diagram below shows that to convert a C program to machine language, it takes several steps depending on the tool that is used, however, the main idea is to produce a HEX file at the end. This HEX file will be then transferred to the hardware to write every byte of data at the appropriate place in the EEPROM of the 89S52.

Program Flow Chart 
Assembly Code for RMP meter using Mouse Encoder

ORG 0000H


ORG 0030h


MOV TMOD, #15h

MOV P1,#00H



MOV R0,#01FH




MOV TH1,#00H

MOV TL1,#00H

MOV R3,#02H

mov TL0,#0FFh

mov P2,#00h

CLR P1.0














C code for parallal port Interfacing




#define data_in 0x378

#define status 0x37A

#define x 25

void main()

{ clrscr();

unsigned char data;

float rev=0.0;

float rpm=0.0;











printf("º º");


printf("º %7d RPM º",int(rpm));


printf("º º");


printf("º º");


printf("º %7d rad/s º",int((2*(22/7)*rpm)/60));


printf("º º");



data= inportb(data_in);





Certificate of ownership:

This is to certify that this project report “ RPM Meter Using Mouse Encoder ”

is the bonafide work of “ Mr.Ahmed Fawad, Mr. M.Asif, Mr. Azeez Ahmed and Mr. M. Zohaib Arif ” of class “ V – OPS/EL – B ” who carried out the project work under my supervision.

Prof. Nazeer Alam

Prof. Ikram Rasool Qureshi

16:02 | Posted in , , | Read More »


Recently Commented

Recently Added