{"id":110359,"date":"2022-04-22T13:29:53","date_gmt":"2022-04-22T13:29:53","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=110359"},"modified":"2022-04-23T09:48:03","modified_gmt":"2022-04-23T09:48:03","slug":"esp8266-load-cell-hx711","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp8266-load-cell-hx711\/","title":{"rendered":"ESP8266 NodeMCU with Load Cell and HX711 Amplifier (Digital Scale)"},"content":{"rendered":"\n<p>In this tutorial, you&#8217;ll learn how to create a scale with the ESP8266 NodeMCU using a load cell and the HX711 amplifier. First, you&#8217;ll learn how to wire the load cell and the HX711 amplifier to the ESP8266 to build a scale. Then, we&#8217;ll show you how to calibrate the scale, and a simple example to get the weight of objects. Later, we&#8217;ll also add a display to show the measurements and a button to tare the scale.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-HX711-amplifier.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 NodeMCU with Load Cell and HX711 Amplifier Digital Scale Arduino IDE\" class=\"wp-image-110364\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-HX711-amplifier.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-HX711-amplifier.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-HX711-amplifier.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-HX711-amplifier.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Table of Contents<\/strong><\/p>\n\n\n\n<p>In this tutorial, we&#8217;ll cover the following topics:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#load-cells-intro\">Introducing Load Cells (Strain Gauges)<\/a><\/li><li><a href=\"#hx711-amplifier\">HX711 Amplifier<\/a><\/li><li><a href=\"#setting-load-cell\">Setting Up Load Cell<\/a><\/li><li><a href=\"#load-cell-hx711-esp8266-wiring\">Wiring Load Cell and HX711 Amplifier to the ESP8266<\/a><\/li><li><a href=\"#hx711-library\">Installing HX711 Library<\/a><\/li><li><a href=\"#calibrate-load-cell\">Calibrating the Scale<\/a><\/li><li><a href=\"#weighting-objects\">Weighting Objects &#8211; Code<\/a><\/li><li><a href=\"#digital-scale-esp8266\">Digital Scale with ESP8266<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"load-cells-intro\">Introducing Load Cells<\/h2>\n\n\n\n<p>A load cell converts a force into an electrical signal that can be measured. The electrical signal changes proportionally to the force applied. There are different types of load cells: strain gauges, pneumatic, and hydraulic. In this tutorial, we&#8217;ll cover strain gauge load cells.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"load cell wheatstone bridge\" class=\"wp-image-110037\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>Strain gauge load cells are composed of a metal bar with attached strain gauges (under the white glue in the picture above). A strain gauge is an electrical sensor that measures force or strain on an object. The resistance of the strain gauges varies when an external force is applied to an object, which results in a deformation of the object&#8217;s shape (in this case, the metal bar). The change of the resistance is proportional to the load applied, which allows us to calculate the weight of objects.<\/p>\n\n\n\n<p>Usually, load cells have four strain gauges hooked up in a Wheatstone bridge (as shown below) that allow us to get accurate resistance measurements. For a more detailed explanation of how strain gauges work, <a href=\"https:\/\/www.allaboutcircuits.com\/textbook\/direct-current\/chpt-9\/strain-gauges\/\" target=\"_blank\" rel=\"noreferrer noopener\">read this article<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"500\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-setup-scale-wheatstone-brifge-01.png?resize=750%2C500&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"load cell wheatstone bridge\" class=\"wp-image-110041\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-setup-scale-wheatstone-brifge-01.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-setup-scale-wheatstone-brifge-01.png?resize=300%2C200&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>The wires coming from the load cell usually have the following colors:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span class=\"rnthl rntcred\">Red<\/span>: VCC (E+)<\/li><li><span class=\"rnthl rntcblack\">Black<\/span>: GND (E-)<\/li><li><span class=\"rnthl rntclgray\">White<\/span>: Output &#8211; (A-)<\/li><li><span class=\"rnthl rntcgreen\">Green<\/span>: Output + (A+)<\/li><\/ul>\n\n\n\n<p><strong>Applications<\/strong><\/p>\n\n\n\n<p>Strain gauge load cells can be used in a wide variety of applications. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>check if an object&#8217;s weight changes over time;<\/li><li>measure the weight of an object;<\/li><li>detect the presence of an object;<\/li><li>estimate a container&#8217;s liquid level;<\/li><li>etc.<\/li><\/ul>\n\n\n\n<p>Because the changes in strain when weighting objects are so small, we need an amplifier. The load cell we&#8217;re using is usually sold together with an HX711 amplifier. So, that&#8217;s the amplifier we&#8217;ll use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"hx711-amplifier\">HX711 Amplifier<\/h2>\n\n\n\n<p>The HX711 amplifier is a breakout board that allows you to easily read load cells to measure weight. You wire the load cell wires on one side, and the microcontroller on the other side. The HX711 communicates with the microcontroller using two-wire interface (Clock and Data).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"450\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/hx711-amplifier.jpg?resize=750%2C450&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HX711 amplifier\" class=\"wp-image-110038\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/hx711-amplifier.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/hx711-amplifier.jpg?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>You need to solder header pins on the GND, DT, SCK, and VCC pins to connect to the ESP8266. I soldered the load cell wires directly to the E+, E-, A-, and A+ pins. The load cell wires were very thin and fragile, be careful when soldering to not damage the wires.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/hx711-amplifier-soldered.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HX711 Amplifier Soldered\" class=\"wp-image-110089\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/hx711-amplifier-soldered.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/hx711-amplifier-soldered.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p> <\/p>\n\n\n\n<p>For more information about the HX711 amplifier, you can consult the <a href=\"https:\/\/cdn.sparkfun.com\/datasheets\/Sensors\/ForceFlex\/hx711_english.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">HX711 datasheet<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setting-load-cell\">Setting Up the Load Cell<\/h2>\n\n\n\n<p>Our load cell kit came with two acrylic plates and some screws to set up the load cell as a scale. You can use wood plates or 3D-print your own plates.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Load-cell-hx711-amplifier-package.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"load cell hx711amplifier package\" class=\"wp-image-110039\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Load-cell-hx711-amplifier-package.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Load-cell-hx711-amplifier-package.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>You should attach the plates to the load cell in a way that creates a strain between the opposite ends of the metal bar. The bottom plate holds the load cell, and the upper plate is where you place the objects.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"332\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-setup-scale.png?resize=750%2C332&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"load cell setup scale\" class=\"wp-image-110040\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-setup-scale.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-setup-scale.png?resize=300%2C133&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>The following figure shows what my load cell with the acrylic plates looks like.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-scale-arduino.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"load cell scale\" class=\"wp-image-110091\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-scale-arduino.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-scale-arduino.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Where to Buy Load Cell with HX711?<\/h2>\n\n\n\n<p>You can check the load cell with the HX711 on Maker Advisor to find the best price (with or without acrylic plates included). There are load cells with different measurement ranges. The most common maximum weights are 1kg, 5kg, 10kg, and 20kg.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/makeradvisor.com\/tools\/load-cell-hx711-amplifier\/\" target=\"_blank\" rel=\"noopener\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"263\" height=\"186\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/load-cell-hx711-amplifier-product.png?resize=263%2C186&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Load Cell HX711 Amplifier\" class=\"wp-image-110067\"\/><\/a><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/makeradvisor.com\/tools\/load-cell-hx711-amplifier\/\" target=\"_blank\" rel=\"noreferrer noopener\">Load Cell with HX711 Amplifier<\/a><\/li><\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"load-cell-hx711-esp8266-wiring\">Wiring Load Cell and HX711 Amplifier to the ESP8266<\/h2>\n\n\n\n<p>The HX711 amplifier communicates via two-wire interface. You can connect it to any GPIOs of your chosen microcontroller. We&#8217;re connecting the data pin (DT) to <span class=\"rnthl rntclgray\">GPIO 12<\/span> (D6) and the clock pin (CLK) to <span class=\"rnthl rntcyellow\">GPIO 13<\/span> (D7). You can use any other suitable pins (<a href=\"https:\/\/randomnerdtutorials.com\/esp8266-pinout-reference-gpios\/\">check the ESP8266 pinout guide<\/a>).<\/p>\n\n\n\n<p>Follow the next table or schematic diagram to wire the load cell to the ESP8266 board.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Load Cell<\/strong><\/td><td><strong>HX711<\/strong><\/td><td><strong>HX711<\/strong><\/td><td><strong>ESP8266<\/strong><\/td><\/tr><tr><td><span class=\"rnthl rntcred\">Red<\/span> (E+)<\/td><td><strong>E+<\/strong><\/td><td><strong>GND<\/strong><\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><\/tr><tr><td><span class=\"rnthl rntcblack\">Black<\/span> (E-)<\/td><td><strong>E-<\/strong><\/td><td><strong>DT<\/strong><\/td><td><span class=\"rnthl rntclgray\">GPIO 12<\/span> (D6)<\/td><\/tr><tr><td><span class=\"rnthl rntclgray\">White<\/span> (A-)<\/td><td><strong>A-<\/strong><\/td><td><strong>SCK<\/strong><\/td><td><span class=\"rnthl rntcyellow\">GPIO 13<\/span> (D7)<\/td><\/tr><tr><td><span class=\"rnthl rntclgreen\">Green<\/span> (A+)<\/td><td><strong>A+<\/strong><\/td><td><strong>VCC<\/strong><\/td><td><span class=\"rnthl rntcred\">3.3V<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"427\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-diagram_bb.png?resize=1200%2C427&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 with Load Cell HX711 Wiring Schematic Diagram\" class=\"wp-image-110367\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-diagram_bb.png?w=1536&amp;quality=100&amp;strip=all&amp;ssl=1 1536w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-diagram_bb.png?resize=300%2C107&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-diagram_bb.png?resize=1024%2C365&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-diagram_bb.png?resize=768%2C274&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"hx711-library\">Installing the HX711 Library<\/h2>\n\n\n\n<p>There are several different libraries to get measurements from a load cell using the HX711 amplifier. We&#8217;ll use the <a href=\"https:\/\/github.com\/bogde\/HX711\" target=\"_blank\" rel=\"noreferrer noopener\">HX711 library by bodge<\/a>. It is compatible with the ESP32, ESP8266, and Arduino.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Arduino IDE<\/h3>\n\n\n\n<p>Follow the next instructions to install the library if you&#8217;re using Arduino IDE.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Open Arduino IDE and go to <strong>Sketch <\/strong>&gt; <strong>Include Library<\/strong> &gt; <strong>Manage Libraries<\/strong>.<\/li><li>Search for &#8220;<strong>HX711 Arduino Library<\/strong>&#8221; and install the library by Bogdan Necula.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"443\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-Arduino-IDE.png?resize=786%2C443&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install HX711 Bogdan Library Arduino IDE\" class=\"wp-image-110006\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-Arduino-IDE.png?w=786&amp;quality=100&amp;strip=all&amp;ssl=1 786w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-Arduino-IDE.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-Arduino-IDE.png?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/figure><\/div>\n\n\n\n<p> <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">VS Code with PlatformIO<\/h3>\n\n\n\n<p>If you&#8217;re using VS Code with the PlatformIO extension to program your boards, follow the next instructions.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>After creating a new project on PlatformIO for your board, go to the PIO Home (click on the house icon on the bottom bar). Then, click on <strong>Libraries<\/strong>. Search for <strong>HX711 <\/strong>and select the Library by bodge.<\/li><li>Then, click on <strong>Add to Project<\/strong> and select the project you&#8217;re working on.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"663\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-PlatformIO.png?resize=877%2C663&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install HX711 load cell library VS Code\" class=\"wp-image-110068\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-PlatformIO.png?w=877&amp;quality=100&amp;strip=all&amp;ssl=1 877w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-PlatformIO.png?resize=300%2C227&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/Install-HX711-Bogdan-Library-PlatformIO.png?resize=768%2C581&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/figure><\/div>\n\n\n\n<p>Now, if you go to your project folder and open the <span class=\"rnthl rntliteral\">platformio.ini<\/span> file, there should be a line to include the library as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lib_deps = bogde\/HX711@^0.7.5<\/code><\/pre>\n\n\n\n<p>Also, add the following line to change the Serial Monitor speed to 115200:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>monitor_speed = 115200<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"calibrate-load-cell\">Calibrating the Scale (ESP8266 with Load Cell)<\/h2>\n\n\n\n<p>At this time, we assume you have wired the load cell to the HX711 amplifier and the amplifier to the ESP8266. You should also have your scale set up (two plates wired on opposite ends on the load cell), and have installed the HX711 library.<\/p>\n\n\n\n<p>Before getting the weight of objects, you need to calibrate your load cell first by getting the <u>calibration factor<\/u>. Your calibration factor will be different than mine, so you shouldn&#8217;t skip this section.<\/p>\n\n\n\n<p><strong>1)<\/strong> Prepare an object with a known weight. I used my kitchen scale and weighed a glass with water (300g).<\/p>\n\n\n\n<p><strong>2)<\/strong> Upload the following code to your ESP8266. We wrote the following code taking into account the instructions to calibrate the load cell provided by the <a href=\"https:\/\/github.com\/bogde\/HX711#how-to-calibrate-your-load-cell\" target=\"_blank\" rel=\"noreferrer noopener\">library documentation<\/a>.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\r\n  Rui Santos\r\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp8266-load-cell-hx711\/\r\n  \r\n  Permission is hereby granted, free of charge, to any person obtaining a copy\r\n  of this software and associated documentation files.\r\n  \r\n  The above copyright notice and this permission notice shall be included in all\r\n  copies or substantial portions of the Software.\r\n*\/\r\n\r\n\/\/ Calibrating the load cell\r\n#include &lt;Arduino.h&gt;\r\n#include &quot;HX711.h&quot;\r\n\r\n\/\/ HX711 circuit wiring\r\nconst int LOADCELL_DOUT_PIN = 12;\r\nconst int LOADCELL_SCK_PIN = 13;\r\n\r\nHX711 scale;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);\r\n}\r\n\r\nvoid loop() {\r\n\r\n  if (scale.is_ready()) {\r\n    scale.set_scale();    \r\n    Serial.println(&quot;Tare... remove any weights from the scale.&quot;);\r\n    delay(5000);\r\n    scale.tare();\r\n    Serial.println(&quot;Tare done...&quot;);\r\n    Serial.print(&quot;Place a known weight on the scale...&quot;);\r\n    delay(5000);\r\n    long reading = scale.get_units(10);\r\n    Serial.print(&quot;Result: &quot;);\r\n    Serial.println(reading);\r\n  } \r\n  else {\r\n    Serial.println(&quot;HX711 not found.&quot;);\r\n  }\r\n  delay(1000);\r\n}\r\n\r\n\/\/calibration factor will be the (reading)\/(known weight)\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_Load_Cell\/ESP8266_Calibrate_Load_Cell.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p><strong>3)<\/strong> After uploading, open the Serial Monitor at a baud rate of 115200 and reset the ESP8266 board.<\/p>\n\n\n\n<p><strong>4)<\/strong> Follow the instructions on the Serial Monitor: remove any weights from the scale (it will tare automatically). Then, place an object with a known weight on the scale and wait until you get a value.<\/p>\n\n\n\n<p><strong>5)<\/strong> Calculate your calibration factor using the formula:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>calibration factor = (reading)\/(known weight)<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"638\" height=\"413\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/calibrate-load-cell-arduino-ide.png?resize=638%2C413&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Calibrate load cell Arduino IDE Serial Monitor\" class=\"wp-image-110048\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/calibrate-load-cell-arduino-ide.png?w=638&amp;quality=100&amp;strip=all&amp;ssl=1 638w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/calibrate-load-cell-arduino-ide.png?resize=300%2C194&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><\/figure><\/div>\n\n\n\n<p> In our case, the reading is -141449. The known weight is 300g, so our calibration factor will be: -141449\/300 = -471.497.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>calibration factor = -141449\/300 = -471.497<\/code><\/pre>\n\n\n\n<p>Save your calibration factor because you&#8217;ll need it later. Yours will be different than ours.<\/p>\n\n\n\n<p>Because the output of the sensor is proportional to the force applied to the load cell, you can calibrate your scale using whatever unit makes sense for you. I used grams, but you can use pounds, kilograms, or even pieces of cat food (<a href=\"https:\/\/youtu.be\/iywsJB-T-mU\" target=\"_blank\" rel=\"noreferrer noopener\">as in this Andreas Spiess video<\/a>).<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"weighting-objects\">Weighting Objects (ESP8266 with Load Cell)<\/h2>\n\n\n\n<p>Now that you know your calibration factor, you can use your load cell to weight objects. Start by weighing objects with a known weight and repeat the calibration process if the values are not accurate.<\/p>\n\n\n\n<p>Copy the following code to your Arduino IDE. Before uploading it to your board, don&#8217;t forget to insert your calibration factor in line 43\/44 of the code. The following code is the <a href=\"https:\/\/github.com\/bogde\/HX711\/blob\/master\/examples\/HX711_full_example\/HX711_full_example.ino\" target=\"_blank\" rel=\"noreferrer noopener\">example provided by the library<\/a> that demonstrates the use of most of its functions.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/**\r\n * Complete project details at https:\/\/RandomNerdTutorials.com\/esp8266-load-cell-hx711\/\r\n * \r\n * HX711 library for Arduino - example file\r\n * https:\/\/github.com\/bogde\/HX711\r\n *\r\n * MIT License\r\n * (c) 2018 Bogdan Necula\r\n *\r\n**\/\r\n\r\n#include &lt;Arduino.h&gt;\r\n#include &quot;HX711.h&quot;\r\n\r\n\/\/ HX711 circuit wiring\r\nconst int LOADCELL_DOUT_PIN = 12;\r\nconst int LOADCELL_SCK_PIN = 13;\r\n\r\nHX711 scale;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  Serial.println(&quot;HX711 Demo&quot;);\r\n  Serial.println(&quot;Initializing the scale&quot;);\r\n\r\n  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);\r\n\r\n  Serial.println(&quot;Before setting up the scale:&quot;);\r\n  Serial.print(&quot;read: \\t\\t&quot;);\r\n  Serial.println(scale.read());      \/\/ print a raw reading from the ADC\r\n\r\n  Serial.print(&quot;read average: \\t\\t&quot;);\r\n  Serial.println(scale.read_average(20));   \/\/ print the average of 20 readings from the ADC\r\n\r\n  Serial.print(&quot;get value: \\t\\t&quot;);\r\n  Serial.println(scale.get_value(5));   \/\/ print the average of 5 readings from the ADC minus the tare weight (not set yet)\r\n\r\n  Serial.print(&quot;get units: \\t\\t&quot;);\r\n  Serial.println(scale.get_units(5), 1);  \/\/ print the average of 5 readings from the ADC minus tare weight (not set) divided\r\n            \/\/ by the SCALE parameter (not set yet)\r\n            \r\n  scale.set_scale(-478.507);\r\n  \/\/scale.set_scale(-471.497);                      \/\/ this value is obtained by calibrating the scale with known weights; see the README for details\r\n  scale.tare();               \/\/ reset the scale to 0\r\n\r\n  Serial.println(&quot;After setting up the scale:&quot;);\r\n\r\n  Serial.print(&quot;read: \\t\\t&quot;);\r\n  Serial.println(scale.read());                 \/\/ print a raw reading from the ADC\r\n\r\n  Serial.print(&quot;read average: \\t\\t&quot;);\r\n  Serial.println(scale.read_average(20));       \/\/ print the average of 20 readings from the ADC\r\n\r\n  Serial.print(&quot;get value: \\t\\t&quot;);\r\n  Serial.println(scale.get_value(5));   \/\/ print the average of 5 readings from the ADC minus the tare weight, set with tare()\r\n\r\n  Serial.print(&quot;get units: \\t\\t&quot;);\r\n  Serial.println(scale.get_units(5), 1);        \/\/ print the average of 5 readings from the ADC minus tare weight, divided\r\n            \/\/ by the SCALE parameter set with set_scale\r\n\r\n  Serial.println(&quot;Readings:&quot;);\r\n}\r\n\r\nvoid loop() {\r\n  Serial.print(&quot;one reading:\\t&quot;);\r\n  Serial.print(scale.get_units(), 1);\r\n  Serial.print(&quot;\\t| average:\\t&quot;);\r\n  Serial.println(scale.get_units(10), 5);\r\n\r\n  scale.power_down();             \/\/ put the ADC in sleep mode\r\n  delay(5000);\r\n  scale.power_up();\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_Load_Cell\/ESP8266_Test_Load_Cell.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How the Code Works<\/h3>\n\n\n\n<p>Start by including the required libraries. We&#8217;ve included <span class=\"rnthl rntliteral\">Arduino.h<\/span> in case you&#8217;re using PlatformIO instead of Arduino IDE.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#include &lt;Arduino.h&gt;\n#include \"HX711.h\"<\/code><\/pre>\n\n\n\n<p>The following lines define the GPIOs you&#8217;ll use to connect to the HX711 amplifier. We chose GPIOs 12 and 13. You can use any other suitable GPIOs.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const int LOADCELL_DOUT_PIN = 12;\nconst int LOADCELL_SCK_PIN = 13;<\/code><\/pre>\n\n\n\n<p>Then, create an instance of the HX711 library called <span class=\"rnthl rntliteral\">scale<\/span> that you&#8217;ll use later on to get the measurements.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>HX711 scale;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">setup()<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">setup()<\/span>, initialize the Serial monitor.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.begin(115200);<\/code><\/pre>\n\n\n\n<p>Initialize the load cell by calling the <span class=\"rnthl rntliteral\">begin()<\/span> method on the <span class=\"rnthl rntliteral\">scale<\/span> object and passing the GPIOs as arguments.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);<\/code><\/pre>\n\n\n\n<p>Then, it calls several methods that you can use to get readings using the library.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span class=\"rnthl rntliteral\">read()<\/span>: gets a raw reading from the sensor<\/li><li><span class=\"rnthl rntliteral\">read_average(number of readings)<\/span>: gets the average of the latest defined number of readings<\/li><li><span class=\"rnthl rntliteral\">get_value(number of readings)<\/span>: gets the average of the last defined number of readings minus the tare weight;<\/li><li><span class=\"rnthl rntliteral\">get_units(number of readings)<\/span>: gets the average of the last defined number of readings minus the tare weight divided by the calibration factor \u2014 this will output a reading in your desired units.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.println(\"Before setting up the scale:\");\nSerial.print(\"read: \\t\\t\");\nSerial.println(scale.read());      \/\/ print a raw reading from the ADC\n\nSerial.print(\"read average: \\t\\t\");\nSerial.println(scale.read_average(20));   \/\/ print the average of 20 readings from the ADC\n\nSerial.print(\"get value: \\t\\t\");\nSerial.println(scale.get_value(5));   \/\/ print the average of 5 readings from the ADC minus the tare weight (not set yet)\n\nSerial.print(\"get units: \\t\\t\");\nSerial.println(scale.get_units(5), 1);  \/\/ print the average of 5 readings from the ADC minus tare weight (not set) divided\n\/\/ by the SCALE parameter (not set yet)<\/code><\/pre>\n\n\n\n<p>In the following line, don&#8217;t forget to insert your calibration factor. It uses the <span class=\"rnthl rntliteral\">set_scale()<\/span> method.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>scale.set_scale(INSERT YOUR CALIBRATION FACTOR)<\/code><\/pre>\n\n\n\n<p>Then, call the <span class=\"rnthl rntliteral\">tare()<\/span> method to tare the scale.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>scale.tare();               \/\/ reset the scale to 0<\/code><\/pre>\n\n\n\n<p>After this setup, the scale should be ready to get accurate readings in your desired unit. The example calls the same previous methods so that you can see the difference before and after setting up the scale.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.print(\"read: \\t\\t\");\nSerial.println(scale.read());                 \/\/ print a raw reading from the ADC\n\nSerial.print(\"read average: \\t\\t\");\nSerial.println(scale.read_average(20));       \/\/ print the average of 20 readings from the ADC\n\nSerial.print(\"get value: \\t\\t\");\nSerial.println(scale.get_value(5));   \/\/ print the average of 5 readings from the ADC minus the tare weight, set with tare()\n\nSerial.print(\"get units: \\t\\t\");\nSerial.println(scale.get_units(5), 1);        \/\/ print the average of 5 readings from the ADC minus tare weight, divided\n\/\/ by the SCALE parameter set with set_scale<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">loop()<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span>, the example calls the <span class=\"rnthl rntliteral\">get_units()<\/span> method in two different ways: to get one single reading (without any parameters) and to get the average of the last 10 readings.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.print(\"one reading:\\t\");\nSerial.print(scale.get_units(), 1);\nSerial.print(\"\\t| average:\\t\");\nSerial.println(scale.get_units(10), 5);<\/code><\/pre>\n\n\n\n<p>It shuts down the ADC that reads the sensor by using the <span class=\"rnthl rntliteral\">power_down()<\/span> method. Then, it waits for 5 seconds, powers up the ADC (<span class=\"rnthl rntliteral\">power_up()<\/span>), and the <span class=\"rnthl rntliteral\">loop()<\/span> repeats. So, you&#8217;ll get new readings on the Serial Monitor every 5 seconds.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>scale.power_down();             \/\/ put the ADC in sleep mode\ndelay(5000);\nscale.power_up();<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>Upload the code to your ESP8266 board. After uploading, open the Serial Monitor at a baud rate of 115200. <\/p>\n\n\n\n<p>Let the code run a few seconds so that it has time to set up the scale (you&#8217;ll see the message on the Serial Monitor). Then, place any object on the scale to measure it and you&#8217;ll get the results on the Serial Monitor.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"638\" height=\"554\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/ESP32-scale-demonstration.png?resize=638%2C554&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Load cell demonstration Arduino IDE Serial Monitor\" class=\"wp-image-110047\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/ESP32-scale-demonstration.png?w=638&amp;quality=100&amp;strip=all&amp;ssl=1 638w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/ESP32-scale-demonstration.png?resize=300%2C261&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><\/figure><\/div>\n\n\n\n<p>I experimented with several objects and compared them against the value on my kitchen scale, and the results were the same. So, I can say that my ESP8266 scale is at least as accurate as my kitchen scale.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"digital-scale-esp8266\">Digital Scale with ESP8266<\/h2>\n\n\n\n<p>In this section, we&#8217;ll create a simple digital scale with the ESP8266. We&#8217;ll add an OLED display to show the results and a pushbutton to tare the scale.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 Digital Scale\" class=\"wp-image-110373\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parts Required<\/h3>\n\n\n\n<p>Here&#8217;s a list of the parts required for this project:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/makeradvisor.com\/tools\/esp8266-esp-12e-nodemcu-wi-fi-development-board\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP8266 <\/a>(read <a href=\"https:\/\/makeradvisor.com\/best-esp8266-wi-fi-development-board\/\" target=\"_blank\" rel=\"noreferrer noopener\">Best ESP8266 Development Boards<\/a>)<\/li><li><a href=\"https:\/\/makeradvisor.com\/tools\/load-cell-hx711-amplifier\/\" target=\"_blank\" rel=\"noreferrer noopener\">Load Cell with HX711 Amplifier<\/a><\/li><li><a href=\"https:\/\/makeradvisor.com\/tools\/oled-display-128x64-0-96-inch\/\" target=\"_blank\" rel=\"noreferrer noopener\">I2C SSD1306 OLED Display<\/a><\/li><li><a href=\"https:\/\/makeradvisor.com\/tools\/pushbuttons-kit\/\" target=\"_blank\" rel=\"noreferrer noopener\">Pushbutton<\/a><\/li><li><a href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\" rel=\"noreferrer noopener\">10K Ohm Resistor<\/a><\/li><li><a href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\" rel=\"noreferrer noopener\">Breadboard<\/a><\/li><li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noreferrer noopener\">Jumper Wires<\/a><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Schematic Diagram<\/h3>\n\n\n\n<p>Add an OLED display and a pushbutton to your previous circuit on the following pins:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>OLED Display<\/strong><\/td><td><strong>ESP8266<\/strong><\/td><\/tr><tr><td><span class=\"rnthl rntcred\">VCC<\/span><\/td><td>3.3V or 5V*<\/td><\/tr><tr><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><td>GND<\/td><\/tr><tr><td><span class=\"rnthl rntclblue\">SDA<\/span><\/td><td>GPIO 4 (D2)<\/td><\/tr><tr><td><span class=\"rnthl rntclgreen\">SCL<\/span><\/td><td>GPIO 5 (D1)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>*connect to 3.3V or 5V depending on the model.<\/p>\n\n\n\n<p class=\"rntbox rntclblue\">Not familiar with the OLED display? Read: <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-0-96-inch-oled-display-with-arduino-ide\/\">ESP8266 OLED Display with Arduino IDE<\/a>.<\/p>\n\n\n\n<p>Wire the pushbutton via a 10kOhm pull-down resistor to <span class=\"rnthl rntcpurple\">GPIO 14<\/span> (D5). The other lead of the pushbutton should be connected to 3.3V. You can use any other suitable GPIO (check the <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-pinout-reference-gpios\/\">ESP8266 pinout guide<\/a>). <\/p>\n\n\n\n<p>You can follow the next schematic diagram to wire your parts.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"1099\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.png?resize=1200%2C1099&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 Digital Scale Schematic Diagram\" class=\"wp-image-110371\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.png?w=1286&amp;quality=100&amp;strip=all&amp;ssl=1 1286w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.png?resize=300%2C275&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.png?resize=1024%2C938&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale.png?resize=768%2C704&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">ESP8266 Digital Scale &#8211; Code<\/h3>\n\n\n\n<p>For simplicity, we&#8217;ll handle the pushbutton using a simple library that detects button presses with debouncing (so we don&#8217;t need to worry about that in our code). To write to the OLED display, we&#8217;ll use the <a href=\"https:\/\/github.com\/adafruit\/Adafruit_SSD1306\" target=\"_blank\" rel=\"noreferrer noopener\">Adafruit SSD1306<\/a> and <a href=\"https:\/\/github.com\/adafruit\/Adafruit-GFX-Library\" target=\"_blank\" rel=\"noreferrer noopener\">Adafruit GFX<\/a> libraries.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Pushbutton Library<\/h4>\n\n\n\n<p>There are many libraries with many functionalities to handle pushbuttons. We&#8217;ll use the <a href=\"https:\/\/github.com\/pololu\/pushbutton-arduino\" target=\"_blank\" rel=\"noreferrer noopener\">pushbutton library by polulu<\/a>. It is a simple library but comes with everything we need for this project. In your Arduino IDE, go to <strong>Sketch <\/strong>&gt; <strong>Include Library<\/strong> &gt; <strong>Manage Libraries<\/strong> and search for &#8220;<strong>pushbutton<\/strong>&#8220;. Install the pushbutton library by polulu.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"443\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/pushbutton-library-polulu-arduino-ide.png?resize=786%2C443&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Pushbutton Library Arduino IDE Polulu\" class=\"wp-image-110046\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/pushbutton-library-polulu-arduino-ide.png?w=786&amp;quality=100&amp;strip=all&amp;ssl=1 786w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/pushbutton-library-polulu-arduino-ide.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/pushbutton-library-polulu-arduino-ide.png?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/figure><\/div>\n\n\n\n<p>Alternatively, if you don&#8217;t want to use the library you can add the debounce code yourself (which is not difficult). For a debounce code example, in the Arduino IDE, you can go to File &gt; Examples &gt; Digital &gt; Debounce. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">OLED Libraries<\/h4>\n\n\n\n<p>We\u2019ll use the following libraries to control the OLED display. Make sure you have these libraries installed:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/adafruit\/Adafruit_SSD1306\" target=\"_blank\">Adafruit_SSD1306 library<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/adafruit\/Adafruit-GFX-Library\" target=\"_blank\">Adafruit_GFX library<\/a><\/li><\/ul>\n\n\n\n<p>You can install the libraries using the Arduino Library Manager. Go to&nbsp;<strong>Sketch&nbsp;<\/strong>&gt;&nbsp;<strong>Include Library<\/strong>&nbsp;&gt;&nbsp;<strong>Manage Libraries<\/strong>&nbsp;and search for the library name.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Installing Libraries &#8211; PlatformIO<\/h4>\n\n\n\n<p>If you&#8217;re using VS Code with the PlatformIO extension, follow the next steps to install the library:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>After creating a new project on PlatformIO for your board, go to the PIO Home (click on the house icon on the bottom bar). Then, click on <strong>Libraries<\/strong>. Search for <strong>pushbutton<\/strong> and select the Pushbutton library by Polulu.<\/li><li>Then, click on <strong>Add to Project<\/strong> and select the project you&#8217;re working on.<\/li><li>Repeat the process for the <strong>Adafruit SSD1306<\/strong> and <strong>Adafruit GFX<\/strong> libraries. Also, don&#8217;t forget to add the <strong>HX711<\/strong> library too.<\/li><\/ol>\n\n\n\n<p>In your <span class=\"rnthl rntliteral\">platformio.ini<\/span> file, you should have the following lines that include all the required libraries (also change the Serial Monitor speed to 115200).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>monitor_speed = 115200\nlib_deps = \n\tbogde\/HX711@^0.7.5\n\tpololu\/Pushbutton@^2.0.0\n        adafruit\/Adafruit SSD1306@^2.4.6\n\tadafruit\/Adafruit GFX Library@^1.10.10<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Code<\/h3>\n\n\n\n<p>Copy the following code to your Arduino IDE. Before uploading it to the ESP8266, you need to insert your calibration factor (<a href=\"#calibrate-load-cell\">obtained previously<\/a>).<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/\/ Complete project details at https:\/\/RandomNerdTutorials.com\/esp8266-load-cell-hx711\/\r\n\/\/ Library HX711 by Bogdan Necula: https:\/\/github.com\/bogde\/HX711\r\n\/\/ Library: pushbutton by polulu: https:\/\/github.com\/pololu\/pushbutton-arduino\r\n\r\n#include &lt;Arduino.h&gt;\r\n#include &quot;HX711.h&quot;\r\n#include &lt;Wire.h&gt;\r\n#include &lt;Adafruit_GFX.h&gt;\r\n#include &lt;Adafruit_SSD1306.h&gt;\r\n#include &lt;Pushbutton.h&gt;\r\n\r\n\/\/ HX711 circuit wiring\r\nconst int LOADCELL_DOUT_PIN = 12;\r\nconst int LOADCELL_SCK_PIN = 13;\r\n\r\nHX711 scale;\r\nint reading;\r\nint lastReading;\r\n\/\/REPLACE WITH YOUR CALIBRATION FACTOR\r\n#define CALIBRATION_FACTOR -478.507\r\n\r\n\/\/OLED Display\r\n#define SCREEN_WIDTH 128 \/\/ OLED display width, in pixels\r\n#define SCREEN_HEIGHT 64 \/\/ OLED display height, in pixels\r\n\r\n\/\/ Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)\r\n#define OLED_RESET     -1 \/\/ Reset pin # (or -1 if sharing Arduino reset pin)\r\nAdafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);\r\n\r\n\/\/Button\r\n#define BUTTON_PIN 14\r\nPushbutton button(BUTTON_PIN);\r\n\r\nvoid displayWeight(int weight){\r\n  display.clearDisplay();\r\n  display.setTextSize(1);\r\n  display.setTextColor(WHITE);\r\n  display.setCursor(0, 10);\r\n  \/\/ Display static text\r\n  display.println(&quot;Weight:&quot;);\r\n  display.display();\r\n  display.setCursor(0, 30);\r\n  display.setTextSize(2);\r\n  display.print(weight);\r\n  display.print(&quot; &quot;);\r\n  display.print(&quot;g&quot;);\r\n  display.display();  \r\n}\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { \r\n    Serial.println(F(&quot;SSD1306 allocation failed&quot;));\r\n    for(;;);\r\n  }\r\n  delay(2000);\r\n  display.clearDisplay();\r\n  display.setTextColor(WHITE);\r\n  \r\n  Serial.println(&quot;Initializing the scale&quot;);\r\n  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);\r\n\r\n  scale.set_scale(CALIBRATION_FACTOR);   \/\/ this value is obtained by calibrating the scale with known weights\r\n  scale.tare();               \/\/ reset the scale to 0\r\n}\r\n\r\nvoid loop() {\r\n  \r\n  if (button.getSingleDebouncedPress()){\r\n    Serial.print(&quot;tare...&quot;);\r\n    scale.tare();\r\n  }\r\n  \r\n  if (scale.wait_ready_timeout(200)) {\r\n    reading = round(scale.get_units());\r\n    Serial.print(&quot;Weight: &quot;);\r\n    Serial.println(reading);\r\n    if (reading != lastReading){\r\n      displayWeight(reading); \r\n    }\r\n    lastReading = reading;\r\n  }\r\n  else {\r\n    Serial.println(&quot;HX711 not found.&quot;);\r\n  }\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_Load_Cell\/ESP8266_Digital_Scale.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How the Code Works<\/h3>\n\n\n\n<p>Start by including the required libraries:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#include &lt;Arduino.h&gt;\n#include \"HX711.h\"\n#include &lt;Wire.h&gt;\n#include &lt;Adafruit_GFX.h&gt;\n#include &lt;Adafruit_SSD1306.h&gt;\n#include &lt;Pushbutton.h&gt;<\/code><\/pre>\n\n\n\n<p>Define the pins for the HX711 (load cell)\u2014we&#8217;re using the same as previous examples:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ HX711 circuit wiring\nconst int LOADCELL_DOUT_PIN = 12;\nconst int LOADCELL_SCK_PIN = 13;<\/code><\/pre>\n\n\n\n<p>Create an <span class=\"rnthl rntliteral\">HX711<\/span> instance called <span class=\"rnthl rntliteral\">scale<\/span>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>HX711 scale;<\/code><\/pre>\n\n\n\n<p>The following variables will hold the current weight reading and the last weight reading. We only want to update the OLED display in case there&#8217;s a new reading, so that&#8217;s why we need these two variables. Additionally, we don&#8217;t want to measure decimals of grams which will make the scale too sensitive for our application\u2014that&#8217;s why these variables are integers. If you need decimals in your measurements, you can define float variables instead.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>int reading;\nint lastReading;<\/code><\/pre>\n\n\n\n<p>Don&#8217;t forget to replace the next value with your calibration factor. In my case, that line of code looks as follows (my value is negative):<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define CALIBRATION_FACTOR -471.497<\/code><\/pre>\n\n\n\n<p>Next, we need to define the OLED width and height:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define SCREEN_WIDTH 128 \/\/ OLED display width, in pixels\n#define SCREEN_HEIGHT 64 \/\/ OLED display height, in pixels<\/code><\/pre>\n\n\n\n<p>And create an instance of the <span class=\"rnthl rntliteral\">Adafruit_SSD1306<\/span> library called <span class=\"rnthl rntliteral\">display<\/span>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);<\/code><\/pre>\n\n\n\n<p>Define the GPIO you&#8217;ll use to read the button and create a <span class=\"rnthl rntliteral\">Pushbutton<\/span> object called <span class=\"rnthl rntliteral\">button<\/span> on that pin.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#define BUTTON_PIN 14\nPushbutton button(BUTTON_PIN);<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">displayWeight() function<\/h4>\n\n\n\n<p>We created a function called <span class=\"rnthl rntliteral\">displayWeight()<\/span> that accepts as arguments the weight you want to display on the OLED.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>void displayWeight(int weight){\n  display.clearDisplay();\n  display.setTextSize(1);\n  display.setTextColor(WHITE);\n  display.setCursor(0, 10);\n  \/\/ Display static text\n  display.println(\"Weight:\");\n  display.display();\n  display.setCursor(0, 30);\n  display.setTextSize(2);\n  display.print(weight);\n  display.print(\" \");\n  display.print(\"g\");\n  display.display();  \n}<\/code><\/pre>\n\n\n\n<p class=\"rntbox rntclblue\">Not familiar with the OLED display? Read: <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-0-96-inch-oled-display-with-arduino-ide\/\">ESP8266 OLED Display with Arduino IDE<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">setup()<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">setup()<\/span>, initialize the Serial Monitor.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.begin(115200);<\/code><\/pre>\n\n\n\n<p>Initialize the OLED display:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { \n  Serial.println(F(\"SSD1306 allocation failed\"));\n  for(;;);\n}\ndelay(2000);\ndisplay.clearDisplay();\ndisplay.setTextColor(WHITE);<\/code><\/pre>\n\n\n\n<p>And finally, initialize the load cell:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.println(\"Initializing the scale\");\nscale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);\n\nscale.set_scale(CALIBRATION_FACTOR);   \/\/ this value is obtained by calibrating the scale with known weights\nscale.tare();               \/\/ reset the scale to 0<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">loop()<\/h4>\n\n\n\n<p>The pushbutton library allows us to wait for an event in case of a pushbutton press or pushbutton release. In this case, we check whether the pushbutton was pushed using the <span class=\"rnthl rntliteral\">getSingleDebouncePress()<\/span> method and call the <span class=\"rnthl rntliteral\">tare()<\/span> function if the button was pressed.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (button.getSingleDebouncedPress()){\n  Serial.print(\"tare...\");\n  scale.tare();\n}<\/code><\/pre>\n\n\n\n<p>The HX711 provides a <a href=\"https:\/\/github.com\/bogde\/HX711#non-blocking-mode\" target=\"_blank\" rel=\"noreferrer noopener\">non-blocking method to get readings<\/a>. It defines a maximum timeout to wait for the hardware to be initialized and doesn&#8217;t block your code in case the scale gets disconnected or in case of hardware failures.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (scale.wait_ready_timeout(200)) {\n  reading = round(scale.get_units());\n  Serial.print(\"Weight: \");\n  Serial.println(reading);<\/code><\/pre>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span>, we are constantly getting new readings and checking them against the latest reading. If we got a new measurement, we call the <span class=\"rnthl rntliteral\">displayWeight()<\/span> function to update the OLED display.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (reading != lastReading){\n  displayWeight(reading); \n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Demonstration<\/h3>\n\n\n\n<p>After uploading the code to your board, you can start weighing objects with your load cell. The readings will show up on the OLED display. You can tare the scale by pressing the pushbutton.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale-demonstration.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 digital scale demonstration OLED\" class=\"wp-image-110375\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale-demonstration.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-digital-scale-demonstration.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>Once again, the readings on my ESP8266 digital scale correspond to the readings on my kitchen scale.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"432\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/digital-scale-kitchen.jpg?resize=750%2C432&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 digital scale testing\" class=\"wp-image-110095\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/digital-scale-kitchen.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/03\/digital-scale-kitchen.jpg?resize=300%2C173&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial, you learned how to interface a strain gauge load cell with the ESP8266 using the HX711 amplifier. The output of the load cell is proportional to the force applied. So, you can calibrate it to be used in g, kg, ib, or any other unit that makes sense for your project.<\/p>\n\n\n\n<p>In summary, you learned how to calibrate the scale and how to get the weight of objects. You also learned how to create a simple digital scale with the ESP8266 using an OLED display to show the measurements and a pushbutton to tare the scale.<\/p>\n\n\n\n<p>We hope you found this tutorial useful to get you started with a load cell. Besides being useful to measure the weight of objects, it can also be useful in many applications like detecting the presence of an object, estimating the level of liquid in a tank, calculating water&#8217;s evaporation rate, checking if there&#8217;s food on your pet&#8217;s bowl, etc.<\/p>\n\n\n\n<p>Because of the wi-fi capabilities of the ESP8266, you can build an IoT scale using a web server to display the results on your browser&#8217;s smartphone, or <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-firebase-realtime-database\/\" target=\"_blank\" rel=\"noreferrer noopener\">save the readings on the Firebase database<\/a> and access them from anywhere, send a notification when the weight is below a certain value (via <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-send-email-smtp-server-arduino\/\">email<\/a>, or <a href=\"https:\/\/randomnerdtutorials.com\/telegram-control-esp32-esp8266-nodemcu-outputs\/\">Telegram<\/a>, for example), etc. What IoT tutorials would you like to see using the load cell? Let us know in the comments below.<\/p>\n\n\n\n<p>We have tutorials for other popular sensors that you might find useful:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-k-type-thermocouple-max6675\/\">ESP8266: K-Type Thermocouple with MAX6675 Amplifier (<strong>Temperature Sensor<\/strong>)<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-ds18b20-temperature-sensor-web-server-with-arduino-ide\/\">ESP8266 with DS18B20:&nbsp;<strong>Temperature Sensor<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-bme680-web-server-arduino\/\">ESP8266 with BME680:&nbsp;<strong>Gas, Pressure, Humidity, and Temperature<\/strong>&nbsp;<strong>Sensor<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-bme280-arduino-ide\/\">ESP8266 with BME280:&nbsp;<strong>Temperature, Humidity, and Pressure Sensor<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide\/\">ESP8266 with DHT11\/DHT22:&nbsp;<strong>Temperature, and Humidity Sensor<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-bmp388-arduino\/\">ESP8266 with BMP388:&nbsp;<strong>Altimeter Sensor<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-bh1750-ambient-light-sensor\/\">ESP8266 with BH1750&nbsp;<strong>Ambient Light Sensor<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-tds-water-quality-sensor\/\">ESP8266 with TDS Sensor (<strong>Water Quality<\/strong>)<\/a><\/li><\/ul>\n\n\n\n<p>Learn more about the ESP8266 with our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/home-automation-using-esp8266\/\">Home Automation using ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/build-web-servers-esp32-esp8266-ebook\/\">Build Web Servers with ESP32 and ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/firebase-esp32-esp8266-ebook\/\">Firebase Web App with ESP32 and ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp8266\/\">Free ESP8266 projects and tutorials<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to create a scale with the ESP8266 NodeMCU using a load cell and the HX711 amplifier. First, you&#8217;ll learn how to wire the load &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP8266 NodeMCU with Load Cell and HX711 Amplifier (Digital Scale)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp8266-load-cell-hx711\/#more-110359\" aria-label=\"Read more about ESP8266 NodeMCU with Load Cell and HX711 Amplifier (Digital Scale)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":110364,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[214,265,246,240,300,264],"tags":[],"class_list":["post-110359","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp8266","category-esp8266-project","category-esp8266-arduino-ide","category-esp8266-projects","category-0-esp8266","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/04\/ESP8266-load-cell-HX711-amplifier.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/110359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=110359"}],"version-history":[{"count":16,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/110359\/revisions"}],"predecessor-version":[{"id":110723,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/110359\/revisions\/110723"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/110364"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=110359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=110359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=110359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}