digital weight scale

13
IUB, EEE Independent University, Bangladesh Project title “Microcontroller based Digital Weighing Machine” Course Title: Embedded Systems (EEE418) Submitted By: 1. Harunnur Rasid ID: 1220883 2. Suraiya Akter ID: 1120415 3. Mahajabin Ara Muna ID: 1120416 Submitted to: Dr. Khoshru Mohammad Salim

Upload: harunnur-rasid

Post on 13-Apr-2017

362 views

Category:

Engineering


6 download

TRANSCRIPT

Page 1: Digital Weight Scale

IUB, EEE

Independent University, Bangladesh

Project title

“Microcontroller based Digital Weighing Machine”

Course Title: Embedded Systems (EEE418)

Submitted By: 1. Harunnur Rasid ID: 1220883 2. Suraiya Akter ID: 1120415  3. Mahajabin Ara Muna ID: 1120416

Submitted to: Dr. Khoshru Mohammad Salim School of Engineering and Computer Science

Submission date: 03 -12-2015

Page 2: Digital Weight Scale

IUB, EEE

Digital Weighing MachineWeighing machine is very useful product. It helps us in checking our weight as well

as other product’s weight. Moreover, Weighing machine are used in many industrial

and commercial applications. Without a weight machine it is not possible to know the exact

mass of anything. There are two types of weighing measuring system called analog

weighing machine and digital weighing machine. The analog weighing system is very erroneous.

In digital weighing machine, we don’t have to face any problem. Only viewing the display we

come to know the exact weight of the product. In digital weighing machine, we interface with the

digital world. In our project, we come to know the basic principle of digital weighing

machine and know how to make a digital weight machine easily and cheaply. This project

basically helps us to compete with Manufacturer Company of digital weighing machine in future.

Component used in our project To do the project we had to collect some components. They are given below-

Load Cell

Stand of iron to set up Load Cell

Microcontroller (PIC16F877A)

Op-Amp (AD620 )

Bread Board, Printed circuit Board(PCB)

LCD 16*2 display

Two power supply

Concomitant: Resistors, Connecting Wires.

Brief descriptions of important usable components• Load cell   :

Load cell is used as force measuring component. We collected a load cell of

5KG(Phidgets 3133_0 - Micro Load Cell (0-5kg) - CZL635)As a result in our project we only

Page 3: Digital Weight Scale

IUB, EEE

could measure till 5 KG. There are four or two strain gauges in load cell depending on the

capacity of load cell. It works like a whetstone bridge

When we don’t give any load to it, it remains balanced; there is no flowing of current as

well as corresponding voltage.

Whenever we hang on a load on to it, imbalance situation is occurred. Stress

is c aus ed by ex t e rna l f o r ce . S t r a i n gauge c onve r t s t he de fo rma t ion to

e l e c t r i c a l signals. The electrical signal output is typically in the order of a few mill

volts.

Fig: Load Cell

• Op-amp AD620:

It is an instrumentation amplifier which is a type of  differential amplifier. They

are mainly used to amplify very small differential signals from strain gauges.

It has got very low DC offset, low drift, l ow noise, very high gain. We made

our gain 100 using AD620. We could also used op-amp LM358 to amplify our

AD620 output further more.

Fig: Op-Amp AD620

Page 4: Digital Weight Scale

IUB, EEE

• Bread b oard :

Breadboard i s a c o n s t r u c t i o n b a s e f o r a o n e - o f - a - k i n d electronic.

I t ’ s t he s o lde r l e s s b r eadboa rd w h ic h does no t r equ i r e soldering.

Moreover is reusable.

Fig: Bread Board

• Microcontroller (PIC16F877A ):

P I C 1 6 F 8 7 7 A i s a s m a l l p i e c e o f   se mic onduc to r

i n t e g ra t e d c i r cu i t s . The pa ckage t ype o f t he s e i n t eg ra t ed c i r c u i t s i s

D I P p a c k a g e . W e c o u l d u s e a n o t h e r m i c r o c o n t r o l l e r .

B u t P I C 1 6 F 8 7 7 A h a s s o m e a d v a n t a g e s . . T h i s p a c k a g e i s v e r y

e a s y t o b e soldered onto the strip board. PIC16F877A is very cheap.

Moreover, it is a l s o v e r y e a s y t o b e a s s e m b l e d . S o w e u s e

t h i s c h i p . T h i s I C c a n b e reprogrammed and erased up to 10,000

times .Therefore it is very good for  new product development phase.

Fig: PIC16F877A Micro Controller Chip

Page 5: Digital Weight Scale

IUB, EEE

• Pr i nte d c i rc u i t boar d :

A p r i n t e d c i r c u i t b o a r d o r P C B i s u s e d t o

mechanically support and electrically connect electronic components using conductive

pa thw ays , t r a cks o r s igna l t r a ce s etched f r om coppe r she e t s laminated on

to a non-conductive substrate. We set up our microcontroller in the PCB.

Fig: PCB Circuit board

Power Source:

Components that we need to make our IC (PIC16F877A) work are just a 5V  p o w e r

s u p p l y a d a p t e r .

Fig: DC power source

Page 6: Digital Weight Scale

IUB, EEE

LCD 16*2:

We have used a 16*2 LCD display to display our output.

Fig: LCD Display

Project description

Hardware Description:

Ha rdwa re pa r t i s done in a b r e adboa rd . We cons t ruc t e d ou r c i r cu i t

d i ag ra m on  bread board. Isolate four wires are coming out of the load cell. Two wires are

used as input in our amplifier and other two are used as and Ground. We connected it with

the AD620; supplied (+ve) 7.5 volt and (–ve) 7.5 volt separately using two power supply

in the AD620 op amp. We measured the change in voltage as the weight flexes via

the green and white wires. We measured across a resistor of 100ohm as we’ve wanted to gain

1000.

Page 7: Digital Weight Scale

IUB, EEE

Fig: Circuit setup for digital Weighing Scale

S o f t w a r e p a r t :

We’ve done out simulation using Proteus software. The Simulink ISIS design is like below.

RA0/AN02

RA1/AN13

RA2/AN2/VREF-/CVREF4

RA4/T0CKI/C1OUT6

RA5/AN4/SS/C2OUT7

RE0/AN5/RD8

RE1/AN6/WR9

RE2/AN7/CS10

OSC1/CLKIN13

OSC2/CLKOUT14

RC1/T1OSI/CCP2 16

RC2/CCP1 17

RC3/SCK/SCL 18

RD0/PSP0 19

RD1/PSP1 20

RB7/PGD 40RB6/PGC 39RB5 38RB4 37RB3/PGM 36RB2 35RB1 34RB0/INT 33

RD7/PSP7 30RD6/PSP6 29RD5/PSP5 28RD4/PSP4 27RD3/PSP3 22RD2/PSP2 21

RC7/RX/DT 26RC6/TX/CK 25RC5/SDO 24RC4/SDI/SDA 23

RA3/AN3/VREF+5

RC0/T1OSO/T1CKI 15

MCLR/Vpp/THV1

PIC16F877A

D714

D613

D512

D411

D310

D29

D18

D07

E6

RW5

RS4

VSS1

VDD2

VEE3

LCD1LM016L

54%

RV?

1k

R21k

+88.8Volts

R41k

R5

100

+88.8Volts

R131k

3

26

47

8 51 U2

AD620

5V

RA0/AN02

RA1/AN13

RA2/AN2/VREF-/CVREF4

RA4/T0CKI/C1OUT6

RA5/AN4/SS/C2OUT7

RE0/AN5/RD8

RE1/AN6/WR9

RE2/AN7/CS10

OSC1/CLKIN13

OSC2/CLKOUT14

RC1/T1OSI/CCP2 16

RC2/CCP1 17

RC3/SCK/SCL 18

RD0/PSP0 19

RD1/PSP1 20

RB7/PGD 40RB6/PGC 39RB5 38RB4 37RB3/PGM 36RB2 35RB1 34RB0/INT 33

RD7/PSP7 30RD6/PSP6 29RD5/PSP5 28RD4/PSP4 27RD3/PSP3 22RD2/PSP2 21

RC7/RX/DT 26RC6/TX/CK 25RC5/SDO 24RC4/SDI/SDA 23

RA3/AN3/VREF+5

RC0/T1OSO/T1CKI 15

MCLR/Vpp/THV1

PIC16F877A

D714

D613

D512

D411

D310

D29

D18

D07

E6

RW5

RS4

VSS

1

VDD

2

VEE

3

LCD1LM016L

5V

28%

RV?

1k

Page 8: Digital Weight Scale

IUB, EEE

RA0/AN02

RA1/AN13

RA2/AN2/VREF-/CVREF4

RA4/T0CKI/C1OUT6

RA5/AN4/SS/C2OUT7

RE0/AN5/RD8

RE1/AN6/WR9

RE2/AN7/CS10

OSC1/CLKIN13

OSC2/CLKOUT14

RC1/T1OSI/CCP2 16

RC2/CCP1 17

RC3/SCK/SCL 18

RD0/PSP0 19

RD1/PSP1 20

RB7/PGD 40RB6/PGC 39RB5 38RB4 37RB3/PGM 36RB2 35RB1 34RB0/INT 33

RD7/PSP7 30RD6/PSP6 29RD5/PSP5 28RD4/PSP4 27RD3/PSP3 22RD2/PSP2 21

RC7/RX/DT 26RC6/TX/CK 25RC5/SDO 24RC4/SDI/SDA 23

RA3/AN3/VREF+5

RC0/T1OSO/T1CKI 15

MCLR/Vpp/THV1

PIC16F877A

D714

D613

D512

D411

D310

D29

D18

D07

E6

RW5

RS4

VSS

1

VDD

2

VEE

3

LCD1LM016L

5V

100%

RV?

1k

Fig: Proteus Simulation

P r o g r a m m i n g s o f t w a r e :

W e d i d o u r c o d e u s i n g CCS for PIC software. We’ve done our project with c code.

As our input was analog and we wanted to show it on a digital form. The analog to digital

conversion was completely done in our code. This part was little bit difficult to as we had to

check the code many times. Port A is used as out input of the analog input. We used port B of

microcontroller for the 7-segmentdisplay and used port D for the data selector. We

converted the input from binary to 10-bit BCD which displayed in LCD 16*2 in a

corresponding decimal value. As we use 10 bit, we could show from 0-1023.We burn the

code into microcontroller using a burner and then set up the chip in printed circuit board.

C C o d e :

#include <16F877A.h>

#device adc=10;

#include <math.h>

#fuses XT,HS,NOWDT,NOLVP

#use delay(clock=4000000)

#include "flex.c"

void main()

{

float offset=0;

float value=0;

Page 9: Digital Weight Scale

IUB, EEE

float weight=0;

lcd_init();

setup_adc_ports(ALL_ANALOG);

setup_adc(ADC_CLOCK_INTERNAL);

while(1)

{

value=read_adc();

offset=290;

weight=(value-offset)/146.6; //weight=k*(measured voltage - zero weight offset)

lcd_gotoxy(1,1);

printf(LCD_PUTC,"weight in kg");

lcd_gotoxy(1,2);

printf(LCD_PUTC,"%f",weight);

}

}

After that we connected the PCB board with the LCD display. When we don’t give any

load, the display was showing an offset value. For 1/2 kg it was showing us decimal 588

and for one kg it was 1023.

We burn this code into the PIC16F877A microcontroller and setup the circuit.

Problem faced during doing our project 

Mainly we faced problem in hardware part. By checking the load cell wires again and again we had to find out which of the two are

inputs. Making of stand of iron was also very difficult part. Moreover we could not make sub tractor circuit for avoiding the leakage

voltage only because of time shortness. As because PIC16F877A is very sensitive we have to very careful of its use. Further Improvements can be done in following ways

Page 10: Digital Weight Scale

IUB, EEE

O u r w e i g h t m a c h i n e w a s g i v i n g u s a h u g e o f f s e t v a l u e w h i c h i s r e a l l y undesirable. So to avoid that offset value we could make a sub tractor circuit which would peter out the offset almost.

If we want than we can develop this weighing machine by many ways such as we can use keypad like if we keep any product on the machine than it will show the cost, weight and total cost of that product on the display. For doing this we also have to develop the code.

ConclusionWei gh ing ma ch ine i s ve ry u se fu l f o r u s . Wi thou t we igh ing m ach i ne i t i s

no t  possible to know exact mass of anything. It becomes a part of our daily life.

The o r i g i n a l c o s t o f a w e i g h i n g m a c h i n e i s v e r y h i g h b u t o u r

i n v e n t e d w e i g h i n g machine is very low cost. We spend almost 1500 taka for

this weighing machine but the original price of weighing machine is approximately 4000-

5000 taka. D o i n g t h i s p r o j e c t w a s v e r y i n t e r e s t i n g . F r o m t h i s

p r o j e c t a c q u i r e l o t s o f   knowledge and come to learn many new things.