Cov txheej txheem:

Tutorial to Interface HMC5883L Compass Sensor Nrog Arduino: 10 Kauj Ruam (nrog Duab)
Tutorial to Interface HMC5883L Compass Sensor Nrog Arduino: 10 Kauj Ruam (nrog Duab)

Video: Tutorial to Interface HMC5883L Compass Sensor Nrog Arduino: 10 Kauj Ruam (nrog Duab)

Video: Tutorial to Interface HMC5883L Compass Sensor Nrog Arduino: 10 Kauj Ruam (nrog Duab)
Video: How to easily use HMC5883L Compass Sensor 2024, Kaum ib hlis
Anonim
Tutorial to Interface HMC5883L Compass Sensor Nrog Arduino
Tutorial to Interface HMC5883L Compass Sensor Nrog Arduino

Nqe lus piav qhia

HMC5883L yog 3-axis digital compass siv rau ob lub hom phiaj dav dav: txhawm rau ntsuas cov hlau nplaum ntawm cov khoom sib nqus zoo li ferromagnet, lossis ntsuas lub zog thiab, qee zaum, kev taw qhia ntawm qhov chaw sib nqus ntawm qhov chaw hauv qhov chaw. Kev sib txuas lus nrog HMC5883L yog qhov yooj yim thiab txhua yam ua tiav los ntawm I2C interface. Muaj tus tswj hwm ntawm lub nkoj. Pawg tswj hwm tawg suav nrog HMC5883L sensor thiab txhua lub lim dej lim dej. Lub hwj chim thiab 2-xaim tus pin txuas txhua tus tau tawg mus rau 0.1 lub taub hau. Siv lub npe nrov HMC5883L magnetometer nti. Txhawb 3.0V txog 5.0V IO qib ntawm I2C SCL thiab SDA pins.

Kev qhia tshwj xeeb

  • Lub hwj chim: 3V - 5V
  • IO Voltage Theem: 3V - 5V
  • Kev Sib Txuas Lus: Tus txheej txheem IIC kev sib txuas lus
  • Module Dimensions: 14.35 hli (L) x 13.16 mm (W) x 3.40 mm (H)
  • PCB tuab: 1.60 hli
  • Ntsuas ntau: ± 1.3-8 Gauss

Kauj Ruam 1: Kev Npaj Khoom

Hauv qhov kev qhia no, koj yuav xav tau:

1. Arduino Uno Board thiab USB Cable.2. HMC 5883L Compass Sensor3. Jumper Hlau 4. LCD 16 X 25. Cov qhob cij 6. 10K Potentiometer 7. Arduino IDE Software

Kauj Ruam 2: Tus Pin Qhia

Nqe lus piav qhia
Nqe lus piav qhia

VCC: Fais fab mov

GND: GND zog

SCL: I2C Lub Sijhawm Teev Taw

SDA: I2C Cov Ntaub Ntawv IO

DRDY: Cov Ntaub Ntawv Npaj Tawm

Kauj Ruam 3: Tus Pin Txuas

Tus Pin Txuas
Tus Pin Txuas
Tus Pin Txuas
Tus Pin Txuas

Txuas HMC5883L rau Arduino Uno Board raws li hauv qab no:

  • VCC rau +5V
  • GND to CSY
  • SCL rau A5
  • SDA to AWM 4

Txuas LCD rau Arduino Uno Board raws li hauv qab no:

  • VSS rau +5V
  • VDD to CSY
  • RS rau 12
  • LWV to GND
  • E rau 11
  • D4 rau 5
  • D5 rau 4
  • D6 rau 3
  • D7 rau 2
  • A/VSS rau +5V
  • KND/VDD to GND

Txuas 10K Potentiometer rau LCD raws li hauv qab no (xa duab rau potentiometer pinout):

  • GND to CSY
  • Cov ntaub ntawv rau v0
  • VCC rau +5V

Kauj ruam 4: Txuas Arduino rau Computer

Txuas Arduino rau Computer
Txuas Arduino rau Computer

Tom qab koj ua tiav koj lub Circuit Court, txuas koj Arduino Uno Board rau koj lub khoos phis tawj ntawm USB Cable. Koj tuaj yeem pom koj lub LCD tau qhib.

Kauj Ruam 5: Qauv Qauv Cai

Qauv Source Code
Qauv Source Code
Qauv Source Code
Qauv Source Code

Koj tuaj yeem rub tawm cov qauv piv txwv no thiab qhib nws ntawm koj li Arduino IDE. Xaiv lub rooj tsavxwm raug thiab chaw nres nkoj. Tom qab ntawd, xa koj cov Cai rau hauv koj Arduino Uno Board.

Kauj Ruam 6: Tsev qiv ntawv

Tsev qiv ntawv
Tsev qiv ntawv

Koj yuav tsum rub tawm cov tsev qiv ntawv no ua ntej xa cov qauv coj mus rau hauv koj li Arduino IDE kom tso cai rau Arduino sib txuas lus nrog LCD thiab HMC5883L. Rub tawm ZIP cov ntaub ntawv hauv qab no> Qhib Zip File> Extract rau koj li Arduino Uno Library nplaub tshev. Xa daim duab saum toj no rau koj cov neeg ua tim khawv.

Kauj Ruam 7: Cov Lus Sib Haum

Cov Lus Cog Tseg
Cov Lus Cog Tseg

Raws li tau piav qhia, sib ntswg lossis tig lub cuab yeej yuav muab cov txiaj ntsig sib xws.

Kauj Ruam 8: Qhov tshwm sim: Saib Xyuas Serial

Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial
Qhov tshwm sim: Saib Xyuas Serial

kuv. thaum lub cuab yeej tig ncig nws yog X-axis, X-axis tseem zoo ib yam thaum lwm ob txoj kev hloov pauv.

ii. thaum lub cuab yeej tig ncig nws yog Y-axis, Y-axis tseem zoo ib yam thaum lwm ob txoj kev hloov pauv.

iii. thaum lub cuab yeej tig ncig nws yog Z-axis, Z-axis tseem zoo ib yam thaum lwm ob txoj kev hloov pauv.

Kauj ruam 9: Yees duab

Cov vis dis aus no qhia txog HMC5883L Compass Module sib xws tso tawm thaum cuam tshuam nrog Arduino Uno.

Kauj ruam 10: Xov xwm

HMC5883L tsis ua haujlwm!

Sim rub lub Tsev Qiv Ntawv (Mecha_QMC5883L) thiab qhov chaws.

Pom zoo: