Mirko Pavleski
Published © GPL3+

Arduino weighing machine(scale) with analog showing

This is a Retro style weighing machine where the result is displayed on the Galvanometer instead of LCD Display.

BeginnerFull instructions provided1,865
Arduino weighing machine(scale) with analog showing

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Load cell 5kg
×1
breakout board HX711
×1
Galvanometer or 5V Voltmeter
×1
Trimmer Potentiometer, 10 kohm
Trimmer Potentiometer, 10 kohm
×1
Through Hole Resistor, 470 ohm
Through Hole Resistor, 470 ohm
×2
LED (generic)
LED (generic)
×4
Slide Switch
Slide Switch
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Schematic

Code

Arduino code

Arduino
#define DT A0
#define SCK A1
 
long sample=0;
float val=0;
long count=0;
int WEIGHT=0;
 
unsigned long readCount(void)
{
unsigned long Count;
unsigned char i;
pinMode(DT, OUTPUT);
digitalWrite(DT,HIGH);
digitalWrite(SCK,LOW);
Count=0;
pinMode(DT, INPUT);
while(digitalRead(DT));
for (i=0;i<24;i++)
{
digitalWrite(SCK,HIGH);
Count=Count<<1;
digitalWrite(SCK,LOW);
if(digitalRead(DT))
Count++;
}
digitalWrite(SCK,HIGH);
Count=Count^0x800000;
digitalWrite(SCK,LOW);
return(Count);
}
 
void setup()
{
 pinMode(6, OUTPUT); 
 pinMode(7, OUTPUT);
 pinMode(8, OUTPUT); 
 pinMode(10, OUTPUT);  
pinMode(SCK, OUTPUT);

delay(500);

test();
calibrate();
}
 
void loop()
{
count= readCount();
int w=(((count-sample)/val)-2*((count-sample)/val));

 WEIGHT = map(w,0,1000,0,255);
 analogWrite (6,WEIGHT);
}
 
void calibrate()
{
  digitalWrite(7, HIGH);

for(int i=0;i<100;i++)

{
count=readCount();
sample+=count;
}
sample/=100;

digitalWrite(7, LOW);
digitalWrite(8, HIGH);
count=0;
while(count<1000)
{
count=readCount();
count=sample-count;
}

delay(2000);
for(int i=0;i<100;i++)
{
count=readCount();
val+=sample-count;
}
val=val/100.0;
val=val/100.0; // put here your calibrating weight

digitalWrite(8, LOW);
digitalWrite(10, HIGH);
}
void test() {
for (int i=1;i<=255;i++)
{
analogWrite (6, i);  
delay (15);
}
for (int i=255;i>=1;i--)
{
analogWrite (6, i);  
delay (15);
}
}

Library

C/C++
No preview (download only).

Credits

Mirko Pavleski

Mirko Pavleski

131 projects • 1215 followers

Comments