read an high precision adc like hx711

Posted on
Page
of 2
Prev
/ 2
  • Thanks! I have no idea what caused the inversion. There is code in Espruino to handle inversion in software, but it reads whether to do the inversion from flash, so that shouldn't ever be able to get modified.

    That 120uS pause would definitely cause the instability - unfortunately it's very difficult to avoid with software SPI since the Bluetooth stack needs to be able to interrupt things to keep the Bluetooth timing correct and keep the connection up.

    Do you think you'd be able to keep the code I'd used with the 0b10101010 and try it with hardware SPI?

  • Aha! Got the inversion back after trying your technique with hardware SPI.

    I reset the board and tried with the following isolated test case:

    var spi = SPI1;
    spi.setup({miso:D15, mosi:D14, sck:LED1, baud: 1000000});
    
    function testMosi(){
     var finalClk = 0b10000000;
      var c = 0b10101010;
      var d = this.spi.send([c,c,c,c,c,c,finalClk]);
      print(d); 
    }
    
    setInterval(testMosi,1000);
    

    Gordon, can you try the above and take a look at D14 on your scope? Do you also see a normally high MOSI line? Please tell me I'm not crazy. Or, at least, show me what I'm doing wrong here...

  • Ahh - yes, you're right. This looks like it's actually to do with the nRF52's SPI hardware!

    It seems that data is output MSB first, as you'd expect. However after outputting all data the state of the output line returns to the state that was in the top bit! So I guess either we'd have to move to 0b01010101 or ob01100110 (and then double the number of bytes).

    At this point I think it's probably best to just go with your method and drive it with 24 bits of data despite what the datasheet says. If it's not going to cause any trouble and it works reliably :)

  • I'm having success with my hardware SPI clock method. But I agree. It isn't spec friendly. I'll report back when I do larger scale testing in schools and let you know how it holds up to real world use.

  • Hey guys! Were you able to get any more progress on this? I'm currently working with a HX711 also, connected to an NodeMCU ESP8266 and I'm just starting in this. I have used both of your modules and getting different results from both. For a 177g object I'm getting around 70g readings but if I lift it I get zero so it seems to be calibrated but the calibration factor is off or something like that.

    Thanks in advance! :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

read an high precision adc like hx711

Posted by Avatar for user64817 @user64817

Actions