.:: Fajar_ridikc identity | | about me Fajar_ridikc ::.

ARDUINO :: Project Load Cell with HX711

0 :: comments

Project Load Cell with HX711


Load Cell with HX711
HX711 adalah Dual Channel Weighing Sensor Module untuk disambungkan dengan Load Cell. HX711 mempunyai ADC 24bit.
Kelemahan HX711 adalah ia membaca bacaan Load Cell dalam masa agak lama dalam 200ms bagi satu channel.
Saya menggunakan load test 10kg di empat tempat berbeza untuk mendapatkan pekali bagi setiap load cell. Mengira empat pekali memerlukan empat persamaan. Saya menggunakan software Maple untuk selesaikan persamaan serentak.
Maple Load Cell 1
Maple Code
Maple Load Cell 2
Maple Output
Berikut adalah demo membaca empat load cell.
Suni

ARDUINO :: HX711 (24 bit Analog to Digital Converter)

0 :: comments

HX711 (24 bit Analog to Digital Converter)

HX 711 is a precision 24-bit analog to digital converter (ADC) specially designed for Weigh scales and industrial control applications to interface directly with a bridge sensor.
hx711

Pinout of HX711

hx711 pin

Arduino Hookup

arduino hx711
Simply connect Load cell wires to the HX711 module based on their color, then connect DAT (Data) pin to Arduino Analog pin A1 and connect CLK (Clock) pin to Arduin0 Analog pin A0, Put Vcc and Gnd supply from Arduino power source pins.

Arduino Code


// Hx711.DAT - pin #A1
// Hx711.CLK - pin #A0

#include "hx711.h"

Hx711 scale(A1, A0);

void setup() {

  Serial.begin(9600);

}

void loop() {

  Serial.print(scale.getGram(), 1);
  Serial.println(" g");

  delay(200);
}

This simple code brings output at serial port terminal of Arduino IDE.
Before compiling this code put HX711 Library into the Arduino IDE.
Suni

ARDUINO :: Load Cell

0 :: comments

Load Cell Nanoshield features

Connecting the load cell

Each module can read one full-bridge load cell. The connection to the load cell is made through a terminal block that is used both for supplying power to the load cell and to read its output signals. The table below shows the pinout of the terminal block:
Pin nameFunction
VCLoad cell power supply
C-Negative output signal
C+Positive output signal
GNDReference (ground)
Load cell terminal block pinout
The figure below shows how to connect a load cell to the module:
Connecting a load cell to the Load Cell Nanoshield
The load cell supply voltage is the same one used to supply power to the module – that is, 5V in the factory default configuration. Optionally, it can be supplied with 3.3V according to the 3.3V operation section. These power supply voltages are already optimized for the ideal operation of the module and must be used like this, i.e. it is not possible to use an external power supply of, say, 10V for the load cell. Note that load cells are passive sensing elements, comprised of resistive sensing elements to measure the force. As such, they don't require any particular power supply voltage to operate.
Actual load cell connected to the module (click on the image to enlarge)

Connection to an Arduino + Base Board Uno

The easiest way to use the Load Cell Nanoshield along with an Arduino board is by using a Base Board Uno or Base Board L Uno. Just connect the boards as shown in the picture below and load our sample code to check that the system is working (see the sample code section below). This assembly can be used with Arduino UNO, Mega R3 or similar boards. The picture below shows how the assembly looks like.
Connection to an Arduino using the Base Board Uno (click on the image to enlarge)

Connection to a Base Boarduino

It is also possible to connect the Load Cell Nanoshield directly to our Arduino-compatible board, the Base Boarduino. The connection is done the same way it is done with the Base Board, as shown in the picture below. You just have to connect the boards, load our sample code and check that the system is working (see the sample code section at the bottom of the page).
Connection to a Base Boarduino (click on the image to enlarge)

Direct connection to an Arduino

It is also possible to use the module with a direct connection to an Arduino using a breadboard and jumper wires. Use the following wiring diagrams to connect the Load Cell Nanoshield to an Arduino UNO or Arduino MEGA.
Connection to an Arduino UNO (click on the image to enlarge)
Connection to an Arduino MEGA (click on the image to enlarge)

Using multiple modules simultaneously

The Load Cell Nanoshield communicates with a microcontroller through an SPI communication interface. An advantage of this interface is the possibility to connect several modules simultaneously using just a few microcontroller pins. The bus features a clock line (SCK), two data lines (SDI and SDO) and a selection pin called chip select (/CS). All the modules connected to the bus share the same clock and data lines. However, to each one of them an exclusive chip select pin is assigned. This way, the microcontroller can choose which module it will communicate with, sending a low-level logic signal (0V) to the chip select pin corresponding to that module when needed.
The Load Cell Nanoshield features a set of jumpers on the top side of the board that allows the manual selection of up to 5 different pins for the chip select function (4, 7, 8, 10 and A3) – the default pin is 8. Besides those 5 options, the module also features 10 pins that are selectable via solder jumpers on the bottom side of the board (2, 3, 5, 6, 9, A0, A1, A2, A4 and A5). That enables the connection of up to 15 modules simultaneously to a single microcontroller.
The picture below shows the position of the manual jumpers on the top side and the solder jumpers on the bottom side of the board.
Load Cell Nanoshield chip select options
In order to use several modules simultaneously, you just have to connect them together on different slots of the Base Board or Base Board L at the same time, using the jumpers to select a different chip select in each module. The figure below shows a set of four modules being used simultaneously. In this example, we used a Base Board UNO along with an Arduino Mega.
Using several modules simultaneously
However, keep in mind that the pins used for the SPI communications and the pins used for the chip select of the modules cannot be shared or have other functions on the circuit. Therefore, it is advisable to make an analysis of all the microcontroller pins that will be used in the project before using several modules simultaneously. Check out our pinout table for more information on how to allocate the pins.
Suni

ARDUINO :: Weight Sensor for Arduino

0 :: comments

Weight Sensor for Arduino


 

Ever wanted to weigh someone or something with your Arduino but do not know where to start? Well, we know how it feels like and hence we bring you this tutorial in a bid to explain one of the easiest weighting method available. This is done with a strain guage/loadcell and the HX711 based module.
The HX711 chip is specifically designed for weighing applications. It has a 24-bit differential ADC's and it comes in a compact package with minimal supporting circuit. The chip is highly integrated with builtin PGA, regulator and oscillator circuits. The module is thus small and is easy to integrate with an Arduino.
The setup is to have the load cell connected to the HX711 analog inputs and have the Arduino connect at the digital data side of the module. The load cell may be of any weight range. In the making of this tutorial, we have used a 40kg load cell, however, you may use other load cells like 5kg, 100kg or even 200kg. The unit should be calibrated to obtain and output a value with weight units.
Most strain gauge will not come with a platform. You will need to build one. A basic scale will look something as below. Wood, plastic or metal flatsheet should do the job.
        
The HX711 uses an I2C like protocol with fist data pin and clock pin. Lucky for us, someone has done the dirty job of creating the Arduino library for the HX711. It is surprisingly simple to use, just call one function and you get a reading from the chip. Download the library from here.
Install the library as per normal procedure. Close and then open your Arduino IDE for the installation to take effect.
Now copy the code below and upload.

#include "HX711.h"
HX711 scale(A1, A0); // DOUT, SCK

void setup()
{
Serial.begin(9600);
scale.set_scale(2280.f); //// this value is obtained by calibrating the scale with known weights
scale.tare();
}
void loop()
{
Serial.print("one reading:\t");
Serial.print(scale.get_units(), 1);
scale.power_down(); // put the ADC in sleep mode
delay(5000);
scale.power_up();
}
You may notice that the value extracted off the HX711 is just a number. It is really up to you to put a unit by converting this number into something meaningful weighing unit such as grams. The easiest way to do this is a simple calibration proceedure: Place a known weight on the scale, say 1000 grams and then record the reading from the HX711. Now edit the code so that every time you read, you multiply the value with 1000 and then divide it by the reading you recorded earlier. Note that you maybe better off using a float in this operation. The result shouild be the reading in gram. This of course assumes a very linear output from the sensor and is therefore not a recommended approach for applications requiring high accuracy. There are several other ways to do this but this tutorial will not cover them as we focus on getting our weight sensor up and running.
The tare function in setup()  sets the "zero-point" of the sensor to whatever is the initial weight the Arduino detects on power up. This is useful to remove the effect of the platform and/or a container used for holding the objects to be weighed.
This small module has gigantic possibilities. Imagine having an automatic egg sorter machine or perhaps a sayote sack weighing scale with logging functions. Even that strawberry jam from Benguet farms maybe automatically QC'ed using this module!
Suni

ARDUINO :: Timbangan digital (Load Cell)+ sensor Suhu + Arduino Uno + Delphi

0 :: comments

Timbangan digital (Load Cell)+ sensor Suhu + Arduino Uno + Delphi 

revisi program, awal nya tanpa minta display di PC, akhirnya minta display di PC, seperti biasa saya mengandalkan delphi  sebagai senjata saya untuk memparsing dan menampilkan data Timbangan digital + sensor Suhu dari Arduino Uno pada PC menggunakan  Delphi , ini hanya soal kebiasaan saja. sering make, tinggal copast sana sini, source code lama yang pernah dibuat.

Foto foto alat Timbangan digital + sensor Suhu + Arduino Uno + Delphi






pengkabelan load cell nya adalah sebagai berikut :





// Hx711.DOUT - pin #A5
// Hx711.SCK - pin #A4

// LCD.RS - pin 2
// LCD.En - pin 3
// LCD.D4 - pin 4
// LCD.D5 - pin 5
// LCD.D6 - pin 6
// LCD.D7 - pin 7



source code nya adalah sebagai berikut

#include <LiquidCrystal.h>
#include <Hx711.h>


LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
Hx711 scale(A5, A4);

int adc0,temp,SetPointAtas,SetPointBawah; 
int sensorPin = A0;    // select the input pin for the potentiometer
int RelayPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  Serial.begin(9600);
   SetPointAtas=34;
  SetPointBawah=28;
  Serial.begin(9600);
  lcd.begin(16, 2);
  pinMode(RelayPin, OUTPUT);  
  lcd.begin(16, 2);
  lcd.print("Digital Rice");
  lcd.setCursor(0, 1);
  lcd.print("Storage"); 
  delay(4000);
 // lcd.noDisplay();
 lcd.setCursor(0, 0);
 lcd.print("                ");
  lcd.setCursor(0, 1);
 lcd.print("                ");

}

void loop() {

  adc0 = analogRead(0);   
  temp=(adc0*5)/10;
  lcd.setCursor(10,1);
  lcd.print(temp);    
  lcd.print("C");
  
  
  if(temp>=SetPointAtas){
      lcd.setCursor(0,0);
      lcd.print("Heater --> OFF ");
      digitalWrite(RelayPin,LOW);
  }
  else if(temp<=SetPointBawah){
      lcd.setCursor(0,0);
      lcd.print("Heater --> ON");
      digitalWrite(RelayPin,HIGH);
  }
  
  lcd.setCursor(0, 0);
  lcd.print("Berat");
  
  
  lcd.setCursor(10, 0);
  lcd.print("SUHU");
  
  Serial.print(scale.getGram(), 1);
  Serial.print("A");
  Serial.print(temp);
  Serial.print("B");

  
  lcd.setCursor(0, 1);
  lcd.print(scale.getGram(), 1);
  lcd.print(" g");
  lcd.print("       ");
  
  
//  Serial.print(scale.getGram(), 1);
//  Serial.println(" g");

  delay(200);

}


sedangkan tampilan aplikasi timbangan digital pada Delphi adalah sebagai berikut :



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CPort,atterbilang, MPlayer,mmsystem;

type
  TForm1 = class(TForm)
    ComPort1: TComPort;
    GroupBox2: TGroupBox;
    Button2: TButton;
    Button4: TButton;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    ListBox1: TListBox;
    procedure Button2Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure ComPort1RxChar(Sender: TObject; Count: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
if Comport1.Connected then    // jika comport(untuk koneksi dengan port serial ) sudah terbuka,
 begin Comport1.Connected :=false; //maka tutup   koneksi dengan port serial
 Button2.Caption:='Open Driver' //maka caption tombol menjadi    Open Driver
 end
 else Comport1.Connected :=true;   // selain itu, buka comport (terkoneksi dengan port serial)
 if Comport1.Connected then Button2.Caption:='Close Driver';  // jika comport terbuka (terkoneksi dengan port paralel) maka tombol akan bertuliskan Close Driver
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
comport1.ShowSetupDialog;
end;

procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);
var A, B, DataA, DataB :string;
    sx :TStringList;      //variabel string diatas bisa ditambahi sendiri sesuai
                         //kebutuhan jumlah sensor,tinggal tambah D,E,F,DataD,DataE,DataF,,dan seterusnya..
begin
{cari string 'A', jika ketemu string 'A' maka string SEBELUM 'A' atau data murni
akan di taruh dilistbox1 dan string 'A' di delimiter(dihapus). data dilistbox1
akan diambil dan ditampilkan ke edit1, begitu berurutan untuk data setelahnya.
kok bisa? ya karena nantinya format pengiriman datanya kan untuk misal 4 sensor suhu LM35 adalah
30A40B50C60D jadi dari format itu kan yg dimasukkan ke edit1 adalah 30 aja,sedangkan string pengenal 'A'
masuk ke listbox1 trus dihapus, data sensor berurutan dari A,B,C,D}

//////////////////SENSOR 1 delimiter string 'A'////////////////////////
//////////////////////////////////////////////////////////////////////
begincomport1.ReadStr(A,1); //pengambilan data diulang trus sampai ketemu string 'A'
DataA:=DataA+A;
end;
sx:=TStringList.Create;sx.Delimiter:='A';        //string 'A' dipisah dari data
sx.DelimitedText:=DataA;  //data murni dimasukkan ke variabel DataA
listbox1.Items:=sx;       //data murni di stringlist dipindah ke listbox1
edit1.Text:=listbox1.Items[0];  //data dilistbox1 ditampilkan ke edit1
listbox1.Clear;                 //data listbox1 dihapus
//////////////////////AKHIR UNTUK SENSOR 1///////////////////////////////


//////////////////SENSOR 2 delimiter string 'B'////////////////////////
//////////////////////////////////////////////////////////////////////
repeat
begin
comport1.ReadStr(B,1);
DataB:=DataB+B;
end;
until B='B';                        //prosesnya sama seperti string 'B'
sx:=TStringList.Create;              //dan berlaku untuk string2 yg lain
sx.Delimiter:='B';
sx.DelimitedText:=DataB;
listbox1.Items:=sx;
edit2.Text:=listbox1.Items[0];
listbox1.Clear;
//////////////////////AKHIR UNTUK data SUHU////////////////

end;
///////////////////////////////////////////////////////////////////////////
//////////////////////////AKHIR INTI PROGRAM///////////////////////////////

end.
Suni

ARDUINO :: Interfacing a Load Cell With an Arduino Board

0 :: comments
Over the years, many RobotShop customers have asked us about the easiest way to interface a load cell with an Arduino board so they can get accurate weight measurements. Instruments like load cells provide small signal values and need to be amplified for processing, so without additional electronics, these sensors cannot and should not be connected directly to an Arduino’s I/O pins. Arduino boards like the UNO have a 10 bit ADC, which means that the resolution of the analog input pins are 5V/1024 ≈ 4.9mV. For this reason, variations less than 4.9mV will not be recognized by the Arduino board without the appropriate amplification and filtering. The two common approaches for interfacing a load cell with an Arduino are :
  • Amplifying the load cell’s output voltage signal (using a pre-packaged instrumentation amplifier IC like the INA125 to be processed by the Arduino’s ADC).
  • Using a High-resolution ADC which can be interfaced with the Arduino.
Luckily, there is a new option for those seeking a plug and play solution to avoid extra wiring and coding: the Strain Gauge / Load Cell Amplifier Shield. This board makes interfacing an Arduino and an instrumentation amplifier significantly easier. This stackable shield can be used with various low output sensors like load cells. It’s a low cost solution for precise amplification of measurements especially for robotics, multichannel systems, medical instrumentation, industrial process control and more.
The Load Cell Shield features an AD8426 dual channel Instrumentation amplifier. The gain produced by the AD8426 amplifier ranges from 1 to 1000 depending on the GAIN resistor value. The output voltage reference of each channel can be adjusted with the two onboard potentiometers. The shield has also a low-pass 2nd order Bessel filter at 1000Hz for both channels.
strain gauge load cell shield
Strain Gauge / Load Cell Shield

Setup and Wiring

A load cell usually has 4 wires, but it’s important to check the wiring for the unit you have:
  • Red Wire: Excitation +
  • Black Wire: Excitation –
  • Green Wire: Signal +
  • White Wire: Signal –
5 kg micro load cell
5 kg Micro Load Cell
The parts needed for connecting the load cell to the shield :
parts needed
Parts Needed
Solder the F/F jumper wires to the Load Cell wires. To avoid mixing the wires when connecting the load cell, you can choose the same color wires as those of the load cell :
sodering load cell with jumper wires
Soldering
Add heat shrink over the soldered areas:
putting heat shrink
Heat Shrink
Connect the load cell to the Load Cell Amplifier Shield:
connecting load cell to the shield
Connecting the Load cell
Stack the Load Cell Amplifier Shield on top of the Arduino board (in our case, a Lynxmotion BotBoarduino):
stacking the load cell amplifier shield to the arduino board
Stacking the Load Cell Shield
The Load Cell Shield uses analog pins A0 and A1 for Strain 1 and Strain 2 inputs respectively. The white connectors on the board are 4 pin Molex connectors with 0.1″ spacing. There are two modifications per channel that can be done to adjust the output voltage of the shield described below:

Gain

The gain of the amplification per channel is dependent on the Gain1 / Gain2 resistors. The AD8426 default gain is 1 without a gain resistor. The standard gain resistor value of the shield is 100 Ohm (for each channel) for a gain of 495. These resistors can be replaced depending on the user’s application with the appropriate ones. The gain can be calculated by using the following gain equation (from AD8426 datasheet) : Rgain= 49400/(Gain-1)
strain gauge load cell amplifier shield gain
Amplifier Gain Resistor

Reference voltage

The reference voltage feature is used to offset the output signal to a mid-supply voltage to be used with a single power supply ADC. The reference voltage can be set using the onboard potentiometers associated with each channel.
strain gauge load cell amplifier shield gain reference voltage
Channel 1 and 2 Reference Voltage

Arduino Sample Code

This Arduino Sample Code reads analog pin 0 (Strain 1) and analog pin 1 (Strain 2) so that the load cells can be calibrated by linear interpolation.


Suni

ARDUINO :: Timbangan digital menggunakan sensor load cell dan modul HX711

0 :: comments



Artikel kali ini akan membahas sistem pengukuran sederhana yang merupakan salah satu tugas kuliah Instrumentasi yaitu timbangan digital. Sistem pengukuran massa benda ini menggunakan sensor load cell, modul HX711 dan Labview sebagai penampil. Berikut ini adalah perangkat keras dari sistem:
Gambar 1. Perangkat Keras dari Timbangan Digital
Sensor yang digunakan adalah load cell 2 kg dan sebagai penguat dari keluaran sensor load cell digunakan modul HX711 yang merupakan modul penguat tegangan dan ADC (Analog to Digital Converter). Sebagai pengolah data, digunakan Arduino dan untuk menampilkan informasi nilai pengukuran digunakan LabView. Berikut ini adalah block diagram sistem:

Gambar 2. Block Diagram Timbangan Digital

Penjelasan dari tiap block adalah sbb:

    1. Load cell yang merupakan sensor transduser berat dapat merubah tekanan (force) menjadi sinyal listrik. Terdapat tiga cara load cell mengubah nilai tekanan(force) yang diterima menjadi nilai pengukuran, yaitu hidraulic load cellpneumatic load cell dan strain gauge load cell. Pada sistem timbangan digital ini digunakan strain gauge load cell. Keluaran dari sensor ini berupa tegangan dalam orde mV yang terbaca terhadap perubahan nilai resistansi yang merepretasikan berat benda.
    2. Modul HX711 adalah modul yang memudahkan kita membaca load celldalam pengukuran berat. Modul ini berfungsi untuk menguatkan sinyal keluaran dari sensor dan mengonversi data analog menjadi data digital. Dengan menghubungkannya ke mikrokontroler, kita dapat membaca perubahan resistansi dari load cell. Setelah proses kalibrasi kita akan memperoleh pengukuran berat dengan keakuratan yang tinggi.
    3. Arduino sebagai pengolah data akan membaca data output dari modul HX711. Karena output dari modul HX711 sudah dalam bentuk gram ini menyebabkan beban kerja arduino cukup ringan. Hasil pembacaan tadi selanjutnya dibulatkan dengan ketelitian 0,5 dan dikirim ke Labview.
    4. Labview akan menerima data dari arduino dan akan menampilkan data tersebut pada monitor PC.

          Si kecil modul HX711 ini menawarkan banyak kemudahan. Modul ini memiliki 3 nilai penguatan, yaitu gain 32, 64 dan 128. Namun untuk timbangan digital ini digunakan gain sebesar 128 yaitu dengan menghubungkan output sensor pada channel A modul. Modul ini menggunakan interface “two wire” yaitu clock dan data untuk berkomunikasi. Untuk memudahkan pembacaan data dari HX711, telah disediakan pula library yang dapat digunakan. Adapun kelebihan lainnya dari modul HX711 ini adalah struktur sederhana, mudah dalam penggunaan, hasil yang stabil dan reliable, memiliki sensitifitas tinggi, dan mampu mengukur perubahan dengan cepat. Untuk memperoleh informasi lebih lengkap mengenai modul HX711 silahkan lihat di sini.

          Untuk interface, anda bisa saja memilih untuk menggunakan LCD yang dirakit satu paket dengan hardware timbangan digital. Namun pada sistem ini, saya menggunakan LabView untuk menampilkan hasil pengukuran sistem. Berikut ini adalah interface dari timbangan digital menggunakan labview:

          Gambar 3. Interface sistem timbangan digital pada Labview
          Berikut diagram blok VI yang saya gunakan:


          Nah.. untuk melihat sistem secara keseluruhan, silahkan lihat video berikut ini:


          Semoga bermanfaat. :)
          Suni