Showing posts with label Optical Sensor. Show all posts
Showing posts with label Optical Sensor. Show all posts

Bidirectional Production line Counter using ATMEGA8 Microcontroller

Display unit of  Industrial Production Line Counter

Synopsis of Microcontroller project for the Final year Student of Engineering

In this Microcontroller Experiment we will learn to develop an Automatic Production Line counter Using Microcontroller and We will design the circuit diagram along with the writing of software for the effective implementation of the Automatic production line counting system and display of counter at dominant place in the factory for its effective use.

Scope of Project:

This project is related to the design of an automatic production line counting system for the product counter in an industrial environment. This project will be helpful for the students of Electronics, Software, and Mechatronics field of engineer to develop this project for their final year degree project.

Introduction of Microcontroller Degree Project

A counting system for the products during the production from an industrial machine is always of greater concern for the management point of view. Therefore the counter and display of production line is required to design. Here we will make the schematic circuit designing and software coding for the development of automatic event counter. The use of Microcontroller make the counting of product more efficiently, the other main components to be used in the project will be like sensor which are based on optoelectronic switch associated electronics component like resistor, capacitors and digital Integrated Circuits (ICs). There is provision of Data acquisition so that a Personnel Computer (PC) could be interfaced with the counting system to get the data into the PC through the use of RS-232 serial communication Protocol. The Software on PC will be capable enough to register the actual quantity of the Production line, event date & time and planning efficiency for future production rate etc. The experimental use of this automatic event counting or production line counting will prove its credibility with the advantages like reliability, easiness in operation and accurate results. It is worth mentioned that this system has many application and uses in real world like its usability starting from the home appliance to large scale industrial manufacturing factories states. Some of the usage of this system are elaborated as it can be used as Meter-age Counter for the counting of length of cloth production textile industry, Folding Machine Counter, Jigger Programmer for the counting of length of cloth in dying machine and several round of that cloth in dying tube, each time it is required to measure the length of cloth very accurately by giving it desirable Temperature and tension and many more,  Weaving Length Counter, Shift Production Counter, Dosing Controller or dozing counter are also the requirement of industry and counter are widely used for it, Production Data Monitor,  Deca & Doff counter, cloth Length measurement system, Inspection Machine Counter, Speed Indicator, Shrinkage Monitor, Warping Length Counter, Loom Production Meter,  Yarn Length Counter, Spinning Automations, etc. Industrial production lines products final product from raw materials and their counting is done by the use of appropriate counter. To keep all record up-to-date about the above said production lines is really a job. In an industry many processes will be running simultaneously. Thus automatic counters are a big need of industry. Therefore above counters are frequently used in various places.

Construction of Microcontroller based Automatic Counter and display System:

This counting and display system uses Microcontroller Atmega with optical sensors to ensure the forward and reverse counting through the effectively use of electronic circuitry with them. The Microcontroller optical Sensor, LED seven segment display, suitable power supply, necessary electronics components will be mounted on a PCB board to develop. The LED display will work on the famous technique of multiplexing the digits which will be describes later in this post. The system will work as a fully automated industrial production line counting system. The optical sensor will transmit and receive light signals to detect product or things which are required to count. When an object will crosses the sensor path, then a response will be generated by sensor indicating an object. This technique will ensure that all objects are being counted.

Direction base Counting of Objects:

When the object start moving in front of the optical sensors, the pulses will be generated and these will be counted using the systems attached with it. Similarly when any machine moves then the optical sensors attached with the shaft will continue to produces the pulses on making and breaking of the light between the sensor elements. What if one wants to know in which direction the shaft is rotating, clockwise or anticlockwise direction because the direction of rotation is important in any industrial applications.  As the counting of pulse does not serve the purpose all the time. Like, if it is desired that counter may increment with one direction of rotation and decrement with the reverse direction of rotation. In these situation one have to use an up & down counter with proper circuit to identify the direction of rotation.

Direction of rotation detection
Direction of rotation detection


Redesigning of Counter for Direction Information:

So let’s redesign the existing simple pulse counter to a special up & down counter with help of a very simple circuit. There will be two optical sensor pair will be used instead of one pair of LED and receiver. So that we have two pulses one after another. These pair of pulses will be feed to a D-type flip-flop integrated IC like TTL IC 74LS74. The 74LS74 will sense the sequence of occurring of these pulse and will distinguish that which pulse come first among pulse “A” or Pulse “B”. The direction will be identified using the D-type flip-flop 74LS74 like is it clockwise or anti-clock wise rotation. So the counter will increment the count or decrement the count as per the direction of rotation. This type of motion detection along with direction of motion detection is required in many applications likes in the field of robotics, in the control of various arms of CNC machine, and similarly in many applications involving the bidirectional mechanical motion.

The D-Type Flip Flop 74LS74

It is an integrated IC having two D-type flip flops, these flip flops are here used to identify the direction of rotation of the encoder. As we have already told that the two pairs of optical sensors will produces to set of pulses name “A” and “B”.  These pulses will be feed to the flip flops as per configuration shown in the schematic circuit diagram below. As a result, we will be obtained two pulses labeled clock wise and anti-clockwise. If the encoder will rotate clock wise the pulses will be available on clockwise pulse train only. If the encoder will rotate anti-clockwise direction then the pulse will be available on the anticlockwise train. Each is feed to external interrupts of microcontroller.

Counting of Pulses:

The external interrupts of Atmega8 Microcontroller are configured as activate on the fallen edge. If the pulses come on clockwise pulse train then interrupt number 1, be activated and increment in counts will be resulted. If the encoder will rotate counter-clockwise direction then anti-clock-wise pulse train will generate pulse and the second external interrupt of microcontroller will be activated which will decrement the counts.

Schematic Circuit diagram of the Project:

ATmega8 Microcontroller based Bidirectional Counter
ATmega8 Microcontroller based Bidirectional Counter


Multiplexed Seven Segment Display:

The display of the project is a four-digit common cathode type LED seven segment display. The Seven segment display is configured in the multiplexing way. The digit will glow one by one. Thus, is done in the software.

By using the technique of multiplexing, the control of display using seven segments to displays the production count becomes very simple. The main advantage of use of this technique is that it requires a smaller number of IO pins of microcontroller as compared to conventionally attaching all pins of seven segment display to the microcontroller which seems not easy with small microcontroller. It will require either an IO expander or a microcontroller having larger set of IOs. As we are using a small microcontroller of AVR named atmega8, which have limited number of IOs, thus we used the multiplexing technique of display number on the four seven segment digits. Therefore, the number of pins used to drive the displays are a few only. In the way the segments are driven high by the micro-controller turn by turn. First we turn one the transistor attached to first decimal place and at that time the code for digit is send to PORTB of microcontroller, as a results first digit place glows with that digit. At that time all other transistors are kept off, means all three remaining seven segment display digit will be OFF. After a delay of about 500 milli second, then the turn comes for second digit place and so on.

Microcontroller Atmega8:

In this project the AVR Microcontroller Atmegaa8 is used. The AVR Microcontroller ATmega8 is a low-power CMOS 8-bit microcontroller. It is based on the AVR RISC architecture. The ATmega8 has inbuilt ADC : the analog to digital converter, the built-in  internal oscillator and the serial data communication, performs the instructions in a single execution cycle. The ATMEGA8 has 1Kbyte Internal SRAM, 8 Kb of Flash program memory and 512 Bytes of EEPROM. The ATMEGA8 has three ports, port-B, port-C, and port-D. There are total 23 IOs line are available on these ports. There are two External Interrupt lines which are configured at port D. There are three-Internal Timers. This microcontroller is very efficient for small and medium size projects. The working of microcontroller is very stable. The performance of the microcontroller is excellent.

Software of Bidirectional Counter:

The software of the Bi-directional counter is written in BESCOM, basic language and compiler for the AVR microcontroller. The program code listing is provided at the end of the post.

Reset counting Button:

A push button is also interfaced with the atmega8 Microcontroller to reset the counting at any time.

'*****************************************
'Bi-Directional Production Line Counter
'*****************************************
$regfile = "m8def.dat"
$crystal = 8000000
$prog &HFF , &HE1 , &HD9 , &H00
On Int0 Downcount
On Int1 Upcount
Enable Int0
Enable Int1
Config Int0 = Falling
Config Int1 = Falling
Enable Interrupts
'*****************************************
' outputs  of the Microcntroller Atmega8
'*****************************************
Config Portb.0 = Output : Portb.0 = 0
Config Portb.1 = Output : Portb.1 = 0
Config Portb.2 = Output : Portb.2 = 0
Config Portb.3 = Output : Portb.3 = 0
Config Portb.4 = Output : Portb.4 = 0
Config Portb.5 = Output : Portb.5 = 0
Config Portb.6 = Output : Portb.6 = 0
Config Portb.7 = Output : Portb.7 = 0
Config Portc.0 = Output : Portc.0 = 1
Config Portc.1 = Output : Portc.1 = 1
Config Portc.2 = Output : Portc.2 = 1
Config Portc.3 = Output : Portc.3 = 1
'******************************************
'inputs of the Microcntroller Atmega8
'******************************************
Config Portd.2 = Input : Portd.2 = 1
Config Portd.3 = Input : Portd.3 = 1
Config Portd.7 = Input : Portd.7 = 1
'******************************************
'data for 7 segments
' Codes for common Cathode Type
' Seven Segment Display
'******************************************
Dim Digit(10) As Byte
' Dibit 0
Digit(1) = &B00111111
' Dibit 1
Digit(2) = &B00000110
' Dibit 2
Digit(3) = &B01011011
' Dibit 3
Digit(4) = &B01001111
' Dibit 4
Digit(5) = &B01100110
' Dibit 5
Digit(6) = &B01101101
' Dibit 6
Digit(7) = &B01111101
' Dibit 7
Digit(8) = &B00000111
' Dibit 8
Digit(9) = &B01111111
' Dibit 9
Digit(10) = &B01101111
'*******************************************
'veriables
'*******************************************
Dim Product_count As Integer
Dim Digit_place(4) As Byte
Dim I As Byte
Dim K As Integer
Product_count = 0
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0
Main:
'**********************************************
' 7seven segment display
'Conversion of the count to digit values
'**********************************************
I = Product_count Mod 10
Digit_place(1) = Digit(i + 1)
K = Product_count / 10

I = K Mod 10
Digit_place(2) = Digit(i + 1)
K = K / 10

I = K Mod 10
Digit_place(3) = Digit(i + 1)
K = K / 10

I = K Mod 10
Digit_place(4) = Digit(i + 1)
K = k / 10
'*********************************************
'Multiplexing the four digits
' Multiplexing seven segment display
'*********************************************
Portb = Digit_place(4)
Portc.0 = 1 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0
Waitus 500
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0
Portb = Digit_place(3)
Portc.0 = 0 : Portc.1 = 1 : Portc.2 = 0 : Portc.3 = 0
Waitus 500
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0
Portb = Digit_place(2)
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 1 : Portc.3 = 0
Waitus 500
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0
Portb = Digit_place(1)
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 1
Waitus 500
Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0
If Portd.7 = 0 Then Product_count = 0
Goto Main
'****************************************************
Downcount:
If Product_count = 0 then Product_count = 9999
Decr Product_count
Return
'****************************************************
Upcount:
If Product_count = 9999 Then Product_count = 0
 Incr Product_count
 Return

Pulse rate Sensor to monitor heart beat rate of human

 Introduction of heart rate monitoring sensor:

To monitor the heart rate or pulse rate of any human body, a dedicated sensor is required. The sensor is basically a device which convert the information of blood flow in vain of body into electrical signal. The signal generated from pulse rate sensor are then process further to interface with microcontroller or microprocessor of Arduino board. Where the digital signal are analyzed and then results are displayed using any convenient means of display like LED display or using LCD display. Therefore we can say that the Pulse Sensor is a especially designed device which is ready for plug and play to measure the heart rate with help of any kind of microcontroller like AVR on Arduino board or Microchip PIC or Atmel 8051 family. This sensor is used by electronics engineering students, professional engineers, software engineers, embedded project developers to easily include the live data of heart rate into projects. There are variety of sensors available for this purpose. The pulse monitoring sensor are usually fixed or attached with help of a clip onto a fingertip or sometimes it can be used on earlobe to get the heart rate data from the body of human.

Principle of construction of Heart Rate Sensors:

The important point of in the discussion regarding the construction of heart arte sensor is that the technique used for the detection of pulse rate is non-invasive type of detection or measurement. These sensors are consisting of optical electrical devices. The majority of the optical heart rate sensor do have f an electronic circuit built-in with them in addition to sensing element to proper shape the electronics signal so that these could be easy interfaced with microcontroller or any digital signal processing device. The operation of the sensors starts with the monitoring of heart beat by clipping these onto a fingertip.

The working principle involved in the working of the Heart beat Sensor is Photo-ple-thysmo-graph. This principle in based to detect the changes in the volume of blood in apart of body like finger. The volume of blood is measured by the variation in the intensity of the light passing or blocked through that organ. The source of light in a heart beat sensor is usually an IR LED and the detector may be of any light intensity Detector like a Photo Diode, a Light Dependent Resistor (LDR) or a Photo Transistor. These two parts work tighter to form an understandable electronics signal.

Parts of pulse sensor:

Parts of a typical pulse rate sensor are basically two;

1.   IR transmitter: The function of IR transmitter is to emit IR which will be used to detect the blood in veins. Basically the media used for the detection of pulse is Infra-Red Radiations.

2.   IR receiver: The function of the IR receiver is to collect the IR passes through the finger. Some of the IR will be blocked when blood passes through the veins. The difference in the intensity will be actually the determination of pulse.

Types of pulse sensor:

There are two techniques which are used for the detection of heart beat;

1.     Reflection Based Detection of Heart Beat:

In this method the light or IR radiation is emitted from IR transmitter and received by IR receiver or photo diode or photo transistor. The light source (IR Transmitter) and the detector (Photo Transistor) are place at same side of a finger or organ (adjacent to each other). The finger of the person is placed in front of the transmitter and receiver. The light is reflected through the finger and a portion of it is blocked and rest of the light passed when blood sticks in veins. The light is shining on the finger and the part reflected back to photo transistor is measured. The quantity of light varies with the amount of blood in veins of finger. As the quantity of blood changes significantly in corresponding the heart function continuously. As a result the pulses are formed through the photo diode or photo transistor end.

Heart beat, Pulse rate Sensor Construction
 Reflection Based Detection of Heart Beat


2.     Transmission Based Detection of Heart Beat:

In this method the light or IR radiation is emitted from IR transmitter and received by IR receiver or photo diode or photo transistor. The light source (IR Transmitter) and the detector (Photo Transistor) are place facing each other and the finger of the person is placed in between the transmitter and receiver. The light is passed through the finger and a portion of it is block when blood sticks in veins. The light is shined and passes through the finger which is directly relates to the quantity of blood in vein at that time. As we know that the quantity of blood always changes, as a result we get pulse at the light collection device which is in our case the photo-transistor or photo-diode. This is a continuous process of up and down as a function of blood pumped into the finger.

Pulse rate Monitor, Heart Beat Pulse rate sensor
Transmission Based Detection of Heart Beat


Working of Heart beat Sensor with an electronics circuit # 1:

So far we have discussed the theory of working of a pulse sensor. Now we should move to its particle used. In fact the pair of light emitting device and light sensing device are not all the components to get the desired output. We attach some of analog electronics components to make them working. Here we will discuss the construction a simple circuit in which we could be able to detect a pulse using above discussion about the sensor. Therefore we can say that a typical Heart beat Sensor will be consisting of detection based devices along with electronics circuit. The detection part of the Heart beat Sensor will have an IR LED and a Photo Diode/ transistor placed in a clip. The electronics circuit will be consisting of an Op-Amp along with a few other analog electronics components like resistor & capacitors. This electronics circuit will help us to connect the detection part of sensor to signal processing unit like a Microcontroller. The working of the Heart Beat sensor is easily and becomes more interesting when we do a detailed study of the circuit diagram.

Circuit diagram heart beat sensor, detection pulses
Obtaining Electrical Signal from Heart Beat Sensor


The circuit diagram shown in above figure is based on assumption that the clip sensor part or detection part is attached with the finger. When the heart beat sensor have finger in place between the detectors the pulses are started to detect. As we have already discussed that with every heart beat the amount of blood in the finger will change from minimum to maximum level in the vein. The light emitted from the IR LED on passing through the finger get interactions with the blood quantity. The amount of light managed to pass through the obstacle of blood will be thus detected by the Photo Diode. The amount of light will be the function of amount of blood in vein as a result a changing electrical signal will be available at the photo diode terminal which is then processed through the use of OP-AMP. Here we will use LM358 OP-AMP which is consisting of two op-amp inside a single ship. The output of the photo diode is feed to the non–inverting input of the first op–amp through a capacitor. The use of capacitor at this stage is to block the DC Components of the signal coming from the detection unit. The amplification factor of at this stage is kept around 1001. It is sufficient to amplify the week signal to a level which is desirable. The output of first non-inverting amplifier is feed to second op-amplifier which is built in a comparator mode. The output of second op-amplifier (Comparator0 is used to feed to a transistor to have train of pulses as shown in the circuit diagram above. It may be noted that the construction of this circuit is very simple and efforts are made to use the general purpose components which are easily available in local electronics market or on a radio shop. For example the use of op-amp LM358, the transistor could be any NPN like c828 or BC 547.

Working of Heart beat Sensor with an electronics circuit # 2: 

The above circuit has been built in order to have response from optical sensor used to monitor the heart rate pulses as discussed earlier. The only difference is that it is very simple circuit as compared to previous one but it has very good results too.  

Optical sensor for heart rate Monitor
Interface of optical heart rate sensor


In this circuit we are using the IR transmitter coupled with the photo transistor. Again it is the assumption that the finger is placed in between the optical transmitter and optical receiver so that the light have obstacle with blood. For the optical sensor assembly (U2), we used a reflective optical sensor. This sensor has transistor output. Coming to the Op-Amp again we can use the LM358 or Lm 741 as per our convenient choice. But I think for the sake of experiments the results of LM358 are good enough. It is to be noted that the light of the LED is at the peak emitter wavelength 950 nm. The Designers or engineers normally use a range between 700 nm (Red light) to 1000 nm (infrared light) for biological instruments. The light beam have to cross the narrow parts of the body like a fingertip or an earlobe or the lower lip therefore use of this range of light is safe and workable.

Popular Post (All Time)