You are on page 1of 9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

LoadCellAmplifierHX711BreakoutHookupGuide
CONTRIBUTORS:
FAVORITE

SARAHALMUTLAQ,

ALEXTHEGIANT

GettingStarted
TheHX711loadcellamplifierisusedtogetmeasurabledataoutfromaloadcellandstraingauge.ThisHookupGuidewillshowyouhowtogetstartedwiththisamplifier
usingsomeofthevariousloadcellswecarryatSparkFun.

WhatYouWillNeed:
ForthissimplehookupguidewewilljustbehookingupaloadcellwiththeHX711amplifier,andshowinghowyouwouldhookupfourloadsensorswithacombinator
boardandtheHX711amplifier.Tofollowalong,youllneed:
SparkFunLoadCellAmplifierHX711
AnyStrainGaugeBasedLoadCell:

LoadCell200kg,Disc(TAS606)

LoadCell50kg,Disc(TAS606)

SEN13332

SEN13331

$56.96
2

$56.96

LoadCell10kg,StraightBar(TAL220)

LoadCell10kg,WideBar(TAL201)

SEN13329

SEN13330

$6.96
3

$11.95

Ifyouareplanningonusingloadsensors1youwillneedtoobtainorpurchasefourunits.WerecommendourCombinatorBoardtomakeiteasytoturnthefourstrain
gaugesintoawheatstonebridgetypeloadcell.(Singlestraingaugeloadcellsonlyhavethreewiresinsteadoffour.)

SuggestedReading
Ifyouarentfamiliarwiththefollowingconcepts,werecommendreviewingthembeforebeginningtoworkwiththeHX711LoadCellAmplifierBoard.
LoadCellBasics
GettingStartedwithLoadCells
InstallingtheArduinoIDE
HowtoPowerYourProject
BatteryTechnologies
HowtoSolder

1.[Straingaugesaretwowiredorganizedmetalfoilorwiresthataresetupinsuchawaythattheresistancechangeswhenitiscompressedorstretched.Whenastraingaugeisplacedonsomething(usuallymetallicinnature)its

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

1/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

1.[Straingaugesaretwowiredorganizedmetalfoilorwiresthataresetupinsuchawaythattheresistancechangeswhenitiscompressedorstretched.Whenastraingaugeisplacedonsomething(usuallymetallicinnature)its
resistancechangesbasedonthestressexperiencedbythatsomething.Whenasinglestraingaugeishookeduptoametalliccell,wearecallingthataloadsensors,whichhavethreeoutputwires.Loadcellsusuallyhasfourstrain
gaugeshookedupinawheatstonebridgeformation,whichhavefouroutputwires.Formoreinformationonloadcells,straingauges,andwheatstonebridgesseeourtutorial.]

LoadCellSetUp

Aselectionofdifferentloadcells
Dependingonthetypeofloadcellyouareusing,theconfigurationofhowitshouldbehookeduptoplatesorsurfaceswillchange.Belowareafewdifferenttypesof
setups.

Barloadcellbetweenatwoplateconfiguration

Sloadcellconfiguration

Possiblefourdiscloadcellconfigurationinsomethinglikeabathroomscale

Barstraingaugebasedloadcells
Usuallywithlarger,nonpushbuttonbarloadcellsyouwillwanttohookuptheloadcellbetweentwoplatesinaZshape,withfittingscrewsandspacerssothatthe
straincanbecorrectlymeasuredasshownbelow:

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

2/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

Notethatonlyonesideoftheloadcellisscrewedintoeachboard.Thisprovidesamomentofforce,ortorque,onthestraingaugeratherthanjustcompressionforce,
whichiseasiertomeasureandmuchmoreaccurate.

Forsmaller,pushbuttonordiscloadcells,youwillwanttomakesuretoscrewinthedisctoabottomplate(orsurfaceyouaremeasuringforceagainst),andcenterthe
beam,plate,orwhateverelseyouarewishingtomeasuretheforceofontothebuttononthetop.Usuallyanotherplatewithaholeisusedtomakesurewhateveryou
aremeasuringishittingthesamespotontheloadcelleachtime,butitisnotnecessary.
Makesuretoreadthedatasheetfortheloadcellyouareusingandgetthecorrectscrewstofitintoit.
Note:IfyouarehookingtogetherfouroftheSparkFunLoadSensorsusingtheCombinatorboard,youshouldpositionthefourloadsensorsequidistantfromeach
other,justlikethebathroomscalesshowninthistutorial.
Loadcellmeasurementscanbeoffby+/5%duetoarangeofthingsincludingtemperature,creep,vibration,drift,andotherelectricalandmechanicalinterferences.
Beforeyouinstallyourscale,takeamomentanddesignyoursystemtoallowforeasycalibrationorbeabletoadjustthecodeparameterstoaccountforthesevariations.

HardwareHookup

TheHX711LoadCellAmplifieracceptsfivewiresfromtheloadcell.ThesepinsarelabeledwithcolorsRED,BLK,WHT,GRN,andYLW.Thesecolorscorrespondtothe
conventionalcolorcodingofloadcells,wherered,black,greenandwhitewirescomefromthestraingaugeontheloadcellandyellowisanoptionalgroundwirethatis
nothookeduptothestraingaugebutistheretogroundanysmalloutsideEMI(electromagneticinterference).Sometimesinsteadofayellowwirethereisalargerblack
wire,foil,orloosewirestoshieldthesignalwirestolessenEMI.

Fourstraingauges(SG1through4)hookedupinawheatstonebridgeformation

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

3/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

Herewehavealargeblackwire,someloosewires,andfoilandloosewiresrespectivelyasEMIbuffers
InGeneral,eachloadcellhasfourstraingaugesthatarehookedupinawheatstonebridgeformationasshownabove.
Thefourwirescomingoutfromthewheatstonebridgeontheloadcellareusually:
Excitation+(E+)orVCCisred
Excitation(E)orgroundisblack.
Output+(O+),Signal+(S+)+orAmplifier+(A+)iswhite
O,S,orAisgreenorblue
Someloadcellsmighthaveslightvariationsincolorcodingsuchasblueinsteadofgreenoryellowinsteadofblackorwhiteifthereareonlyfourwires(meaningnowire
usedasanEMIbuffer).Youmighthavetoinferalittlefromthecolorsthatyouhave,butingeneralyouwillusuallyseethesecolors.
IfthereadingsfromtheHX711areoppositeofwhatyouareexpect(forexamplethevaluesdecreaseasyouincreaseweight)simplyreversetheO+/Owires.

Oncetheloadcellisishookeduptotheamplifier,youcanhookupVDD,VCC,DAT,CLK,andGNDtoamicrocontrollersuchasaRedBoardorArduinoboard.
NoteVCCistheanalogvoltagetopowertheloadcell.VDDisthedigitalsupplyvoltageusedtosetthelogiclevel.
PROTIP:Inmanycases,youcanjustshortVCCandVDDtogether.Ifyourmicrocontrolleruses3.3Vlogichowever,you'llwanttoconnectVCCto5VandVDDto
3.3V.

LoadcellwireshookeduptotheHX711Amplifierboard
TheexamplecodehasDATandCLKhookeduptopin3and2respectively,butthisiseasilychangedinthecode.AnyGPIOpinwillworkforeither.ThenVCCandVDD
justneedtobehookedupto2.75VandGNDtogroundonyourmicrocontroller.

FritzingdiagramofHX711amplifierconnectedtoaRedBoard
Now,ifyouwouldliketosetupfoursingleloadsensorswithourcombinatorboardandamplifier,connectthefivepinslabeledRED,BLK,WHT,GRN,YLWtothematching
pinsontheHX711.Next,connecteachofthefourloadsensorstothefollowingpins:
Red+
Black
WhiteC

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

4/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

Thecombinatorboardalsohasroomforan8pinRJ45socket,whichcanbeusedtoconnectyourprojectviaEthernetcablesforlongdistanceapplications.
Anothernicethingaboutourcombinatorboardisthatmosthomescalesusefoursinglestraingaugeloadsensors,sothisisahandyboardforhackingyourownscalesat
home!

Hackedhomescalesfourloadsensorshookeduptoourcombinatorboard

Exampleofasinglestraingauge,orloadsensor.HereREDisthecentertap
Forloadsensors,thereisntasetcolorcodedstandard.Comparingthescalepicturedabovewiththeloadsensorschematic,whiletheblackwiresmatched,theredand
whitewireswereswapped.Also,onlytwoofthefoursensorsusedawhitewireforthecentertapoftheloadsensor,theothertwousedgreen.Iconnectedtheblack
wiresto,theredto+,andthewhiteandgreenwirestoC.
Todeterminehowtohookupyoursinglestraingaugeloadcellstothecombinator,measuretheresistancebetweenthethreewires.Youshouldfindalargerresistance
(closetodouble)betweenapair.Inourexampletheresistancebetweenredandblackwas1.6k,andtheresistancebetweenwhite/greenandredwas800.
Therefore,thecentertaptothestraingaugeisthewhite/greenwire.ThecentertaporcenterpinofyourstraingaugeconnectstotheCpinonthecombinator.The
largerresistancewires(redandblackinthisexample)connecttothe+andpinsonthecombinator.
Thecombinatorboardhooksupthefourloadsensorsinsuchawaythattworesistorsinthewheatstonebridgeconfigurationareconstantvaluesandtheothertwoare
variableinthisway:

TohookupthecombinatorboardtotheHX711matchtheRED,BLK,WHT,andGRNpins
Onceyouhavethecombinatorboardsuccessfullysolderedtothetwelvewires,youcannowconnectittotheHX711amplifierboardviathe4standardloadcellwires.You
canuseshortjumperwiresorifyourelectronicsarealongdistanceawayfromyourscaleconsiderusinganRJ45connectorandanethernetcabletoconnectthe
combinatortotheHX711amplifier.

ArduinoCode
Nowthatyouhaveyourloadcell,amplifier,andmicrocontrollerhookedup,youcanaddyourcodeandstartcalibratingyoursetup.
Youcandownloadthemostuptodatecodeandlibrariesfromthelinkbelow.

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

5/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com
GITHUBREPOSITORY

Note:ThisexampleassumesyouareusingthelatestversionoftheArduinoIDEonyourdesktop.IfthisisyourfirsttimeusingArduino,pleasereviewoututorialon
installingtheArduinoIDE.IfyouhavenotpreviouslyinstalledanArduinolibrary,pleasecheckoutourinstallationguide.

Thefirstthingyouwillwanttoworkwithisthecalibrationcode:SparkFun_HX711_Calibration:

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

6/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

/*
ExampleusingtheSparkFunHX711breakoutboardwithascale
By:NathanSeidle
SparkFunElectronics
Date:November19th,2014
License:Thiscodeispublicdomainbutyoubuymeabeerifyouusethisandwemeetsomeday(Beerwarelicense).

Thisisthecalibrationsketch.Useittodeterminethecalibration_factorthatthemainexampleuses.Italso
outputsthezero_factorusefulforprojectsthathaveapermanentmassonthescaleinbetweenpowercycles.

SetupyourscaleandstartthesketchWITHOUTaweightonthescale
Oncereadingsaredisplayedplacetheweightonthescale
Press+/ora/ztoadjustthecalibration_factoruntiltheoutputreadingsmatchtheknownweight
Usethiscalibration_factorontheexamplesketch

Thisexampleassumespounds(lbs).Ifyoupreferkilograms,changetheSerial.print("lbs");linetokg.The
calibrationfactorwillbesignificantlydifferentbutitwillbelinearlyrelatedtolbs(1lbs=0.453592kg).

Yourcalibrationfactormaybeverypositiveorverynegative.Italldependsonthesetupofyourscalesystem
andthedirectionthesensorsdeflectfromzerostate
Thisexamplecodeusesbogde'sexcellentlibrary:https://github.com/bogde/HX711
bogde'slibraryisreleasedunderaGNUGENERALPUBLICLICENSE
Arduinopin2>HX711CLK
3>DOUT
5V>VCC
GND>GND

MostanypinontheArduinoUnowillbecompatiblewithDOUT/CLK.

TheHX711boardcanbepoweredfrom2.7Vto5VsotheArduino5Vpowershouldbefine.

*/

#include"HX711.h"

#defineDOUT3
#defineCLK2

HX711scale(DOUT,CLK);

floatcalibration_factor=7050;//7050workedformy440lbmaxscalesetup

voidsetup(){
Serial.begin(9600);
Serial.println("HX711calibrationsketch");
Serial.println("Removeallweightfromscale");
Serial.println("Afterreadingsbegin,placeknownweightonscale");
Serial.println("Press+oratoincreasecalibrationfactor");
Serial.println("Pressorztodecreasecalibrationfactor");

scale.set_scale();
scale.tare();//Resetthescaleto0

longzero_factor=scale.read_average();//Getabaselinereading
Serial.print("Zerofactor:");//Thiscanbeusedtoremovetheneedtotarethescale.Usefulinpermanentscaleprojects.
Serial.println(zero_factor);
}

voidloop(){

scale.set_scale(calibration_factor);//Adjusttothiscalibrationfactor

Serial.print("Reading:");
Serial.print(scale.get_units(),1);
Serial.print("lbs");//ChangethistokgandreadjustthecalibrationfactorifyoufollowSIunitslikeasaneperson
Serial.print("calibration_factor:");
Serial.print(calibration_factor);
Serial.println();

if(Serial.available())
{
chartemp=Serial.read();
if(temp=='+'||temp=='a')
calibration_factor+=10;
elseif(temp==''||temp=='z')
calibration_factor=10;
}
}

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

7/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

Onceyouhavecalculatedyourcalibrationfactorofyourloadcellsetup,youcanmoveontoothercode,suchasthesimplescaleoutputexamplecode,
SparkFun_HX711_Example:
/*
ExampleusingtheSparkFunHX711breakoutboardwithascale
By:NathanSeidle
SparkFunElectronics
Date:November19th,2014
License:Thiscodeispublicdomainbutyoubuymeabeerifyouusethisandwemeetsomeday(Beerwarelicense).

Thisexampledemonstratesbasicscaleoutput.Seethecalibrationsketchtogetthecalibration_factorforyour
specificloadcellsetup.

Thisexamplecodeusesbogde'sexcellentlibrary:https://github.com/bogde/HX711
bogde'slibraryisreleasedunderaGNUGENERALPUBLICLICENSE

TheHX711doesonethingwell:readloadcells.Thebreakoutboardiscompatiblewithanywheatstonebridge
basedloadcellwhichshouldallowausertomeasureeverythingfromafewgramstotensoftons.
Arduinopin2>HX711CLK
3>DAT
5V>VCC
GND>GND

TheHX711boardcanbepoweredfrom2.7Vto5VsotheArduino5Vpowershouldbefine.

*/

#include"HX711.h"

#definecalibration_factor7050.0//ThisvalueisobtainedusingtheSparkFun_HX711_Calibrationsketch

#defineDOUT3
#defineCLK2

HX711scale(DOUT,CLK);

voidsetup(){
Serial.begin(9600);
Serial.println("HX711scaledemo");

scale.set_scale(calibration_factor);//ThisvalueisobtainedbyusingtheSparkFun_HX711_Calibrationsketch
scale.tare();//Assumingthereisnoweightonthescaleatstartup,resetthescaleto0

Serial.println("Readings:");
}

voidloop(){
Serial.print("Reading:");
Serial.print(scale.get_units(),1);//scale.get_units()returnsafloat
Serial.print("lbs");//Youcanchangethistokgbutyou'llneedtorefactorthecalibration_factor
Serial.println();
}

CheckouttheotherexamplecodeintheGithubrepoforpoweringdowntheHX711(github)andknownzerostartup(github).

ResourcesandGoingFurther
Wanttoknowmore?Checkoutthistutorialifyouhaventalready:

GettingStartedwithLoadCells
JUNE11,2015
Atutorialdefiningwhataloadcellisandhowtouseone.

YoumayalsobeinterestedinlearningabouttheOpenScale.

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

8/9

11/2/2016

LoadCellAmplifierHX711BreakoutHookupGuidelearn.sparkfun.com

OpenScaleApplicationsandHookupGuide
JULY22,2016
OpenScaleallowsyoutohaveapermanentscaleforindustrialandbiological
applications.LearnhowtousetheOpenScaleboardtoreadandconfigure
loadcells.

Needevenmore?Checkoutthisawesomearticlewheatstonebridgesandloadcelltypes.
Forsomeinspiration,checkouttheSparkFunIoTBeehive:
TheInternetofBees:AddingSensorstoMonitorHiveHealth
AndstayuptodatewiththeOpenScalebyfollowingitonGitHub:
InternetofBeesGitHubRepository

https://learn.sparkfun.com/tutorials/loadcellamplifierhx711breakouthookupguide

9/9

You might also like