Sunday, September 1, 2013

Heart rate monitor using 8051

In this article we are listing all the projects and circuits we have developed using the 8051 micro controller. We have tested all of these projects in our lab and verified the working . All these projects are made to solve a real world requirement or problem. Engineering students & other diploma students will find these projects useful for their mini project and main project requirements.
All the 8051 projects listed below are made using the 8051 compliant microcontroller from Atmel – AT89S51.  We have given the correct circuit diagram, working and software code (in assembly language) for each and every project. You can use all of them freely for your project & learning requirements. In case you are using a controller other than AT89S51 – please be sure to check the hardware of your controller and compare it with that of AT89S51. This is necessary because we have developed all the software in assembly language. If you are not that good at assembly language, you can convert the software into C language & use it with any compliant  8051 controller.
8051 micro controller based projects & circuits
Image Source
1. Ultrasonic Range Finder using 8051 – This project as the name says, is an application to measure distance of an object. It uses an ultrasonic transducer module HC-SR04 to measure the distance and the controller AT89S51 to make the necessary processing. This project can be used to make applications like Automotive parking sensor, Obstacle warning systems, Terrain monitoring robots etc. This ultrasonic range finder can measure distances upto 2.5 meters with an accuracy of 1 cm.
2. Digital Tachometer using 8051 –  This project is a digital tachometer which can be used to measure the revolutions per second of any object like a rotating wheel or a disc or a shaft. This application built using 8051 micro controller can measure upto 255 revolutions/second with an accuracy of 1 rev/sec. This application has 3 important sections – 1) is the optical pickup designed to pick the revolutions of the object using a photo transistor and LED. 2) is the processing stage designed using 8051 and the associated software 3) is the display section using 7 segment displays.
3. Water Level Controller using 8051 –  This is one of the most popular project we have published using 8051 controller. This water level controller monitors the level of the over head tank  and automatically switches on the water pump when ever the level goes below a preset limit. The level of the over head tank is indicated using 5 leds and the pump is switched of when the over head tank is filled.  We have given an illustrated circuit diagram with working explained in detail. You will also find the software codes written in assemble language.
4. Voltmeter using 8051    - We all must have used a multimeter from our young days. Have you ever bothered to create one ? So here is one such an interesting project. A Voltmeter using 8051 micro controller. Even though its quiet simple and an easy to make one, you shall find it really interesting. This can be used as an application at the mini project level for engineering and diploma students. This digital voltmeter  can measure 0 to 5 volts and has a sensitivity of  200mV which is a bit low but this project is meant for demonstrating how an ADC and seven segment display can be interfaced to 8051 to obtain a digital readout of the input voltage. ADC0804 is the ADC and AT89S51 is the controller used in this project.
5. Thermometer using 8051 - This is an interesting project designed to measure temperature using 8051. Its a simple 0-100°C digital thermometer with 1°C resolution using 8051. The circuit is based on LM35 analog temperature sensor, ADC0804 and AT89S51 microcontroller. LM35 is an analogue temperature sensor IC which can measure a temperature range of -55 to 150°C. Its output voltage varies 10mV per °C change in temperature.
Knowledge Resources:- The articles below given are basics on how to work with 8051 micro controller. You can refer them if you come across a road block anywhere!
1. Interfacing 7 segment display to 8051 – A good tutorial on interfacing 7 segment display to 8051 micro controller.
2. Interfacing LCD display to 8051 – Explains how to interface a 16×2 LCD display with 8051 micro controller.
3. Interfacing DC motor to 8051 – Explains how to interface a DC motor with 8051 micro controller.
4. Interfacing push button switch to 8051 – Interfacing LED & Push button switch to 8051 micro controller.
5. Interfacing ADC to 8051 – This articles gives you a good detail on how to interface ADC to 8051 micro controller. ADC 0804 is used to explain the interfacing procedure with an example software routine.

Alcohol Breathalyzer circuit using 8051 microcontroller (AT89S51).

This article is about a breathalyzer circuit using 8051 microcontroller which outputs the blood alcohol content (BAC) from the breath. The BAC is displayed in percentage on a 3 digit seven segment display. The microcontroller used if AT89S51 which belongs to the 8051 family and the alcohol sensor is MQ135 gas sensor from Futurelec.

MQ135 gas sensor.

MQ135 is a stable and sensitive gas sensor which can detect  ammonia, carbon dioxide, alcohol, smoke, nitrogen dioxide etc. The sensor consists of a tin dioxide sensitive layer inside aluminium oxide micro tubes, measuring electrode and a heating element inside a tubular aluminium casing. The front end of the sensor is covered using a stainless steel net and  the rear side holds the connection terminals.
The ethyl alcohol present in the breath is oxidized into acetic acid while passing over the heating element. This ethyl alcohol falls on the  tin dioxide sensing layer and as a result its resistance decreases. This resistance variation  is converted into a suitable voltage variation using an external load resistor. The typical connection arrangement of an MQ135 alcohol sensor is shown below.
mq135 alcohol sensor
MQ135 alcohol sensor
MQ135 has different resistance values at different temperature and different concentration of gases. The manufacturer recommends to calibrate the sensor at 100ppm of ammonia or 50ppm of alcohol. The recommended value of the load resistor is between 10K to 47K.

Circuit diagram.

Breathalyzer using 8051

The voltage output of the alcohol sensor is converted into a digital format using the ADC0804 (IC1). The Vref/2 pin of the ADC is held at 1.28V using the voltage divider network made of R14 and R15. Vref/2 =1.28V means the step size of the ADC will be 10mV and the output of the ADC will increment by one bit for every 10mV increment in the analog input. Refer the datasheet of ADC0804 for a better grasp. Digital out of the ADC (D0 to D7)  is interfaced to Port1 of the microcontroller. Control signals CS, RD, WR, INTR are obtained from the microcontrollers P3.7, P3.6, P3.5, P3.4 pins respectively. R9 and C1 are associated with the clock circuitry of the ADC0804.
Capacitor C3 connected between Vin+ and Vin- of the ADC0804 filters of noise (if any) in the sensor output. If C3 is not used the digital output of the ADC will not be stable. This filter capacitor will surely induce some lag in the ADC response but it is not very relevant in this entry level application. The microcontroller performs required manipulations on the ADC digital output in order to convert it into BAC % and displays it on the three digit seven segment display. Port0 of the microcontroller is interfaced to the multiplexed three digit seven segment display. The drive signals for the threes digits are obtained from the microcontroller’s P3.0, P3.1, P3.2 pins respectively.

Program.

ORG 00H
MOV P1,#11111111B
MOV P0,#00000000B
MOV P3,#00000000B
MOV DPTR,#LUT
MAIN: MOV R4,#250D
      CLR P3.7
      SETB P3.6
      CLR P3.5
      SETB P3.5
WAIT: JB P3.4,WAIT
      CLR P3.7
      CLR P3.6
      MOV A,P1
      MOV R5,A
      SUBB A,#86
      JC NEXT
      SETB P3.3
      CLR PSW.7
NEXT: MOV A,R5
      SUBB A,#115D
      JNC LABEL
      MOV A,#00000000B
      CLR PSW.7
LABEL: MOV B,#5D
       MUL AB
       MOV B,#8D
       DIV AB
       MOV B,#10D
       DIV AB
       MOV R6,A
       MOV R7,B
DLOOP:SETB P3.0
      MOV P0,#01000000B
      ACALL DELAY
      CLR P3.0
      SETB P3.1
      MOV A,R6
      ACALL DISPLAY
      MOV P0,A
      ACALL DELAY
      CLR P3.1
      SETB P3.2
      MOV A,R7
      ACALL DISPLAY
      MOV P0,A
      ACALL DELAY
      CLR P3.2
      DJNZ R4,DLOOP
      SJMP MAIN
DELAY: MOV R3,#255D
LABEL1: DJNZ R3,LABEL1
        RET
DISPLAY: MOVC A,@A+DPTR
         CPL A
         RET
LUT: DB 3FH
     DB 06H
     DB 5BH
     DB 4FH
     DB 66H
     DB 6DH
     DB 7DH
     DB 07H
     DB 7FH
     DB 6FH
END

Notes.

  • The MQ135 gas sensor requires around 5 minutes of preheat before the first use.
  • The MQ135 takes few minutes to retrace back to its normal condition after a positive test (alcohol present in the breath).
  • If there is no alcohol in the breath  the sensor output will swing back to its normal condition very fast.
  • Read these articles Interfacing seven segment display to 8051 microcontroller , Interfacing ADC to 8051 microcontroller  before attempting this project.
  • This breathalyzer circuit is just an entry level one and is not suitable for high end applications such as law enforcement or laboratory application.
  • The logic for converting the digital output of ADC into BAC percentage was obtained using approximation techniques.