ESP8266: Turn a $9 Body Scale into a Smart Scale – Part 1

Do you like this post? A regular project like the PlaneSpotter Color takes many hours of my free time to develop and maintain. Would you offer me a beer for my hard work if I was your neighbour? Modern technology called teleportation makes it easy to send me a beer. Just click here. Thank you!

In this project I will show you how you can build yourself a fancy Withings-like body scale. I divided the article into two parts: Part 1 describes the hardware hack and Part 2 the software. In this project I used a cheap scale I bought in the local super market for 9 Swiss Francs (which is currently about USD $9.-) and I am optimistic that other digital scales will work for you as well. This project was a lot of fun since I had to do reverse-engineering, soldering, programming and (optionally) even 3D modelling and printing. I hope you will enjoy it as much as did!

Splash Screen of the SmartScale
Splash Screen of the revamped SmartScale

Before we begin

Just a little word of warning: you might  be taking apart a working digital body scale. I cannot guarantee that your retrofitting will actually work and you might end up having just a broken body scale. Because of this I recommend that you are using a cheap or old digital scale rather than an expensive working one…
The other thing I’d like to mention: it took me many hours of my scarce free time to build and document this project. While I am not depending on income from this blog I still very much appreciate teleported beer (donation), you following one of my affiliate links or buying something from my shop. Thank you!
This is a write up of a project I started about a year ago. The project went back onto my “work-in-progress stack” and was waiting for a revival. Back then I also wrote a quick article about it.

What you will need

The components I used in my project set me back between USD $30-40 including the body scale. The following list should give you an idea what components you’ll need and what you should be looking for.

ImageDescriptionWhere to buy
Original Digital Body ScaleDigital Body Scale: It is very practical if you can build your smart scale project on an existing digital scale. From what I can tell modern digital scales all use the same kind of sensor (load cell) but I cannot guarantee itSwitzerland: Coop.
IKEA also has a low-cost scale: IKEA
Wemos D1 MiniThe ESP8266 module is the next important component. It is the brain and mouth of your smart scale. I recommend a small development module like the Wemos D1 Mini: it has enough pins and is smallBanggood
HX711 Amplifier ModuleThe HX711 module is a so called Load Cell Amplifier and will convert the weak analog signal from the weight sensor into bits and bytes the ESP8266 can understand.Banggood
LifePo4BatteriesPower Source - I picked a Lifepo4 AA-type battery since it provides the perfect voltage and has a considerable amount of capacity. The AA packaging (14500) also helps to buy or 3d print a good holder. If you don't own a 3d printer also buy a AA-cell holderAliExpress
SSD1306 0.96" OLED displayThese OLED displays are just wonderful: since the pixels glow by themselves the contrast is very high. You can choose between the 0.96 inch SSD1306 display or the 1.3 inch SH1106 one. The smaller one you can buy in the Squix Shop, the other you'll have to order from AliExpress or similar0.96" Oled Display:
1.3" Oled Display:

Besides these “core” components you will also require wires, solder and solder iron, screw drivers.

Understanding the Body Scale

So here is the plan: you open up your pretty body scale, remove everything you don’t need and keep the load cells (the components which measure the weight) in place. Then you connect the load cells to your HX711 amplifier module and connect the amplifier to your ESP8266. Then you’ll need to attach the OLED display to the ESP8266 as well and bring in some kind of power source with an on-off switch. Easy, isn’t it?

The mini PCB I re-used. Now I just had to connect the four wires to the HX711 (click to zoom)

For me the hardest part was to figure out how the load cells should be connected to the HX711. Luckily the load cells were attached to a mini PCB which in turn was soldered with only a few pins to the main board of the body scale. So I only had to figure out how to connect the four pins of the mini PCB to the HX711 module rather than figuring out how to connect the 12 wires of the load cells (3 wires and 4 load cells). I don’t know how your scale will look like. Maybe you will be lucky as well but it also could be that you have to do some hard core reverse engineering. Maybe the following pictures will help.

Load Cell Wiring (click to zoom)
Load Cell Wiring (click to zoom)

I suggest that you test the setup on a bread board before you take out the soldering iron. This way you can easily switch the wires until everything works. SparkFun has a very good introduction to load cells and the HX711: Sparkfun Load Cell Tutorial


Connecting the load cells and the HX711 Amp

Now that we (hopefully) have figured out how to use the existing load cells we have to connect them to the amplifier and the amplifier to the ESP8266.

The mini PCB that came with the digital scale connected to the HX711
A look to the other side of the boards: mini PCB connected to the HX711. I drew the labels V+, V-, S+ and S- on the mini PCB. Sometimes you see this naming scheme

Again, how you connect the load cells to the HX711 requires a bit of educated guessing. Read through the previous chapter, read the SparkFun tutorial about load cells, use the color codes of the wires. Then connect the HX711 to the ESP8266. The following image is just a zoomed in version of the complete wiring below:

Zoomed in sketch of the HX711 wiring. See full picture below (Click to zoom)
HX711 wiring. See full sketch below (Click to zoom)

Connecting the OLED display

If you are familiar with my WeatherStation project or the ESP8266 based plane spotter then the wiring of the OLED display should be straight forward. Just connect VCC on the display with 3V3 on the ESP8266, GND with GND, SDA on the display with D6 on the ESP and SCL with D7. In theory you can choose any D-pin for SDA and SCL, just make sure that they don’t have special functions. I think D8 is required for programming, others might be used for flash access. Also when you use the pins I suggest here you won’t have to change anything with my code. Please have a look at the complete sketch below for a graphical representation of the setup.

Connecting the power source

Now to my new favourite power source in the ESP8266 world: the LiFePo4 AA battery. After watching the excellent video of my fellow (Swiss) country man Andreas Spiess about ESP8266 battery sources I immediately ordered a few from AliExpress. The beauty is that their voltage range matches the 3V3 operation voltage of the ESP8266 perfectly. You don’t need any linear voltage regulator or boost up/down converter which just turn a considerable part of the battery’s capacity into heat. The discharge characteristic of the LiFePo4 also shows that it keeps providing a ESP8266 compatible voltage over a long time. For simplicity (and due to lack of necessary skills;-)) I decided to use a switch which was already built into the scale as on/off switch. An automatic power-saving circuit would have been nice but that would have complicated the project even more. In the original setup the built-in switch could be used to change between pounds and kilograms, now it will serve as the power switch.

The complete hardware setup

The following diagram shows you how to connect all the components together. As suggested earlier I recommend that you wire everything up on a breadboard first. In the next chapter we will to a first smoke test and also a quick calibration of the sensors. Let me know when you are ready;-).

Smart Scale Setup: HX711 - ESP8266 (Wemos D1 Mini) - SSD1306/ SH1106 - LiFePo4 battery
Smart Scale Setup: HX711 – ESP8266 (Wemos D1 Mini) – SSD1306/ SH1106 – LiFePo4 battery (click to zoom)

Smoke Test and Calibration

While I use the term “smoke test” quite often in my daily software engineering routine I only learned recently that the expression originates from electronics: if you turn the device on and there is no smoke coming from the circuit you passed the first phase.

Let’s do a bit more and use a little program to see if the load cells are responding. While the “real” smart scale project will be using the Platformio environment I decided to use the Arduino IDE for this smoke test. This way you will have a starting ground even if you don’t get adjusted to the Platformio IDE. OK? So let’s get started:

  1. If you haven’t done so, install the latest Arduino IDE. I am currently using 1.6.9
  2. Download this library as zip file: and add the zip to the Arduino IDE by Sketch > Include Library… > Add .ZIP library…
  3. For the testing of the OLED display also make sure you have my OLED library installed: Sketch > Include Library > Manage libraries… Search for “ESP8266 Oled Driver for SSD1306 display” by Daniel Eichhorn and Fabrice Weinberg. At the time of writing the last version is 3.2.6
  4. Compile and upload the following code:
    #include <HX711.h>
    // Scale Settings
    const int SCALE_DOUT_PIN = D2;
    const int SCALE_SCK_PIN = D3;
    void setup() {
      scale.set_scale();// <- set here calibration factor!!!
    void loop() {
      float weight = scale.get_units(1);
      Serial.println(String(weight, 2));
  5. Now check the serial monitor. If you see some non-static numbers then the HX711 is probably setup correctly.
  6. Now to calibration. Basically you have to use a known weight and adjust the values by a certain factor. I used my kitchen scale and two tetra packs of milk which weight 2.120kg. Put the same weight on the body scale, take the readings and use the result of the reading divided by the expected value as factor in set_scale(..). If that was confusing, check out the following pictures. Note: at a later stage you should repeat calibration with bigger weights than just two kilograms, e.g. your own weight. This should increase accuracy…
Uncalibrated output. You have to call the set_scale with the proper factor
Uncalibrated output. You have to call the set_scale with the proper factor (click to zoom)


Kitchen Scale with two tetra packs of 2.12kg as a calibration value
Kitchen Scale with two tetra packs of 2.12kg as a calibration value


Calibrated output. Now the serial monitor shows the correct values in kg
Calibrated output. Now the serial monitor shows the correct values in kg (click to zoom)

And now as a last step of the smoke test let’s use the OLED display to show the weight:

// change if your are using SSD1306
//#include <SSD1306Wire.h>
#include <SH1106Wire.h>
#include <OLEDDisplayFonts.h>
#include <HX711.h>

// Scale Settings
const int SCALE_DOUT_PIN = D2;
const int SCALE_SCK_PIN = D3;

// Display Settings
const int I2C_DISPLAY_ADDRESS = 0x3c;
const int SDA_PIN = D6;
const int SDC_PIN = D7;


// change if your are using SSD1306
SH1106Wire        display(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN);
//SSD1306Wire      display(I2C_DISPLAY_ADDRESS, SDA_PIN, SDC_PIN);

void setup() {
  scale.set_scale(-47941.0 / 2.122);

void loop() {
  String weight = String(scale.get_units(1), 2);
  display.drawString(0, 0, weight);
Simple weight output on the OLED display. Smoke test successful!
Simple weight output on the OLED display. Smoke test successful!

If you see now a frequently updated number on the OLED display then: congratulations! You have successfully destroyed a working body scale, removed a lot of parts and put new ones in and it works again! (Why did we do this again!?!)

Optional: 3D Printed Parts

There is a saying: when you have a hammer, everything looks like a nail. Well, my current hammer is a Printrbot Play and I am constantly looking for justifications why I spent (only) 400 bucks on a useless machine (my wife thinks so;-)). It so happens that I found two “nails” for 3D printing in this project: The AA battery holder and the foot mounts. The battery holder will accommodate the LiFePo4 battery, while the foot mounts became necessary since there wasn’t enough space beneath the scale for the battery. The battery holder is a wonderful parametric OpenScad project from Thingiverse: Since I only had a single cell I parametrized the print accordingly. The foot mounts I designed myself in OpenScad using the measurements from a digital caliper.

3D printed AA battery holder for a single cell from Thingiverse (click to zoom)
3D printed AA battery holder for a single cell from Thingiverse (click to zoom)


3D printed foot mount
3D printed foot mount


Foot Mount designed in OpenScad
Foot Mount designed in OpenScad


Hot glued battery holder, foot mount and IKEA gliders on the bottom of the scale
Hot glued battery holder, foot mount and IKEA gliders at the bottom of the scale

Summary and Outlook

This was part 1 of the SmartScale write-up which explained you the hardware setup. After working through this article you now have hopefully a working but still pretty dumb body scale. In part 2 I will guide you through the software setup. If you don’t want to miss it please sign up for my Newsletter here. You will only ever receive emails related to my project:

A few features that the SmartScale will have:

  • Over-the-Air Update: Just turn on the body scale in the bathroom and deploy a new version of the software
  • Blynk App Integration: see wonderful historical statistics and live data on your smart phone
  • Change between Kilograms and Pounds through the Blynk App
  • Energy saving mode: turn off the HX711 and the NodeMCU after 5min of inactivity. This will not be perfect but better than burning through the battery as quickly as possible;-)
  • Displaying the Weather Forecast, so that you know which clothes to pick after the shower
  • Do simple settings by using the load cell as input device
Over-The-Air Update
Live and historical data on your Smartphone by using Blynk
Weather ForeCast download from the internet
Choose the user by carefully applying the correct weight on the scale
Posted by squix78


  1. Hello Dani,
    cool thing and a rather fascinating story! If I did not already have one kit I would order one…
    But one thing: On the label stuck on the bag is written “NodeMCU V3” but in the text description you write “NodeMCU V1”.
    Perhaps you can sync this?
    Best regards and successful business!

  2. Hi Daniel;

    Awesome! I got my kit and I loaded up the WeatherStation sketch and everything was working 🙂

    I then went on to add the DHT11 code and that’s when things stopped working. I suspect the firmware was over written or something bad … bricked I suspect.

    From the Arduino IDE …

    warning: espcomm_send_command: didn’t receive command response
    warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
    error: espcomm_upload_mem failed
    error: espcomm_upload_mem failed

    I then went on to try and reflash the NodeMCU firmware using ESP8266Flasher.exe … from there I get ..

    Note:Serial port connected.
    Note:Begin find ESP8266.
    Note:ESP8266 ACK success.
    Note:ESP8266 ACK success.
    Error:Set ESP8266 Address timeout.

    Similar problems directly from the esptool

    c:\Python27\Scripts> –port com5 write_flash -fm dio 0x00000 nodemcu_integer_0.9.5_20150318.bin v1.2.1

    A fatal error occurred: Timed out waiting for packet header

    … in fiddling around the board is alive .. it does send this out the serial port at 75K baud… could it be a baud rate issue? I assume not as I understand it’s autobaud detecting.

    ets Jan 8 2013,rst cause:2, boot mode:(3,7)

    Questions –

    o Do you have any suggestions on next steps?

    o Could it be power? I gather power is important for FTDI boards but the NodeMCU has the 3v3 regulator and it’s running off a PC with “good” USB current .. and it did work fine before it did not 😉

    o I’ve had no success in pressing the RST and FLASH buttons — I as I understand them, the RST/CTS lines put the board into to bootloader mode at any rate .. thoughts?

    … thoughts?

    1. Hi David

      Here sone thoughts
      – try another USB cable, the can be reason for your symptoms
      – try another USB port or restart your PC (or Mac?) I had situations where my Mac would only show the device after a restart
      – unplug the DHT11. Maybe your wiring is wrong and you accidentally switched VCC and Ground. Not sure about the longterm effects of such a switch. Such a switch was actually the only way I could ever brick an ESP8266

      If these tips don’t help feel free to get back to me

      Cheers, Dani

      1. Thanks Daniel —

        I’ve tried multiple USB cables and multiple USB ports (Windows).

        I did go back to just the bare board .. no display and no DHT11.

        I’m now trying to see it the ESP AT command set even works … and no luck there yet. I do get this when I press the reset button so it is alive a least a bit 😉

        ets Jan 8 2013,rst cause:2, boot mode:(3,7)

        but nothing in response to AT ….


        Cheers David

        1. According to this post it might have to do something with your reset pin:
          I’m not sure what that means;-).
          With which baud rate are you trying to flash the ESP? I your example from your last comment you did auto-sensing, right? Try to use a fixed lower rate like like 115200 or 57600. It often is something like the “-b” parameter.

          When you say you went back to the AT firmware: so did you manage to flash the AT firmware? After flashing the ESP8266 with the new firmware the AT binary has been replaced…

  3. Thanks Daniel — I just received another NodeMCU board as I’ve wasted enough time on the dead one 😉 If I manage to get the dead one working again, I’ll let you know.

    HNY, David

  4. Thanks Daniel, You sent me a trial kit and I purchased 2 others from Amazon. Some minor problems (outlined in Bryan Miller’s comments on Amazon). it works great but I still could use a fix to be able to get the screen to reverse from top to bottom your current variable didn’t work.

    I also located a free case plan that I had 3D printed and it fits and looks good. I found a local printer and picked it up today ($9) and it was a good fit, BUT the pins to hold the OLED were slightly out of register. I think I’ll have to cut them off and tape or glue the display in place. There is a ledge for it to fit in so i don’t think that will be a problem. I’m going to get another one printed for my local (Grand Rapids , MI USA) and I sent the plans off to my son in Atlanta, GA USA for him to use. I built the Squix kit with them over our Thanksgiving Holiday and now it will have a much better case than the plastic box it came in. Thanks for your good work and I did send off a tip. This case fits the slightly smaller SQUIX version of ESP8266 -12E. for the plans

  5. I have my kit, and am following the directions, but even after 4 cable swaps, verifying all setting from the getting started guide, and checking my IDE for errors, I cannot seem to get a valid up load.

    The error I encounter is espcomm_upload_mem failed;

    Now I verified that the chip on the board shows a CP2102, so that is the USB driver I installed;
    I restarted my computer (windows 10) to ensure driver is loaded;
    I see a com3 show up when I apply power with the USB cable, so that is the port i chose;
    I loaded the libraries as indicated, and select the board nodeMCU 1.0

    I also updated from the 1.6 to the 1.8 arduino IDE too;

    I am lost to what else I can do to get the base sketch uploaded?

    1. Hi. From distance it indeed sounds like you did everything fine. On one hand it is a good sign that the COM port shows up is a very good sign, it means that you have the correct driver installed. On the other hand there are reports of problems with the CP2102 on Windows 10. Could you check please if you have the latest driver? See these forum posts:
      Feel free to contact me again if that should not solve the problem, please also let me know if it does so I can adjust the instructions…


      1. Daniel,

        I did download from that site the latest drivers, then I un-installed and re-installed just to be safe. That did not cure it, but I also think you have pointed me in the right direction, I duplicated the installation on an adjacent windows 10 computer and have the same result. Both computers can reach an Arduino UNO with no problem (from the same USB port), so I will continue to explore the device drivers. Thanks for your response! Once I resolve this, I will advise you for your documentation.



        1. Daniel, happy to report that the drivers with Windows 10were fine. Unfortunately the nodeMCU appears to be bad. I ordered a couple more of these and they came in todays’ mail; I plugged one in to the windows 10 system and it fired right up tonight. Now I can add the sensor and the oled and play, woo-hoo!

          Thanks again for your quick response!

          Kentucky, USA

  6. Only ever been using 8266 as a wifi board for an arduino. This sounds much more interesting.
    I really want to buy your handy box, but I live in Sweden. Any chance of finding way for us Europeans?

    1. Hi again,
      I now noticed that you also had your own shop. Order is now completed. Please disregard the above. Thanks.

    1. Very nice. I was hoping that the winds could be included and looks like you nailed it with an arrow and value. Still waiting for my color display in the mail so can’t wait to see how it works.

    2. Am having trouble compiling your code, keep getting the following error:
      Arduino: 1.8.1 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 160 MHz, 115200, 4M (3M SPIFFS)”

      Build options changed, rebuilding all
      C:\Users\Danny\Documents\Weather Station Bodmer\esp8266-weather-station-color-masterbodmer\esp8266-weather-station-color-master\esp8266-weather-station-color\esp8266-weather-station-color.ino:44:58: fatal error: TFT_ILI9341_ESP.h: No such file or directory

      #include // Hardware-specific library


      compilation terminated.

      exit status 1
      Error compiling for board NodeMCU 1.0 (ESP-12E Module).

      This report would have more information with
      “Show verbose output during compilation”
      option enabled in File -> Preferences.

      I have all the libraries loaded, but still cannot determine why I am getting this compile error. I have set up the display wiring according to your example.

      1. Bodmer thanks for your post on the fork of Daniel weather station color. I must have had some garbage in my IDE folder, have corrected the problem and have your version up and running. Thanks again to you and Daniel.

  7. Hi, there! considering the shortage on IL9431 display (even Banggood) and some vendors sending IL9225 (176×220) to anyone, is someone worked/working or willing to work on porting the code to use such display even sacrificing some graphic features? I can start to work from zero but my time availability is so short that to the time of progress it will be too late or other more thrilling things will be out there.

    1. This is an issue introduced with an update to the Adafruit ILI9341 library I believe. Try reverting back to a previous version (1.0.2 worked I think). I ran into this a month or so ago and it took the better part of a day to track it down. The issue may have been fixed recently, but I haven’t tried the most recent release of the library.

  8. Funny. I just two boards of which I think are ESP-01s. I can’t understand the comment about shorts in a breadboard. Their 8-pin connectors have 2.54mm or 0.1″ pitch. So they’ll fit well into a common breadboard.

  9. I uploaded the World Clock demo an hour ago and noticed at 10:30pm CDT it was showing New York time as 15:30. What caused this? Where is the time zone (+ or – hours from UTC, and DST enable/disable) information set? Now as I type this at 11:40pm, it is now showing NY time as 00:40. What happened to correct the NY time (I assume the other world times were and still are correct)?

  10. Hello, I’ve tried the trick to power the screen through the digital pin and I’ve run into trouble : my wemos was not able to communicate by serial link anymore. Moreover, the final size is so small that the USB cable is heavier than it and I’ve difficulties to maintain the whole assembly on my desk, turned to my direction.

Leave a Reply