The Microcontroller Based Weighing Machine (PDF/DOC)
Abstract –
This paper presents the design of an efficient, accurate and inexpensive microcontroller based weighing scale which can be used in all weight measuring operations. A digital weighing scale widely uses a load cell (resistive strain gauge) to measure weight. It converts pressure into appropriate voltage levels. This voltage level is filtered and converted into digital data in the microcontroller which is then displayed on a 16*2 LCD. The prime goal of this project is to provide high precision, low cost and user friendly functionalities.
Introduction-
Now a day precise measurement and storage of weight is one of the most important activities in industries. The mechanical weighing machines are now replaced by the electronics weighing machine as electronic weighing machines are smart with the advantages like accuracy, reliability, and wide range.
The Electronics weighing bridges are comparatively light weight and easy to operate with direct display. Earlier electronic weighing machine were designed using DPM, Microprocessor and Personal computer. The disadvantage of DPM type weigh machine has no facility to store data internally. Microprocessor and Personal computer based system cost is very high. To remove this drawback microcontroller based weigh machine is designed.
This project presents the software and hardware design, results and conclusion.
2.THEORETICAL BACKGROUNG:
A microcontroller is a type of microprocessor furnished in a single integrated circuit and needing minimum support chips. Its principle nature is maximum efficiency at minimum cost. A microcontroller is an intelligent core for a specialized dedicated system. It is a complete computer system with input-output lines, timers, Read-Only Memory (ROM), Read-Write Memory (RAM) and some peripherals such as counters and timers, analog to digital converters, comparators and serial ports. The PIC microcontroller is mostly build on the Harvard architecture and has characteristics which include RISC processor design, single word instructions, machine and data memory configuration and characteristic instruction formats.
The Reduced Instruction Set Computer (RISC) has 35 instructions and each instruction performs more elementary operations. Consequences of this are a smaller silion area, faster execution and reduced program size with fewer accesses to main memory. In the Harvard architecture the data and instructions use different path and storage areas. This type of machine can read and write instructions to and from memory at the same time and results in a faster machine. Since the device has separate buses for instructions and data it is possible for instructions to be sized differently than data items. Being able to vary the number of bits in each instruction op-code makes possible the optimization of program memory and the use of single-word instructions that can be fetched in one bus cycle. The PIC architecture has a two-stage instruction pipeline, since the fetch and current instruction and execution of the previous one can overlap in time, one complete instruction is fetched and executed at every machine cycle (pipelining).
The PIC clocking system is designed so that an instruction is fetched, decoded, and executed every four clock cycles where the clock is either internal or external. In this manner a PIC equipped with a 4MHz oscillator clock beats at a rate of 0.25 micro seconds. Since each instruction executes at every four clock cycles, each instruction takes 1 us when the pre-scalar is not used.
In the PIC16F690 microchip controller there 18 general purpose I/O pins are available where one pin is only input that is the master clear pin, 3 ports which include port A which is 6 pins wide, port B which is 4 pins wide and port C which is 8 pins wide making the device have 18 pins and 2 pins for powering the device. This microcontroller has three types of memory- ROM, RAM and EEPROM.ROM memory is used to permanently save program being executed that is why it is often referred to as program memory. Since ROM is made of FLASH technology, its contents can be changed by providing special programming voltage. Similar to program memory, the contents of EEPROM are permanently saved even after the power going off. The third memory is the RAM which consists of two parts: the general purpose registers (GPR) and the special function registers (SFR).
Peripheral devices in the pic16f690 microchip controller include the timer which is used as timers or counters. The asynchronous receiver transmitter contains all the clock generators, shift registers and data buffers necessary to perform an input or output serial data transfer independent of device program execution.
- DESIGN–The design of the microcontroller weigh scale was based on the PIC16F690 as the heart of the system. The design was divided into two main parts; hardware and software design.
3.1 Hardware design–LCD to PIC Interface; LCD requires 8 pins for the 8 bit mode of sending data for 8-bit configuration mode of the LCD. PORTC of PIC16F690 is 8 bit wide and was found convenient for the data lines of the LCD. That is, RC0-7 PIC pins where connected to D0-7 data lines of LCD as shown on figure 2-1.Enable pin (E) of the LCD was connected to RA1 (pin 18) of the microcontroller. Register select (RS) pin of the LCD was connected to RB5 (pin 12) of microcontroller. Since the objective was to write data to the LCD read/write line was grounded; because at no point is data being read from the LCD. This helped free up an extra pin.
Figure 3‑1 LCD to PIC interface
The 10KΩ resistor connected between VSS and VDD to ground is used to vary the contrast of the LCD brightness. An optimal value is achieved depending on one wish. It varies the voltage from VDD value ground. To achieve a visual sign when operating in the safe limits (0-100gms) a green LED was used. This was connected between VDD and RA5 (pin 3) through a urrent limiting resistor of 330 ohms whose justification is is given in equation 2.1 below.
To make sure the value of current sourced is far below the maximum allowed current (25 mA) a 330 ohms resistor was chosen.
3.2 Software design-
Software design was divided into the following divisions:
- ADC program.
- LCD program.
- LED subprogram.
- Main program to coordinate the others.
The initialization involved pin configuration. The ADC subprogram and LCD subprograms were also written in assembly code language in mplab.
- EXPERIMENTAL RESULTS AND ANALYSIS-
Table 4.1 below shows simulated results when the design was run on proteus. It shows the variation of the displayed value of the weight as the voltage is varied from 0 to 5 volts as well as the resistance drops consequently. The table also shows the status of the LED as the weight is varied.
Table 4.1‑ Table of simulated results.
VOLTAGE % | RESISTANCE KΩ | VOLTAGE V | DISPLAYEDVALUE in gm | LED STATUS |
0 | 10 | 0 | 0.0 | ON |
1 | 9.9 | 0.05 | 9.775 | ON |
2 | 9.8 | 0.1 | 19.55 | ON |
3 | 9.7 | 0.15 | 28.348 | ON |
4 | 9.6 | 0.2 | 37.145 | ON |
5 | 9.5 | 0.25 | 45.943 | ON |
6 | 9.4 | 0.3 | 53.763 | ON |
7 | 9.3 | 0.35 | 61.583 | ON |
8 | 9.2 | 0.4 | 69.404 | ON |
9 | 9.1 | 0.45 | 77.224 | ON |
10 | 9.0 | 0.5 | 85.044 | ON |
11 | 8.9 | 0.55 | 91.886 | ON |
12 | 8.8 | 0.6 | 98.729 | ON |
13 | 8.7 | 0.65 | 105.571 | OFF |
14 | 8.6 | 0.7 | 112.414 | OFF |
15 | 8.5 | 0.75 | 119.256 | OFF |
When the voltage to the microcontroller input was at zero, the displayed value was also at zero while the visual alarm was ON to show that the weight was within the specified limit. Behold 100 gm the visual alarm goes off indicating that the weight level is behold the specified minimum limit.
4.1 System Evaluation.
- Number of main ICs. In terms of the number of components, the developed PIC16F690 Microcontroller Based Electronic Weighing Balance (MCBEWB) uses the least. The microcontroller chip has adequate in-built Flash Memory, EEPROM, RAM and I/O ports. Any microprocessor based electronic weighing balance would require an external RAM, an external EPROM and an I/O device among other support chips. This renders the latter extremely expensive.
- From the portability perspective, the developed system has unlimited range as all that is needed is a single external power supply. It has been designed to make it as compact as possible. The Butchery Electronic Weighing Balance (BEWB) is bulky and therefore has limited portability.
- In terms of space, the developed system required least space for both the digital circuitry and the analog circuitry. This is attributed to the fact that minimal number of chips was used and to crown it all, the system was implemented on PCB boards. Owing to the many external chips used, in BEWBs and SRLEWBs, a lot of space is required for circuit implementation.
- The developed system is considered the most flexible, as in-system reprogramming is possible. This is courtesy of the built-in Serial Programmable Interface (SPI) of the PIC16F690 microcontroller. Program can be written or erased up to 1000 times. Some BEWBs and SRLEWBs use dedicated chips like those in DMMs. They only perform specific tasks and cannot be changed or modified to do otherwise. For those that are microprocessor based, in-system reprogramming is not possible. Microprocessor based related Control/Data Acquisition Applications use external EPROM for program storage. To change the program, it is erased by exposing it to UV, a tedious process indeed.
- Range and Resolution. The developed electronic weighing balance has tried to address both resolution and range. It is the best in as far as striking a balance between range and resolution goes. This is a modest system with a reasonable range while at the same time being sensitive enough. This is quite rare in virtually all-electronic weighing systems.
- Display Capability. In as far as display capability is concerned; the developed system enjoys the widest capability. Using the ASCII code, it can display all alphanumeric data/information. It can display special characters. BEWBs and SRLEWBs can only display numeric data/information. Information in letters or symbols is usually engraved alongside the LCD display.
Conclusion-The project design objectives of the weight monitoring system were successfully achieved. The system displaying unit LCD was able to monitor the variations in weight. This weigh scale is of great importance for the industries involved in weight taking and also in the retail market.
REFERENCES:
- PIC16F631/677/685/687/689/690 Data sheet 20-pin Flash-Based, 8-bit CMOS Microcontrollers with Nano Watt Technology.[Performance]. Microchip Technology Inc., 2006.
- S.a.M.p. Canton, Microcontroller Programming The Microchip PIC, Taylor & Francis Group, 2007.
- D. Green Embedded Systems Programming with the PIC16F690, Second Edition ed., 2008.
- Bates, Interfacing PIC Microcontrollers Embedded Design by Interactive Simulation, Martin Bates: Elsevier, 2006.
- Ibrahim, PIC BASIC Projects 30 Projects Using PIC BASIC and PIC BASIC PRO, Great Britain: MPG Books Ltd, 2006.
Click the button below to INSTANTLY subscribe and download the COMPLETE MATERIAL (PDF/DOC)!