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

No comments:

Post a Comment

Please ask if you have any question regarding the programming of MCU, or have any problem in development of your electronics project. microcontroller51.blogspot.com

Popular Post (All Time)