19.01.2026

HX711 Load Cell - MIDI Controller

Arduino
HX711 Load Cell - MIDI Controller

Table of contents

Introduction What is a Load Cell? When would you use a load cell? HX711 Load Cell Amplifier Simple reading example HX711 Midi Controller Project Converting Weight to MIDI Data
Table of contents
Introduction What is a Load Cell? When would you use a load cell? HX711 Load Cell Amplifier Simple reading example HX711 Midi Controller Project Converting Weight to MIDI Data

Introduction

We’ve all stepped on a scale at some point in our lives, taking a quick peek at our own weight. Or, before a flight, your luggage was weighed in at some point. Sometimes in your kitchen, portioning the ingredients. With so many modern scales being digital, most of them have one key element in common: load cells.

As microcontrollers get more powerful and affordable, and as sensor modules become easier to integrate, technologies which were once reserved for commercial and industrial weighing systems are now available on a simple breakout board sitting on your desk. That means you can implement accurate, real-world weight measurements into your own DIY projects.

In this article you will learn about how load cells work. How to use HX711 Load Cell Amplifier and connect it with a load cell to get basic weight readings. In the end, we’ll show you a fun little project where you can apply sound filters to a tone based on the weight input from the load cell.

What is a Load Cell?

A load cell is a type of transducer that converts a force (compression, tension or torque) into a measurable electrical signal. The magnitude of this signal is directly proportional to the applied force which is then converted into a readable output like a weight on a scale.

A typical load cell consists of two parts: the main body and an attached electrical circuit. The main body is what bears the weight or force and accounts for most of the load cell’s size. To ensure reliability and predictable strain distribution, it is usually made from high-grade steel or aluminium. 

The electrical circuit is housed within the load cell, tightly bonding to the main body. The circuit includes strain-gauges which are specialised parts of the circuit designed to sense the deformations of the main body (when force is applied).

Strain gauges consist of thin, conductive wire or foil. When stretched or compressed along their length, their electrical resistance changes slightly, allowing us to detect tiny deformations - and ultimately converting physical force into electrical signals.

When would you use a load cell?

A load cell measures mechanical force, primarily the weight of objects. Today, almost all digital weighing scales use load cells because of the accuracy with which they can measure weight. They are used in a variety of fields that demand accuracy and precision. There are different classes to load cells, and each class is different in terms of accuracy and capacity.

HX711 Load Cell Amplifier

The HX711 load cell amplifier is designed to take a weaker electrical signal from a load cell and amplify it so that the digital signal can then be processed by a microcontroller. The HX711 amplifier operates with high resolution and low power consumption, making it ideal for applications like weighing scales and force measurement systems.


The HX711 has two differential input channels that can interface directly with a load cell. It measures the small voltage changes produced by the load cell under pressure. It uses  24-bit A/D conversion to convert the amplified analog signal into a high resolution digital signal. This provides accurate measurements with minimal noise interference. Once the signal is converted, it transmits the digital data via serial interface.

Simple reading example

Now we’ll walk through how to use the load cell and the amplifier to get simple weight readings. Our HX711 amplifier board comes in two versions:

  • Standard version - uses serial interface for communication, the two primary pins are Data (DOUT) and Clock (PD_SCK)
  • I2C version - uses Qwiic/easyC cable for communication (default address 0x30)

Connecting the Load cell with the HX711:

Load cell wires

HX711 breakout board

Red

E+

Black

E-

Green

A-

White

A+

After you’ve connected the load cell with the amplifier board, now we can dive into the code example. In these examples we will be using HX711 Arduino library.

Code example:

Below is the code for reading weight in a set unit. But, before reading values from the laid cell in units, we need to do one test measurement to calibrate the scale:

  1. Get an object which you know the weight of (for example, a 0.5kg weight)
  2. Run this sketch, don't change the SCALE_UNITS value for now
  3. After running the sketch, place the known weight on the load cell
  4. Note the displayed value, let's call it X
  5. Your SCALE_UNITS is X / known weight, set it to that
  // Include the library

#include "HX711-SOLDERED.h"
// Define pins used for DAT and SCK here
#define PIN_DAT 4
#define PIN_SCK 3
// Scale units
#define SCALE_UNITS 1.0
// Create the HX711 object on the right pins
HX711 hx711(PIN_DAT, PIN_SCK);
void setup()
{
Serial.begin(115200); // For debugging
// Init HX711
hx711.begin();
// Wait a bit until it initializes fully delay(200);
// While calibrating - don't put any load on the load cell! hx711.setZero();
// Set calculated scale units hx711.setScale(SCALE_UNITS); }
void loop() { // Make reading in units double readingInUnits = hx711.getReadingInUnits(); // You may also call getReadingInUnits(n) for the result to be an average of n readings // Print the reading // Try reading this over the serial plotter! Serial.print("HX711 Reading: "); Serial.println(readingInUnits); // Wait a short while until the next reading // This serial print is quite fast because it looks better on the serial plotter delay(200); }

 

HX711 Midi Controller Project

Now let’s have some fun with the load cell! In this project, we use an ESP32-S3 as a Midi controller. The device acts as a musical instrument interface, sending real-time data from a load cell over USB to your computer. Since the ESP32-S3 can transmit MIDI CC (Control Change) messages or other MIDI events over USB, using Surge XT (a free open-source virtual synthesizer) we can then map MIDI CC messages to parameters such as filter cutoff, resonance, envelopes, etc.

Converting Weight to MIDI Data

To turn your load cell into a musical controller, you need to transform the raw electrical resistance into a standard MIDI Control Change (CC) value ranging from 0 to 127. This is achieved by defining your sensor's resting state and maximum pressure point, then mapping that range to the MIDI protocol.

The following snippet demonstrates the core logic for capturing the weight and converting it into a signal your computer can understand. By constraining the raw input, we ensure that the MIDI data remains stable and doesn't exceed the bounds required by the virtual synthesiser:


// Get raw reading from load sensor
long raw = hx711.getRawReading();

// Map the raw sensor range to MIDI (0-127)
// RAW_MIN is the resting state, RAW_MAX is the full-pressure state
long r = constrain(raw, RAW_MAX, RAW_MIN);
int ccVal = map(r, RAW_MIN, RAW_MAX, 0, 127);

// Send MIDI Control Change if the value has changed
if (ccVal != lastCC)
{
  MIDI.controlChange(CC_NUMBER, (uint8_t)ccVal, MIDI_CHANNEL);
  lastCC = ccVal;
}

Products mentioned in this article

Related Articles