WioNode Arduino를 녹여 HX711과 함께 측정한 이야기

위오노드 아두노를 녹여 놀던 중 어디선가'무게 재니까 신난다'는 소리가 들려와 한번 놀아봤다.
나는 HX711이 5V 구동 제품인 줄 알았는데, 원래 3.3v 구동 마이크로컴퓨터도 괜찮았구나?
한번 해봤어요.

WioNode를 연결해 봤습니다.



이번에 사용한 것은 아마존에서 산 저렴한 HX711 바닥판이다.
저전지는 광속형 1kg을 측정할 수 있는 물건이다.

광속형을 향한 저전지 때문에thingiverse에 이런 3D모델이 떨어지기 때문에 빠르게 쳐보려고 했습니다.
3D 프린터가 없는 사람은 아마존 일대를 시험해 볼 수 있다.
  • thingiverse > Load cell testbed
  • Amazon>디지털 하중 센서 전자 비례 하중 센서 무게 센서
  • 반대쪽은 UART, 직렬 포트로 결과 토출

    코드가 이런 느낌이에요.

    #include "HX711.h"
    
    const uint8_t PORT0A = 1;
    const uint8_t PORT0B = 3;
    const uint8_t PORT1A = 4;
    const uint8_t PORT1B = 5;
    const uint8_t PORT_POWER = 15; // (common with RED_LED)
    //set PORT_POWER as HIGH for power supply. Low means no power.
    
    const uint8_t FUNC_BTN = 0;
    const uint8_t BLUE_LED = 2;
    const uint8_t RED_LED = PORT_POWER;
    
    const uint8_t UART_TX = PORT0A;
    const uint8_t UART_RX = PORT0B;
    const uint8_t I2C_SDA = PORT1A;
    const uint8_t I2C_SCL = PORT1B;
    
    // HX711 circuit wiring
    const int LOADCELL_DOUT_PIN = PORT1B;
    const int LOADCELL_SCK_PIN = PORT1A;
    
    HX711 scale;
    
    void setup() {
      // ----------
      // デバッグ用のシリアル通信の初期化
      Serial.begin(9600);
      while (!Serial); //waits for serial terminal to be open, necessary in newer arduino boards.
      Serial.println("HX711 demo");
    
      // ----------
      // IO周りの初期化
      pinMode(PORT1B, INPUT);
      pinMode(FUNC_BTN, INPUT);
      pinMode(BLUE_LED, OUTPUT);
      pinMode(PORT_POWER, OUTPUT);
      digitalWrite(PORT_POWER, HIGH);
      digitalWrite(BLUE_LED, HIGH);
    
      // ----------
      // HX711の初期化
      scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
      scale.set_scale(2280.f);    // this value is obtained by calibrating the scale with known weights; see the README for details
      scale.tare();               // reset the scale to 0
    }
    
    void loop() {
      if (scale.is_ready()) {
        Serial.print("meas : ");
        Serial.println(scale.get_units(10), 1);
      } else {
        Serial.println("HX711 not found.");
      }
    
      delay(100);
    }
    

    분동을 사용하여 동작 확인



    10g에서 900g 사이의 검증을 거쳐 이렇습니다.

    무게가 늘어나면 차이가 납니다. 몇 점을 측정한 결과부터 조정하면 더 정확한 수치가 되겠죠.

    [마] 3.3v 동작 시 20kΩ의 저항을 10kΩ로 변경하는 것이 좋다

  • Modifying the HX711 Breakout Board for 3.3V operation
  • HX711은 2.7~5.5v 범위 내에서 일하는 것 같지만 VFB가 발을 끄는 전압의 관점에서 볼 때 3.3v를 구동하는 경우 분압의 저항치를 변경해야 한다.
    (개조하지 않아도 결과는 정상적으로 작동했지만 좀 메스꺼워서 10kΩ저항으로 바꿨어요.
    위오노드 아두노를 녹여 HX711을 사용한 사연입니다.

    좋은 웹페이지 즐겨찾기