Cov txheej txheem:

3 Axis Accelerometer LIS2HH12 Module: 10 Kauj Ruam (nrog Duab)
3 Axis Accelerometer LIS2HH12 Module: 10 Kauj Ruam (nrog Duab)

Video: 3 Axis Accelerometer LIS2HH12 Module: 10 Kauj Ruam (nrog Duab)

Video: 3 Axis Accelerometer LIS2HH12 Module: 10 Kauj Ruam (nrog Duab)
Video: TechTalkCodeBot 2024, Kaum ib hlis
Anonim
3 Axis Accelerometer LIS2HH12 Module
3 Axis Accelerometer LIS2HH12 Module

Cov Lus Qhia no tau txiav txim siab qib pib nrog qee qhov kev paub dhau los nrog arduino software thiab muag khoom.

LIS2HH12 Module yog tsim los ntawm Tiny9. Tiny9 yog lub tuam txhab tshiab tau txais kev muag sensor modules rau DIY tinkers, tuam txhab, lossis cov neeg tsim khoom.

Muaj tsawg kawg yog ob lub hom phiaj ntawm tus ntsuas hluav taws xob: Txhawm rau txiav txim siab lub kaum ntse ntse tshwj xeeb. (X, Y, lossis Z lossis tag nrho), lossis txiav txim siab hloov pauv nrawm.

Accelerometers tau siv txhua qhov txhia chaw. Lawv siv hauv:

Xov tooj, Qoj qoj ib ce, Drones, Robotics, Missiles, thiab Helicopters tsuas yog rau npe qee tus. Yuav ua li cas koj xav siv lub ntsuas cua nrawm yog nyob ntawm tus neeg lub tswv yim.

Kauj ruam 1: Cov ntaub ntawv

Khoom siv
Khoom siv

Cov ntaub ntawv koj xav tau yog:

Cov khoom nyob ntawm qhov chaw no- tshwj tsis yog cov xov hlau thiab cov hlua hlau

Arduino Nano lossis nyiam ntaus ntawv arduino

USB rau Arduino Cable

LIS2HH12 Module

Hlau strippers Hlau

2x 10 Kohm resistors

1x 100 ohm resistor

Kauj ruam 2: Sesnor

Lub Sesnor
Lub Sesnor
Lub Sesnor
Lub Sesnor

LIS2HH12 module yog ua los ntawm ST 3-Axis accerlerometer. Tus qauv yog pob me me thiab tso cai rau 2 5-tus pin headers kom muab muag rau nws. Qhov no txo qhov kev co suab nrov uas tau qhia rau lub ntsuas cua. los ntawm cov peev txheej sab nraud ntawm qhov sib txawv sib txawv.

Koj tuaj yeem yuav cov nti no los ntawm cov chaw no:

Amazon

Cov yam ntxwv tseem ceeb rau cov nti no yog:

Tsawg-zog hom 5uA kos

16-ntsis kev daws teeb meem

Ua +/- 2 g, 4 g, 8 g

0.2% suab nrov

I2C lossis SPI raws tu qauv

Raug Raug

3.3v ua

Max Rating 4.8V (Tsis txhob nce siab dua 4.8 volts lossis koj yuav tawg Accelerometer nti)

Kauj ruam 3: Project Platform

Qhov Project Platform
Qhov Project Platform

Qhov Project Platform rau qhov ntsuas qhov ntsuas yog Arduino.

Pawg Thawj Saib Xyuas Kev Txhim Kho Kuv tab tom siv yog Arduino Nano.

Tam sim no Tiny9 LIS2HH12 accelerometer tsuas muaj cov lej yooj yim rau Arduino tab sis yuav cia siab tias nthuav dav cov cai rau ntau txoj haujlwm tshaj lij thiab rau Raspberry Pi lossis ib lub platform uas muaj cov kiv cua txaus pom zoo los ntawm koj.:-)

Kauj ruam 4: Breadboard

Cov qhob cij
Cov qhob cij

Yog tias koj muaj lub taub hau ntawm ob qho ntawm koj li Arduino nano thiab LIS2HH12 Module koj tuaj yeem tso Arduino Nano thiab cov ntsuas nrawm ntawm Breadboard zoo li no, hla txoj kab sib cais tso cai nkag mus rau tus pin tawg.

Nco ntsoov tias 3.3V tus pin ntawm Module tab tom ntsib Arduino.

Yog tias koj tsis muaj lub taub hau ntawm lawv tau txais qee yam thiab muab lawv tso rau ntawm cov laug cam.

Kauj Ruam 5: Tso Cov Neeg Tiv Thaiv rau ntawm Pawg Thawj Coj

Muab cov Resistors tso rau ntawm lub Rooj Tswjhwm Saib
Muab cov Resistors tso rau ntawm lub Rooj Tswjhwm Saib

Cov txheej txheem I2C uas peb yuav siv hauv txoj haujlwm no xav tau 2 10 Kohm rub tawm cov neeg tawm tsam rau cov khoom siv thauj khoom ntawm lub nti (+3.3 Pins); ib qho ntawm Kab Kab (CL) thiab ib qho ntawm Cov Kab Kab (DA)

Txij li LIS2HH12 tus ntsuas qhov ntsuas hluav taws xob siab tshaj yog 4.8V thiab hauv qhov haujlwm no peb siv 5V tawm ntawm Nano, Kuv tau tso 100 ohm resistor los ntawm 5V tus pin ntawm Nano mus rau txoj kab liab liab ntawm lub khob cij kom txo qis rail me ntsis.

Kauj Ruam 6: Txuas Tus Kheej ntawm Pawg Thawj Coj

Txuas Tus Kheej Ntawm Pawg Thawj Coj
Txuas Tus Kheej Ntawm Pawg Thawj Coj

Tam sim no peb tab tom txuas qhov txuas ntawm tus qauv mus rau arduino.

Gnd Pin ntawm tus qauv thiab arduino yuav tsum muaj lub xov hlau jumper mus los ntawm nws mus rau Blue Rail ntawm Breadboard.

Txuas tus +3.3 Tus Pin ntawm tus qauv mus rau txoj kab hluav taws xob liab ntawm lub khob cij.

Ob kauj ruam kawg no tso cai rau peb ua kom lub zog hloov pauv thaum peb siv lub zog arduino ntawm roj teeb lossis USB

Jumper Wire los ntawm +3.3 Pin ntawm Tus Qauv rau CS tus pin ntawm tus qauv (Qhov no ua rau I2C npav ntawm tus qauv)

Jumper hlau los ntawm Gnd Pin ntawm tus qauv mus rau A0 tus pin ntawm tus qauv (Qhov no qhia txog tus ntsuas qhov ntsuas qhov chaw nyob nws yuav teb rau thaum tham ntawm I2C Bus)

Jumper xaim los ntawm A5 ntawm arduino mus rau CL ntawm Tus Qauv (Qhov no tso cai rau lub moos ntawm arduino los ua ke nrog tus ntsuas nrawm.

Jumper hlau los ntawm A4 ntawm arduino rau DA ntawm tus qauv (Qhov no tso cai rau cov ntaub ntawv xa mus ntawm arduino thiab tus qauv.)

Kauj Ruam 7: Rub Cov Ntaub Ntawv

Rub cov ntaub ntawv
Rub cov ntaub ntawv

Mus rau Github chaw nyob https://github.com/Tinee9/LIS2HH12TR thiab rub tawm cov ntawv.

Mus rau qhov chaw no ntawm koj lub computer

C: / Program Files (x86) Arduino / libraries

Tsim daim nplaub tshev hu ua Tiny9

Muab cov ntaub ntawv.h thiab.cpp tso rau hauv Tiny9 Folder

Kauj Ruam 8: Qhib.ino

Qhib.ino
Qhib.ino

Qhib cov ntaub ntawv.ino koj rub tawm hauv Arduino IDE (Program/software)

Kauj ruam 9: Upload Sketch

Rub tawm Sketch
Rub tawm Sketch

Thaum koj tau txuas koj li arduino ntawm USB cable rau lub khoos phis tawj, yuav tsum muaj tus lej chaw nres nkoj hais hauv qab cov cuab yeej tab hauv arduino IDE.

Kuv qhov chaw nres nkoj tshwm sim ua COM 4 tab sis koj li yuav yog 1 lossis 9 lossis lwm yam.

Yog tias koj muaj ntau txoj kev xaiv COM ces xaiv qhov uas sawv cev rau Arduino uas koj siv. (Yuav ua li cas los txiav txim qhov chaw nres nkoj COM rau ntau qhov kev xaiv tuaj yeem nyob ntawm qhov kev qhia sib txawv yog thov.)

Thaum koj tau xaiv qhov chaw nres nkoj Arduino, nyem lub pob upload.

Kauj ruam 10: Txaus siab rau

Txaus siab rau
Txaus siab rau

Tom qab nws tau ua tiav Kev Tshaj Tawm koj yuav tsum tuaj yeem qhib Serial Monitor hauv Tool Tab thiab koj yuav tsum pom qee yam zoo li no tshwm ntawm koj lub Monitor.

Daim duab qhia x, y, thiab z axis hauv qhov kev txiav txim ntawd.

Z axis yuav tsum hais ze rau 1.0 +/- qee qhov suav vim Z tau taw tes.

Tam sim no koj tuaj yeem tig koj lub rooj noj mov thiab txaus siab saib cov lej hloov pauv qhia koj li cas cov qauv ntawm cov axises raug cuam tshuam los ntawm kev nqus thiab nrawm.

Pom zoo: