WioNode Arduino를 녹여 HX711과 함께 측정한 이야기
나는 HX711이 5V 구동 제품인 줄 알았는데, 원래 3.3v 구동 마이크로컴퓨터도 괜찮았구나?
한번 해봤어요.
WioNode를 연결해 봤습니다.
이번에 사용한 것은 아마존에서 산 저렴한 HX711 바닥판이다.
저전지는 광속형 1kg을 측정할 수 있는 물건이다.
광속형을 향한 저전지 때문에thingiverse에 이런 3D모델이 떨어지기 때문에 빠르게 쳐보려고 했습니다.
3D 프린터가 없는 사람은 아마존 일대를 시험해 볼 수 있다.
코드가 이런 느낌이에요. #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Ω로 변경하는 것이 좋다
#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Ω로 변경하는 것이 좋다
(개조하지 않아도 결과는 정상적으로 작동했지만 좀 메스꺼워서 10kΩ저항으로 바꿨어요.
위오노드 아두노를 녹여 HX711을 사용한 사연입니다.
Reference
이 문제에 관하여(WioNode Arduino를 녹여 HX711과 함께 측정한 이야기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/tatsu1225/items/09cb4883c25ea2eebf8f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)