Cov txheej txheem:

Suav Nplai Ua Nrog Arduino: 6 Kauj Ruam
Suav Nplai Ua Nrog Arduino: 6 Kauj Ruam

Video: Suav Nplai Ua Nrog Arduino: 6 Kauj Ruam

Video: Suav Nplai Ua Nrog Arduino: 6 Kauj Ruam
Video: ๐Ÿคž8 YAM COV NEEG TXAWJ NTSE ZAM TSIS UA YOG DAB TSI?๐Ÿšซ 2024, Kaum ib hlis
Anonim
Suav Nplai Ua Nrog Arduino
Suav Nplai Ua Nrog Arduino

Txoj haujlwm no tseem ua haujlwm me ntsis tab sis nws tau mus txog qhov chaw uas nws muaj txiaj ntsig los qhia cov ntsiab lus rau lwm tus kom tau txais txiaj ntsig los ntawm nws thiab lub tswv yim. Nws yog qhov ntsuas tsim los siv Arduino ua lub microcontroller, lub xov tooj ntawm tes thauj khoom, HX711 teeb liab lub zog thiab 16x2 LCD npo.

Kauj Ruam 1: Yam Koj Yuav Tsum Tau

Koj yuav xav tau cov hauv qab no los ua kom tiav txoj haujlwm no.

Arduino Nano (koj tuaj yeem siv Arduino Uno)

3KG Load cell

HX711 teeb liab amplifier

16 x 02 LCD npo nrog I2c interface

DuPont cables

Ib daim ntawv qhia zaub mov

Qee cov plywood thiab cov ntsia hlau (lossis koj tuaj yeem yuav ib qho ntawm cov khoom siv no)

Koj yuav tsum tau teeb tsa lub xov tooj ntawm tes kom ntab los ntawm kev rub nws ntawm lub hauv paus kawg thiab tso lub platform rau ntawm sab nraub qaum uas yuav siv los tso cov khoom kom hnyav. Xwb, koj tuaj yeem yooj yim yuav cov khoom siv uas suav nrog lub xovtooj ntawm tes, HX711 nrog lub xovtooj ntawm tes ua ntej sib dhos ua ke rau perspex cov laug cam npaj siv.

Kauj Ruam 2: Txuas Cov Khoom Ua Ke

Siv daim duab los txuas txhua yam. Kom meej dua kuv tau sau cov ntsiab lus hauv qab no ib yam.

Load cell Rau HX711

  • Liab ---- E+
  • Dub ---- E-
  • Dawb ---- A-
  • Ntsuab ---- A+

Cov kev sib txuas saum toj no nyob ntawm qhov teeb tsa ntawm tes load

HX711

  • Gnd ---- Gnd Ib
  • DT ---- A3
  • SWB --- A2
  • VCC ---- +5V

LCD

  • Gnd ---- Gnd Ib
  • VCC ---- +5V
  • SDA ---- A4
  • SCL ---- A5

Tare khawm

  • Pin 1 ---- +5V
  • Pin2 ---- D2 --- 10K resistor ---- Gnd

Suav khawm teeb

  • Pin 1 ---- +5V
  • Pin2 ---- D3 --- 10K resistor ---- Gnd

Kauj ruam 3: Arduino Firmware - 1

Tus lej Arduino siv Q2HX711 thiab lub tsev qiv ntawv LiquidCrystal_I2C.

Q2HX711 lub tsev qiv ntawv pib ua los ntawm kev nqa cov ntaub ntawv thiab tus pin tus lej ua qhov ntsuas

Q2HX711 hx711 (hx711_data_pin, hx711_clock_pin);

Lub tsev qiv ntawv LCD siv sijhawm pib ua I2C chaw nyob thiab tus pin raws li qhov ntsuas

LiquidCrystal_I2C lcd (0x3F, 16, 2);

Ob lub khawm tau muab tso rau qhov cuam tshuam hauv kev teeb tsa kom lawv tuaj yeem ua tiav cov haujlwm muaj feem cuam tshuam

attachInterrupt (0, _doTare, CHANGE); attachInterrupt (1, _doCount, CHANGE);

Kauj ruam 4: Arduino Firmware - 2

Kev nyeem ntawv nruab nrab rov qab nruab nrab qhov nyeem tau tus nqi tau txais los ntawm HX711

ntev nyeem ntawv nruab nrab (int piv txwv = 25, ntev t = 0) {tag nrho = 0; rau (int kuv = 0; kuv <piv txwv; kuv ++) {tag nrho = tag nrho+((hx711.read ()/daws teeb meem) -t); ncua (10)} rov qab (tag nrho / kuaj); }

Sab hauv txoj haujlwm siv cov txiaj ntsig nyoos thaum tso tawm, nws siv tus nqi hloov pauv los qhia qhov hnyav hauv grams, kev kho tus nqi yuav yog nyob ntawm lub xov tooj ntawm tes uas tau siv thiab yuav tsum tau kho kom haum.

Cov lej ua tiav yog nyob ntawm Github qhov chaw cia khoom no

Kauj Ruam 5: Siv Nplai los Suav

Thaum koj txhawb nqa Arduino, nws pib ua los ntawm kev teeb tsa TARE tus nqi rau thawj zaug nyeem. Cov nplai teb rau qhov kev hloov pauv hauv qhov hnyav pom thiab hloov kho cov duab LCD.

TARE muaj nuj nqi

Tej zaum koj yuav xav kom ntsuas qhov ntsuas nrog qhov hnyav muab rau nws, piv txwv li lub tais lossis lwm lub thawv uas koj npaj yuav muab cov khoom ntsuas los ntsuas tab sis tsis suav nrog qhov hnyav ntawm lub thawv. Cias tso lub ntim khoob thiab nias lub pob tare thiab tos ob peb vib nas this kom txog thaum nyeem tawm qhia xoom nrog lub ntim ntawm cov nplai.

Muaj nuj nqi COUNT

Koj tuaj yeem suav cov khoom uas hnyav ib yam. Koj thawj zaug yuav tsum teeb tsa tus nqi noob thiab qhia ntsuas qhov hnyav ntawm ib yam khoom. los ntawm lub neej ntawd nplai tau npaj rau qhov hnyav 25 yam khoom thiab suav qhov hnyav ntawm ib yam khoom los ntawm kev faib qhov hnyav no los ntawm 25. Thaum teeb tsa koj tuaj yeem ntxiv lossis tshem tawm cov khoom thiab cov nplai yuav tsum raug suav cov suav ntawm cov khoom tso rau nws.

PC software

Xaiv qhov ntsuas tuaj yeem ua khub nrog daim ntawv thov PC los sib tham qhov hnyav rov qab rau hauv PC daim ntawv thov thiab khaws cov khoom hnyav thiab teeb tsa cov khoom hnyav rov qab rau qhov ntsuas. Qhov no tseem ua haujlwm txuas mus ntxiv thiab kuv tsis koom nrog daim ntawv thov PC, tab sis koj tuaj yeem pom kev ua qauv qhia hauv cov vis dis aus hauv qab no.

Kauj Ruam 6: Tawm tswv yim

Cia kuv muaj koj cov lus tawm tswv yim thiab xav siv / hloov kho lub firmware. Kuv yuav txaus siab rau cov lus qhia rau kev txhim kho.

Pom zoo: