Cov txheej txheem:

Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier: 4 Kauj Ruam (nrog Duab)
Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier: 4 Kauj Ruam (nrog Duab)

Video: Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier: 4 Kauj Ruam (nrog Duab)

Video: Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier: 4 Kauj Ruam (nrog Duab)
Video: How to make a STEEL MARBLE TRACK with basic tools! step by step guide 2024, Hlis ntuj nqeg
Anonim
Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier
Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier
Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier
Arduino Nplai Nrog 5kg Load Cell thiab HX711 Amplifier

Cov Lus Qhia no piav qhia yuav ua li cas ntsuas qhov hnyav me me uas siv tau yooj yim ntawm cov khoom seem.

Cov ntaub ntawv xav tau:

1. Arduino - qhov kev tsim qauv no siv tus qauv Arduino Uno, lwm yam Arduino version lossis clones yuav tsum ua haujlwm ib yam nkaus

2. HX711 ntawm pawg thawj coj saib tsis taus - Cov microchip no tau tsim tshwj xeeb rau ua kom nrov nrov los ntawm cov xovtooj ntawm tes thiab qhia lawv rau lwm tus mircocontroller. Lub hlwb thauj khoom ntsaws rau hauv lub rooj tsavxwm no, thiab pawg thawj coj no qhia rau Arduino seb lub load cell ntsuas li cas.

3. 5kg load cell - Load cells yog qhov tshwj xeeb zoo li cov hlau uas muaj qhov ntsuas ntsuas ntsuas kua nplaum rau lawv. Cov ntsuas ntsuas yog cov resistors uas hloov lawv qhov resitance thaum lawv khoov. Thaum cov hlau hlau khoov, qhov ua haujlwm ntawm lub xov tooj ntawm tes hloov pauv (HX711 ntsuas qhov kev hloov pauv me me hauv kev tiv thaiv kom raug). Koj tuaj yeem yuav ob qho HX711 thiab thauj khoom ntawm no:

Yog tias koj yuav cov khoom thov tawm kev tshuaj xyuas! Nws yog qhov muaj txiaj ntsig zoo rau cov neeg yuav khoom yav tom ntej.

4. Lub tiaj tiaj tiaj tiaj tiaj tiaj (x2) - ib qho tawv ntoo tawv lossis hlau zoo tagnrho.

5. Cov xov hlau hauv ntau xim rau txuas txhua ntu

6. Lub hwj chim rau Arduino

Kauj ruam 1: Mount Load Cell

Mount lub Load Cell
Mount lub Load Cell

Ua ntej peb yuav nce lub load cell. Koj lub mount yuav txawv, tab sis ntawm no yog cov lus qhia koj yuav tsum tau ua raws:

1. Aluminium load cell yuav tsum muaj 4 lub qhov taub thiab daim ntawv lo qhia qhov taw qhia ntawm kev quab yuam. Qhov sab tsis muaj daim ntawv lo rau qhov chaw ruaj khov thiab teeb sab nrog daim ntawv lo rau qhov txav mus los. Cov xub ntawm daim ntawv lo sab yuav tsum taw tes rau hauv qhov kev taw qhia lub platform yuav txav mus thaum siv lub nra.

2. Cov phaj mounting thiab cov phaj txav yuav tsum ob leeg ua kom nruj li sai tau

3. Ua kom ntseeg tau tias yuav tsum tau muab qee yam sib txawv ntawm cov phaj sib dhos thiab cov cell load. Standoffs lossis washers ob leeg ua haujlwm zoo. Lub hom phiaj yog tias txhua qhov quab yuam siv rau lub phaj txav ua rau lub xovtooj ntawm tes khoov thiab ntswj. Yog tsis muaj spacers, thauj khoom yuav raug xa ncaj qha los ntawm cov phaj txav mus rau phaj ruaj ruaj yam tsis cuam tshuam rau lub load cell.

Kauj Ruam 2: Hlau Load Cells thiab HX711

Hlau Load Cells thiab HX711
Hlau Load Cells thiab HX711

Saib daim duab kab xev seb yuav txuas lub xovtooj ntawm tes, HX711, thiab Arduino li cas.

Ntawm aluminium load cell, ntau qhov ntsuas ntsuas tau twb txuas ua ke rau tus choj Wheatstone. Txhua yam koj yuav tsum tau ua yog txuas cov xov hlau mus rau HX711 pawg thawj coj hauv kev qhia kom raug.

Kauj Ruam 3: Ntxiv HX711 Library rau Koj Arduino IDE

Lub tsev qiv ntawv HX711 muaj nyob ntawm no:

Saib qhov txuas no ntawm Arduino lub vev xaib rau cov lus qhia yuav ua li cas ntxiv cov tsev qiv ntawv rau koj Arduino IDE:

Kauj ruam 4: Txheeb thiab ntsuas

Calibrate thiab Luj!
Calibrate thiab Luj!

Sparkfun muaj cov phiaj xwm Arduino zoo los ua qhov ntsuas. Qhov hloov tshiab tshaj plaws muaj nyob ntawm GitHub thiab luam tawm hauv qab no:

Thawj qib software yog txhawm rau txiav txim siab qhov ntsuas rau qhov ntsuas. Txhawm rau ua qhov no, khiav cov cai no:

/*

Piv txwv siv SparkFun HX711 breakout board nrog ntsuas los ntawm: Nathan Seidle SparkFun Electronics Hnub: Kaum Ib Hlis 19th, 2014 Daim ntawv tso cai: Tus lej no yog pej xeem sau tab sis koj yuav npias rau kuv yog tias koj siv qhov no thiab peb ntsib ib hnub twg (Daim ntawv tso cai Beerware). Nov yog daim duab calibration. Siv nws los txiav txim siab calibration_factor uas tus piv txwv tseem ceeb siv. Nws kuj tseem tso tawm zero_factor muaj txiaj ntsig zoo rau cov phiaj xwm uas muaj qhov hnyav tas mus li ntawm qhov ntsuas nruab nrab ntawm lub zog mus. Teeb koj cov nplai thiab pib kos duab yam tsis muaj qhov hnyav ntawm qhov ntsuas Thaum nyeem tau pom tso qhov hnyav ntawm qhov ntsuas Nyem +/- lossis a/z txhawm rau kho qhov ntsuas ntsuas qhov ua tau zoo kom txog rau thaum cov ntawv nyeem nyeem sib phim qhov paub qhov hnyav Siv qhov ntsuas ntsuas no ntawm tus piv txwv piv txwv Qhov piv txwv no kwv yees phaus (lbs). Yog tias koj xav tau hnyav, hloov Serial.print ("lbs"); line li kg Qhov ntsuas ntsuas yuav txawv sib txawv tab sis nws yuav cuam tshuam ncaj qha rau lbs (1 lbs = 0.453592 kg). Koj qhov kev ntsuas ntsuas yuav zoo heev lossis tsis zoo. Txhua yam nws nyob ntawm kev teeb tsa ntawm koj cov txheej txheem ntsuas thiab kev coj ua lub ntsuas hluav taws xob los ntawm xoom xeev Qhov piv txwv no siv bogde lub tsev qiv ntawv zoo: "https://github.com/bogde/HX711" bogde lub tsev qiv ntawv raug tso tawm hauv GNU GENERAL PUBLIC LICENSE Arduino tus pin 2 -> HX711 CLK 3 -> DOUT 5V -> VCC GND -> GND Feem ntau txhua tus pin ntawm Arduino Uno yuav sib xws nrog DOUT/CLK. HX711 pawg thawj coj tuaj yeem siv hluav taws xob los ntawm 2.7V txog 5V yog li Arduino 5V lub zog yuav tsum zoo. */ #include "HX711.h" #define LOADCELL_DOUT_PIN 3 #define LOADCELL_SCK_PIN 2 HX711 nplai; ntab calibration_factor = -7050; //-7050 ua haujlwm rau kuv 440lb max nplai teeb tsa teeb tsa () {Serial.begin (9600); Serial.println ("HX711 ntsuas qhov ntsuas"); Serial.println ("Tshem tag nrho qhov hnyav los ntawm qhov ntsuas"); Serial.println ("Tom qab nyeem ntawv pib, tso qhov hnyav paub qhov hnyav"); Serial.println ("Xovxwm + lossis a txhawm rau txhawm rau ntsuas qhov ntsuas"); Serial.println ("Xovxwm - lossis z kom txo qhov ntsuas qhov ntsuas"); scale.begin (LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); teev.set_scale (); nplai.are (); // Pib dua qhov ntsuas rau 0 ntev zero_factor = scale.read_average (); // Tau txais lub hauv paus nyeem Serial.print ("Zero factor:"); // Qhov no tuaj yeem siv los tshem qhov xav tau los ntsuas qhov ntsuas. Pab tau nyob hauv cov phiaj xwm ruaj khov. Serial.println (zero_factor); } void loop () {scale.set_scale (calibration_factor); // Kho qhov ntsuas qhov ntsuas no Serial.print ("Nyeem:"); Serial.print (teev.get_units (), 1); Serial.print ("lbs"); // Hloov qhov no mus rau kg thiab rov kho qhov ntsuas qhov tseeb yog tias koj ua raws SI units zoo li tus neeg zoo Serial.print ("calibration_factor:"); Serial.print (calibration_factor); Serial.println (); yog (Serial.available ()) {char temp = Serial.read (); yog (temp == ' +' || temp == 'a') calibration_factor += 10; lwm yog (temp == ' -' || temp == 'z') calibration_factor -= 10; }}

Tom qab ntsuas qhov ntsuas, koj tuaj yeem ua haujlwm cov qauv no, tom qab ntawd hack nws rau koj tus kheej lub hom phiaj:

/*

Piv txwv siv SparkFun HX711 breakout board nrog ntsuas los ntawm: Nathan Seidle SparkFun Electronics Hnub: Kaum Ib Hlis 19th, 2014 Daim ntawv tso cai: Tus lej no yog pej xeem sau tab sis koj yuav npias rau kuv yog tias koj siv qhov no thiab peb ntsib ib hnub twg (Daim ntawv tso cai Beerware). Qhov piv txwv no qhia txog kev ntsuas qhov yooj yim. Saib cov duab ntsuas kom tau txais qhov ntsuas qhov ua tau zoo rau koj cov teeb tsa tshwj xeeb ntawm tes. Qhov piv txwv no siv bogde lub tsev qiv ntawv zoo: "https://github.com/bogde/HX711" bogde lub tsev qiv ntawv raug tso tawm raws li GNU GENERAL PUBLIC LICENSE Lub HX711 ua ib yam zoo: nyeem cov hlwb. Lub rooj sib tsoo tawg yog sib xws nrog txhua cov nplej-pob zeb choj raws lub xov tooj ntawm tes uas yuav tsum tso cai rau tus neeg siv ntsuas txhua yam los ntawm ob peb grams mus rau kaum tawm tons. Arduino tus pin 2 -> HX711 CLK 3 -> DAT 5V -> VCC GND -> GND Lub HX711 pawg thawj coj tuaj yeem siv hluav taws xob los ntawm 2.7V txog 5V yog li Arduino 5V lub zog yuav tsum zoo. */#include "HX711.h" #define calibration_factor -7050.0 // Tus nqi no tau txais siv SparkFun_HX711_Calibration sketch #define LOADCELL_DOUT_PIN 3 #define LOADCELL_SCK_PIN 2 HX711 nplai; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); Serial.println ("HX711 scale demo"); scale.begin (LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN); scale.set_scale (calibration_factor); // Tus nqi no tau los ntawm kev siv SparkFun_HX711_Calibration sketch scale.tare (); // Piv txwv tias tsis muaj qhov hnyav ntawm qhov ntsuas thaum pib, rov pib dua qhov ntsuas rau 0 Serial.println ("Nyeem:"); } void loop () {Serial.print ("Nyeem:"); Serial.print (teev.get_units (), 1); //scale.get_units () rov qab ntab Serial.print ("lbs"); // Koj tuaj yeem hloov qhov no rau kg tab sis koj yuav tsum tau rov kho qhov ntsuas qhov ntsuas qhov tseeb_printor Serial.println (); }

Pom zoo: