| 
|  | Сообщение # 1 | | cyka 
   
    
Постов: 2  
 
ОК  | Купил я тензорезистор вместе с модулем HX711. Хотел сделать весы. Но не могу настроить. Какой бы я не ставил калибровочный коэффициент, все бестолку. Показывает неправильно, цифры резко прыгают, либо показывают правильно, нотолько определенный вес, стоит его изменить, так снова неправильно, а иногда показывают правильно, но после перезагрузки платы снова. Я перепробовал уже 3 калибровочных прошивки, все бестолку.
 Фонарь на фото весит 81 грамм.
 
 
  
 Вот ели что моя калибровочная прошивка:
 #include "HX711.h"
 #include <LiquidCrystal.h>
 HX711 scale(A1, A0); // DT, CLK
 LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
 
 float calibration_factor = 13.1; // this calibration factor is adjusted according to my load cell
 float units;
 float ounces;
 
 void setup() {
 pinMode(3, OUTPUT);
 digitalWrite(3, HIGH);
 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");
 lcd.begin(16, 2);
 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
 
 units = scale.get_units(), 10;
 if (units < 0)
 {
 units = 0.00;
 }
 ounces = units * 0.035274;
 lcd.setCursor(0, 0);
 lcd.print(ounces);
 lcd.print(" grams");
 lcd.setCursor(0, 1);
 lcd.print(" cal: ");
 lcd.print(calibration_factor);
 delay(100);
 
 if(Serial.available())
 {
 char temp = Serial.read();
 if(temp == '+' || temp == 'a')
 calibration_factor += 0.1;
 else if(temp == '-' || temp == 'z')
 calibration_factor -= 0.1;
 }
 }
 |  | 
| 
|  | Сообщение # 2 | | diakin 
   
    
Постов: 1  
 
ОК  | А где сами-то весы? фото. Сделал как обычно на всех рисунках, все работает. |  |