load cell breakout manual
DESCRIPTION
Loadcell breakout allows an Arduino/Comet board to connect to the loadcell. It is based on the INA125P instrumentation amplifier from Texas instruments. This breakout board is intended to make the interface between the Arduino and an instrumentation amplifier easier thereby allowing various measuring devices like a loadcell to be connected.TRANSCRIPT
2011
Author: Manoj
Reviewer: Ram
Revision: 1.1
Tenet Technetronics
6/20/2011
Application Note: AN100 Load cell breakout user manual
i
Contents
Introduction
Introduction to Loadcell breakout
Hardware Overview
Loadcell breakout features
Schematic
Software Overview
Flow Chart
Pseudo code
Code
Demo Application
References and further reading
1
Introduction
Loadcell breakout allows an Arduino/Comet board to connect to the loadcell. It is
based on the INA125P instrumentation amplifier from Texas instruments. This breakout board
is intended to make the interface between the Arduino and an instrumentation amplifier easier
thereby allowing various measuring devices like a loadcell to be connected.
The breakout also provides an easy way to connect a 16x2 LCD as well as a potentiometer to
vary the gain value of the on board amplifier.
Note: A loadcell is an energy conversion device. The conversion can be to/from electrical,
electro-mechanical, electromagnetic, photonic, photovoltaic, or any other form of energy. Here
it is used to convert a force into electrical signal. The mechanical arrangement is done with
loadcell on which a load is applied and the force applied is converted electrically and the output
signal is amplified by an instrumentation amplifier INA125P (Texas instruments) before it can
be used.
Loadcells are used in several types of measuring instruments includes electronic weighbridge
force measurement, portable weigh scales etc.
2
Hardware Overview
Figure1: The loadcell breakout shield
Loadcell breakout features
Compatible shield for Arduino/comet.
Breakout comes with 16x2 LCD.
Uses INA125P instrumentation amplifier.
Adjustable gain.
3
Components overview
Table1: components overview
Components
Brief
specification
Product link
References
INA125P
instrumentation
amplifier
Single
Supply:
2.7V to 36V
Dual
Supply:
±1.35V to
±18V
http://tenettech.com/
product.php?id_prod
uct=1500
http://www.datasheetcatalog.org/datasheet
2/9/0pap54gi53u7p7a57xjpzfs0tcky.pdf
Gain adjustable
potentiometer
Resistance:
10 kilo ohm
http://tenettech.com/
product.php?id_prod
uct=1498
http://en.wikipedia.org/wiki/Potentiometer
Reset button Normal push
button
http://tenettech.com/
product.php?id_prod
uct=1499
http://en.wikipedia.org/wiki/Push-button
Extended LCD
berg
connectors
16x2 LCD http://tenettech.com/
product.php?id_prod
uct=517
http://en.wikipedia.org/wiki/Liquid_crysta
l_display
4
Schematic
Gain of the INA125 is set by connecting a single external resistor, (RG)
between pins 8 & 9.
3,5,13 pins of INA125 & 8th
pin of ATMEGA328 – Ground.
1, 2 pins of INA125 & 7th
pin of ATMEGA328 – Vcc.
23rd
pin of ATMEGA328 (analog pin) to 11th
and 12th
pin of INA125.
4th
and 15th
pin of INA125 is shorted.
Figure 2: loadcell breakout schematic
Note: the loadcell wire color coding
Figure 3: color code of load cell wire
5
Software overview
Flowchart
Initialization of LCD,
reference load A and B
Print the values
Read the Analog
values and average
Map the outputted
floating values from
reference loads(A & B)
Start
End
6
Pseudo code
Include header files for LCD
Global declaration:
For two different loads (in example load A & B).
For Analog values for loads and average analog value.
For time between readings.
Function name : setup
Return type : void
Description : serial communication initialization.
LCD initialization.
Function name : loop
Return type : void
Description : read the Analog values.
Running average for smoothening.
Call for mapping function.
Print the values.
7
code
// Load cells are linear. So once you have established two data pairs, you can interpolate the
rest.
// You need two loads of well know weight. In this example A = 0 kg. B =64 kg
// Put on load A
// read the analog value showing (this is analog val A)
// put on load B
// read the analog value B
#include <LiquidCrystal.h> //we need this library for the LCD commands
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); // initialize the library with the numbers of the
interface pins
// Enter your own analog values (without load) here
float loadA = 0; // kg
int analogvalA = 15; // analog reading taken with load A on the load cell
float loadB = 64; // kg
int analogvalB = 143; // analog reading taken with load B on the load cell
// Upload the sketch again, and confirm, that the kilo-reading from the serial output now is
correct, using your known loads
float analogValueAverage = 0;
long time = 0; //
int timeBetweenReadings = 1000; // We want a reading every 1000 ms;
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
Serial.begin(9600);
lcd.begin(16, 2); // tells Arduino the LCD dimensions
lcd.clear(); // clear LCD screen
lcd.setCursor(0,0);// set the cursor
8
void loop() {
int analogValue = analogRead(0);
// running average – We smooth the readings a little bit
analogValueAverage = 0.99*analogValueAverage + 0.01*analogValue;
// call the arduino MAP function
float load = analogToLoad(analogValueAverage);
if(millis() > time + timeBetweenReadings){
lcd.clear();
lcd.print(“Weight = “);
lcd.print(load,2);
time = millis();
}
}
float analogToLoad(float analogval)
{
// using a custom map-function, because the standard arduino map function only uses int
float load = mapfloat(analogval, analogvalA, analogvalB, loadA, loadB);
return load;
}
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x – in_min) * (out_max – out_min) / (in_max – in_min) + out_min;
}
9
Demo Application
This demo shows the Comet interacting with INA125p instrumentation amplifier to measure the
load applied on the loadcell
Figure 4: loadcell breakout
Loadcell breakout is mounted on the Comet board and LCD is connected to loadcell breakout
through the extended berg connectors
Figure 5: breakout with Comet board Figure 6: breakout with Comet board and LCD
10
The loadcell sensor with metal gauge on which the load is applied is connected to the breakout board
Figure 7: loadcell sensor with metal guage
The Arduino code for loadcell is written and uploaded to Comet board
Figure 8: Arduino sketch
The output result displays the weight applied on the load cell
Figure 9: results displayed on LCD
11
References and Further Reading
http://www.datasheetcatalog.org/datasheet2/9/0pap54gi53u7p7a57xjpzfs0tcky.pdf
http://tenettech.com/search.php?orderby=position&orderway=desc&search_quer
y=loadcell&submit_search=Search\
http://en.wikipedia.org/wiki/Load_cell.
www.arduino.cc
www.tenettech.com/comet