【发布时间】:2022-01-01 11:20:40
【问题描述】:
我用四个 50 Kg 称重传感器和 HX711 放大器构建了一个 Arduino 浴室秤。一些称重传感器线连接在一起以形成惠斯通电桥布置。我使用的是 Arduino MEGA 2560。我之前在另一个工作站上构建了相同的比例,并且效果很好。我的新站不停地波动,即使秤上没有任何重量。 这是我的校准:
#include "HX711.h"
#define LOADCELL_DOUT_PIN 3
#define LOADCELL_SCK_PIN 2
HX711 scale;
float calibration_factor = -6440; //-6440 worked for my previous scale setup
void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
Serial.print(scale.get_units(), 2);
Serial.print(" kg"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 10;
else if(temp == '-' || temp == 'z')
calibration_factor -= 10;
}
}
【问题讨论】:
-
这次有什么不同,是软件还是电子部分?希望不是两者兼而有之。只是想知道你说的第一个项目和这个项目有什么不同。
-
实际上没有什么不同。我正在使用相同的软件和称重传感器。我检查了所有内容,但似乎无法发现问题。
标签: arduino