• After reading this thread I almost didn't even bother to try to use an HX711 with espruino, but I somehow decided to give it a go anyway, and I'm glad I did. It is possible to get nice stable and accurate (and precise!) readings from an HX711 chip and a load cell using espruino.
    I'm using the MDBT42Q breakout board powered by a 9V battery. When powered by a CR2032, my board would flash red, which I'm assuming means it couldn't supply enough current.

    I'm using a shielded HX711 breakout board (from Amazon: http://a.co/ge0HhQR) and a balanced 4-wire load cell.

    I'm connecting the standard Red,Black,Green,White wires from the load cell to the board pins like this:

    Red --> "Out+" (that's how it's labeled on this particular board)
    White --> A-
    Green --> A+
    Black --> GND

    From the board to the espruino, I have the following connections:
    VCC --> 3.3
    DO/RX --> D15
    CLK/TX --> D14
    GND --> GND

    Here is the code I'm using:

    var gain_grams = 0.00103123388;
    var zero = 162050;
    var s = SPI1;
    s.setup({ miso : D15, sck : D14, baud: 1000000 });
    var lastReadTime = 0;
    function readRaw(){
        var d = s.send([0b11111111,0b11111111,0b11111111­]);
        var val = d[0]*65536 + d[1]*256 + d[0];
        lastReadTime = Date.now();
        return val;
    function tare(){
        zero = readRaw(); 
    function readGrams(){
        return (readRaw()-zero)*gain_grams; 

    I get the same accuracy and better precision than my cheap store-bought digital kitchen scale. I'm getting about 0.1g precision reliably.

    Note that as long as I wait a while between reads, I get very consistent values back. If I do multiple reads one after the other without waiting in between, then I get high variability. I don't know why that is. Earlier in this forum thread there was talk about needing to follow the 24 pulses with 1-3 pulses for selecting the gain level, but that was problematic for me, as it caused erroneous readings when I tried that. Maybe I didn't do it right. But for my needs, with a simple wait between reads, I'm getting great results. I currently force it to wait 1 second between reads, which is more than enough, and not too slow of a sample rate for my application.


Avatar for jijidad @jijidad started