ความรู้แน่น ฟรีสำหรับชุมชน ArduinoAll ที่นี่เท่านั้น

ฟรีและดีที่สุด คอร์สอบรม Arduino + NodeMCU
ทำเพื่อแบ่งปัน ห้ามนำไปจำหน่าย หรือเก็บเงินค่าเรียน
  !!!


  


AllNewStep รับประกันคุณภาพทุกชิ้น วันจันทร์-ศุกร์แจ้งชำระสินค้าก่อน 14.00 จัดส่งทันทีวันนี้ค่ะ

กรุงเทพ /ภาคกลาง ได้พรุ่งนี้


*** สินค้าทุกชิ้น ถ้าสามารถทำรายการสั่งซื้อได้ แสดงว่ามีครบทุกรายการค่ะ *** 

พิมพ์ค้นหาบทความ หัวข้อกระทู้ และสินค้าในเว็บ AllNewStep ได้ที่นี่
QUOTE 

น้ำหนักที่อ่านได้จาก Loadcell ไม่คงที่อะครับ

Tatiya Wangmaitree

ผมลองต่อ Loadcell แล้วให้ขึ้นข้อมูลที่จอ lcd แล้วค่าไม่นิ่งครับ

อันนี้คือโค้ดที่ผมใช้ อยากทราบวิธีแก้อะครับ

// (c) Michael Schoeffler 2017, http://www.mschoeffler.de

#include <HX711_ADC.h> // https://github.com/olkal/HX711_ADC

#include <Wire.h>

#include <LiquidCrystal_PCF8574.h> // LiquidCrystal_I2C library

HX711_ADC LoadCell(4, 5); // parameters: dt pin, sck pin<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>

LiquidCrystal_PCF8574 lcd(0x27); // 0x27 is the i2c address of the LCM1602 IIC v1 module (might differ)

void setup() {

  LoadCell.begin(); // start connection to HX711

  LoadCell.start(1000); // load cells gets 2000ms of time to stabilize

  LoadCell.setCalFactor(422.6); // calibration factor for load cell => strongly dependent on your individual setup

  lcd.begin(16, 2); // begins connection to the LCD module

  lcd.setBacklight(127); // turns on the backlight

}

void loop() {

  LoadCell.update(); // retrieves data from the load cell

  int i = LoadCell.getData(); // get output value

  lcd.setCursor(0, 0); // set cursor to first row

  lcd.print("Weight[g]:"); // print out to LCD

  lcd.setCursor(0, 1); // set cursor to secon row

  lcd.print(i); // print out the retrieved value to the second row

}

QUOTE 
ความคิดเห็นที่ #1
เจ้าของร้าน

เช็คว่ากำหนดค่า factor ถูก้องแล้ว

มีโคดตัวอย่างของที่ร้าน ในคอร์สเรียน Arduino Starter ที่หน้าเว็บครับ

QUOTE 
ความคิดเห็นที่ #2
Tatiya Wangmaitree

ขอบคุณครับได้แล้วครับแล้วถ้าผมอยากจะให้ servo ทำงานหลังจากชั่งผมจะเขียนคำสั่งยังไง เช่น ให้น้ำหนัก 65 กรัม servo หมุน90 องศาอะครับ

#include <HX711_ADC.h> // https://github.com/olkal/HX711_ADC

#include <Wire.h>

#include <Servo.h>

#include <LiquidCrystal_PCF8574.h> // LiquidCrystal_I2C library

HX711_ADC LoadCell(4, 5); // parameters: dt pin, sck pin<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>

LiquidCrystal_PCF8574 lcd(0x27); // 0x27 is the i2c address of the LCM1602 IIC v1 module (might differ)

Servo servo1;

Servo servo2;

int pos = 0;

void setup() {

  LoadCell.begin(); // start connection to HX711

  LoadCell.start(1000); // load cells gets 2000ms of time to stabilize

  LoadCell.setCalFactor(416.0); // calibration factor for load cell => strongly dependent on your individual setup

  lcd.begin(16, 2); // begins connection to the LCD module

  lcd.setBacklight(127); // turns on the backlight

  servo1.attach(9);  

  servo2.attach(10);

}

void loop() {  

  LoadCell.update(); 

  int i = LoadCell.getData();

  lcd.setCursor(0, 0); // set cursor to first row

  lcd.print("Weight[g]:"); // print out to LCD

  lcd.setCursor(0, 1); // set cursor to secon row

  lcd.print(i); // print out the retrieved value to the second row

  if(i>=64){

    LoadCell.update();

    int i = LoadCell.getData();

    servo1.write(90);

    delay(1000);

    lcd.setCursor(0, 0); // set cursor to first row

    lcd.print("Weight[g]:"); // print out to LCD

    lcd.setCursor(0, 1); // set cursor to secon row

    lcd.print(i); // print out the retrieved value to the second row

    }

}

 

QUOTE 
ความคิดเห็นที่ #3
เจ้าของร้าน

สำหรับการเขียนโปรแกรม มีแนะนำในคอร์ส Arduino Starter ที่หน้าเว็บด้านบนซ้าย ลองเล่นดูครับ

QUOTE 
ความคิดเห็นที่ #4
Tatiya Wangmaitree

ได้แล้วครับขอบคุณครับ

QUOTE 
ความคิดเห็นที่ #5
บัณฑิตา กระจงกลาง

วางของแล้วค่าน้ำหนักไม่เปลี่ยนค่ะ

แสดงความคิดเห็นที่ 1-5 จากทั้งหมด 5 ความคิดเห็น
ขาย ARDUINO
คุณภาพ อันดับ 1

ได้รับรางวัลร้านยอดเยี่ยม
ตั้งแต่ปี 2558
ขาย Arduino
วีดีโอสอน Arduino

สอน esp8266

สอน Arduino IoT
สอน Arduino แบบเร็ว

สอน NodeMCU

อุปกรณ์ Arduino

MEMBER ZONE

พูดคุย-สอบถาม