Академический Документы
Профессиональный Документы
Культура Документы
Contents
Introduction
Introduction to Loadcell breakout
Hardware Overview
Loadcell breakout features Schematic
Software Overview
Flow Chart Pseudo code Code
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.
Hardware Overview
Components overview
Components
References
INA125P Single instrumentation Supply: amplifier 2.7V to 36V Dual Supply: 1.35V to 18V Gain adjustable Resistance: potentiometer 10 kilo ohm
Reset button
Normal push http://tenettech.com/ http://en.wikipedia.org/wiki/Push-button button product.php?id_prod uct=1499 http://tenettech.com/ http://en.wikipedia.org/wiki/Liquid_crysta product.php?id_prod l_display uct=517
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. th 1, 2 pins of INA125 & 7 pin of ATMEGA328 Vcc. rd th th 23 pin of ATMEGA328 (analog pin) to 11 and 12 pin of INA125. 4th and 15th pin of INA125 is shorted.
Software overview
Flowchart
Start
End
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.
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
void loop() { int analogValue = analogRead(0); // running average We smooth the readings a little bit analogValueAverage = 0.99*analogValueAverage + 0.01*analogValue;
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; }
Demo Application
This demo shows the Comet interacting with INA125p instrumentation amplifier to measure the load applied on the loadcell
Loadcell breakout is mounted on the Comet board and LCD is connected to loadcell breakout through the extended berg connectors
The loadcell sensor with metal gauge on which the load is applied is connected to the breakout board
The Arduino code for loadcell is written and uploaded to Comet board
The output result displays the weight applied on the load cell
10
11