Cov txheej txheem:

LED Compass thiab Altimeter: 7 Kauj Ruam (nrog Duab)
LED Compass thiab Altimeter: 7 Kauj Ruam (nrog Duab)

Video: LED Compass thiab Altimeter: 7 Kauj Ruam (nrog Duab)

Video: LED Compass thiab Altimeter: 7 Kauj Ruam (nrog Duab)
Video: ? Что такое многополосный 6 атомный хронометраж ? То 2024, Hlis ntuj nqeg
Anonim
Image
Image
Daim duab Circuit Court thiab PCB
Daim duab Circuit Court thiab PCB

Cov khoom nrog LEDs ib txwm ua rau kuv nyiam. Yog li no txoj haujlwm no los ua ke cov koob npe nrov digital compass sensor HMC5883L nrog 48 LEDs. Los ntawm kev tso cov LEDs hauv lub voj voog coj uas yog teeb pom kev zoo yog txoj kev koj tab tom mus. Txhua 7.5 degrees yuav tsav lub LED tshiab uas muab cov txiaj ntsig ntxaws.

GY-86 pawg thawj coj kuj tseem muab MS5611 ntsuas qhov ntsuas siab. Nrog kev pab ntawm qhov ntsuas no nws tuaj yeem suav qhov siab. Vim tias qhov kev daws teeb meem siab nws yog qhov zoo tshaj plaws rau qhov siab.

MPU6050 sensor ntawm GY-86 board muaj ob qho tib si 3-axis accelerometer thiab 3-axis gyroscope. Lub gyroscope tuaj yeem ntsuas qhov nrawm ntawm txoj haujlwm angular dhau sijhawm. Tus ntsuas hluav taws xob tuaj yeem ntsuas qhov nrawm nrawm thiab los ntawm kev siv lej trigonometry nws tuaj yeem xam lub kaum sab xis uas lub ntsuas cua nyob. Los ntawm kev sib txuas cov ntaub ntawv ntsuas lub ntsuas thiab lub tshuab ntsuas lub ntsej muag nws tuaj yeem tau txais cov ntaub ntawv hais txog kev ntsuas lub ntsej muag. Qhov no tuaj yeem siv rau qhov qaij them nyiaj rau HMC5883L lub ntsuas phoo (ua).

Cov vis dis aus qhia luv luv hauv cov lus qhia no yuav piav qhia ntxaws tias nws ua haujlwm li cas. Cov txheej txheem ntsuas ntsuas tau siv lub tshuab kom ua tiav tau lees paub. Kub muaj nyob rau hauv Celsius (default) lossis Fahrenheit.

Muaj kev lom zem !!

Kauj ruam 1: Altimeter

Image
Image

Qhov ntsuas siab ua rau siv MS5611 barometric siab ntsuas. Qhov siab tuaj yeem txiav txim siab raws li kev ntsuas huab cua hauv siab. Qhov siab dua qhov siab, qhov qis dua qhov siab. Thaum pib, qhov ntsuas qhov siab siv lub hauv paus-qib siab ntawm 1013.25 mbar. Los ntawm nias lub pob ntawm tus pin 21 lub siab ntawm koj qhov chaw nyob yuav raug siv los ua qhov siv. Txoj hauv kev no nws ua rau nws tuaj yeem kwv yees ntsuas qhov siab dab tsi muaj (piv txwv li thaum tsav tsheb nce toj nrog lub tsheb).

Qhov hu ua "Hypsometric formula" tau siv hauv txoj haujlwm no. Cov mis no ua rau siv qhov ntsuas kub los txhawm rau ntsuas qhov ntsuas.

ntab alt=((powf (qhov chaw / ((ntab) P / 100.0), 0.19022256) - 1.0) * ((ntab) TEMP / 100 + 273.15)) / 0.0065;

Koj tuaj yeem pom ntau ntxiv txog cov mis hypsometric ntawm no:

Cov mis Hypsometric

Cov ntaub ntawv ntsuas ntsuas lub Hoobkas thiab ntsuas kub tau nyeem los ntawm MS5611 lub ntsuas pa thiab siv rau tus lej kom tau txais kev ntsuas raug tshaj plaws. Thaum sim kuv pom tias MS5611 lub ntsuas pa nkag siab rau huab cua ntws thiab qhov sib txawv ntawm lub teeb ci. Nws yuav tsum muaj peev xwm ua kom tau txais txiaj ntsig zoo dua li hauv daim vis dis aus qhia no.

Kauj Ruam 2: Qhov Chaw

1 x Microchip 18f26k22 microcontroller 28-PIN PDIP

3 x MCP23017 16-ntsis I/O Expander 28-pin SPDIP

48 x LED's 3 hli

1 x GY-86 module nrog MS5611, HMC5883L thiab MPU6050 sensors

1 x SH1106 OLED 128x64 I2C

1 x Ceramic capacitor 100nF

1 x 100 Ohm resistor

Kauj Ruam 3: Daim duab Circuit Court thiab PCB

Daim duab Circuit Court thiab PCB
Daim duab Circuit Court thiab PCB

Txhua yam haum rau ntawm ib sab PCB. Nrhiav ntawm no Eagle thiab Gerber cov ntaub ntawv yog li koj tuaj yeem ua nws tus kheej lossis nug tus tsim khoom PCB.

Kuv siv LED Compass thiab Altimeter hauv kuv lub tsheb thiab siv OBD2 interface ua lub zog siv. Lub microcontroller haum zoo meej hauv qhov txuas.

Kauj Ruam 4: Yuav Ua Li Cas Ua Kom Zoo Tshaj Plaws LED nyob hauv Lub Vajvoog Hauv Zaum Ob Nrog Eagle PCB Tsim Software

Koj yuav tsum pom qhov zoo tiag tiag hauv Eagle PCB Tsim Software uas txuag koj cov sijhawm ua haujlwm. Nrog rau qhov Eagle feature koj tuaj yeem ua kom zoo sib xws LEDs hauv lub voj voog hauv vib nas this.

Tsuas yog nyem rau ntawm "File" tab thiab tom qab ntawd "Run ULP". Los ntawm no nyem rau "cmd-draw.ulp". Xaiv "Tsiv", "qib qib" thiab "Vajvoog". Sau lub npe ntawm thawj LED hauv daim teb "npe". Teem cov haujlwm ntawm nruab nrab ntawm lub voj voog ntawm kab sib chaws ntawm cov teb "X chaw sib koom tes" thiab "Y chaw sib koom tes". Hauv qhov haujlwm no yog 48 LEDs yog li 360 faib los ntawm 48 ua 7.5 rau thaj teb "Lub kaum kauj ruam". Lub vojvoog ntawm lub voj voog no yog 1.4 nti. Ntaus nkag mus thiab koj muaj lub voj voog zoo ntawm LEDs.

Kauj Ruam 5: Txheej Txheem Kev Ntsuas Tus Kheej

Image
Image

HMC5883L suav nrog 12 ntsis ADC uas ua rau 1 txog 2 degree Celsius compass compass nqe lus raug. Tab sis ua ntej nws muab cov ntaub ntawv siv tau nws yuav tsum tau ntsuas. Txhawm rau kom muaj txoj haujlwm no nce thiab ua haujlwm tau zoo muaj cov txheej txheem ntsuas no uas muab x- thiab y offset. Nws tsis yog txoj hauv kev zoo tshaj plaws tab sis nws txaus rau txoj haujlwm no. Cov txheej txheem no yuav raug nqi koj tsuas yog ob peb feeb thiab muab txiaj ntsig zoo rau koj.

Los ntawm kev rub thiab khiav cov software no koj yuav raug coj ua hauv cov txheej txheem ntsuas no. Cov zaub OLED yuav qhia koj thaum txheej txheem yuav pib thiab thaum nws xaus. Cov txheej txheem ntsuas ntsuas no yuav nug koj kom tig lub sensor 360 degrees thaum tuav nws kiag li tiaj tus (kab rov tav rau hauv av). Mount nws ntawm lub tripod lossis qee yam zoo li ntawd. Ua qhov no los ntawm tuav nws hauv koj txhais tes tsis ua haujlwm. Thaum kawg qhov offsets yuav nthuav tawm ntawm OLED. Yog tias koj ua cov txheej txheem no ntau zaus koj yuav tsum pom yuav luag sib luag.

Xaiv tau, cov ntaub ntawv sau kuj tseem muaj ntawm RS232 ntawm tus pin 27 (9600 baud). Tsuas yog siv cov phiaj xwm dav dav zoo li Putty thiab sau tag nrho cov ntaub ntawv hauv cov ntaub ntawv teev cia. Cov ntaub ntawv no tuaj yeem nkag tau yooj yim hauv Excel. Los ntawm no koj tuaj yeem pom yooj yim dua li qhov offset ntawm koj li HMC5883L zoo li cas.

Cov offsets tau muab tso rau hauv EEPROM ntawm lub microcontroller. Cov no yuav raug thauj khoom thaum pib ntawm qhov ntsuas thiab ntsuas qhov ntsuas software uas koj yuav pom hauv qib 7.

Kauj Ruam 6: Txheeb Sib Nqus Sib Nqus Ntawm Koj Qhov Chaw

Image
Image
Kev sib tw Sensors
Kev sib tw Sensors

Muaj qhov sib nqus Sab Qaum Teb thiab thaj chaw North (Sab Qaum Teb). Koj lub ntsuas hluav taws xob yuav ua raws lub ntiaj teb cov kab sib nqus sib nqus yog li taw tes rau sab qaum teb sib nqus. Qhov sib txawv ntawm sab qaum teb sib nqus thiab sab qaum teb sab hnub poob yog hu ua qhov sib nqus poob qis. Ntawm kuv qhov chaw qhov kev poob qis tsuas yog 1 degree thiab 22 feeb yog li tsis tsim nyog them nyiaj rau qhov no. Ntawm lwm qhov chaw qhov kev poob qis no tuaj yeem mus txog 30 degrees.

Nrhiav qhov sib nqus sib nqus ntawm koj qhov chaw nyob

Yog tias koj xav kom them nyiaj qhov no (yog nyob ntawm yeem) koj tuaj yeem ntxiv qhov kev poob qis (qib thiab feeb) hauv EEPROM ntawm lub microcontroller. Ntawm qhov chaw 0x20 koj tuaj yeem ntxiv qib qib hauv kos npe hexadecimal daim ntawv. Nws tau kos npe vim tias nws kuj tseem tuaj yeem ua rau tsis pom zoo. Ntawm qhov chaw 0x21 koj tuaj yeem ntxiv cov feeb hauv daim ntawv hexadecimal.

Kauj Ruam 7: Sau Cov Cai

Image
Image

Sau cov cai no thiab ua haujlwm rau koj lub microcontroller. Txoj cai no suav ua qhov tseeb nrog MPLABX IDE v5.20 thiab XC8 compiler v2.05 hauv C99 hom (yog li suav nrog C99 phau ntawv teev npe). Tsis tas li cov ntawv hex muaj nyob yog li koj tuaj yeem hla cov txheej txheem muab tso ua ke. Nco ntsoov tias koj uncheck lub checkbox "EEPROM cov ntaub ntawv enabled" los tiv thaiv calibration cov ntaub ntawv (saib cov kauj ruam 5) yuav tsum overwritten. Teem koj tus programmer rau 3.3 volt!

Los ntawm kev txuas tus pin 27 rau hauv av koj tau txais qhov kub hauv Fahrenheit.

Ua tsaug rau Achim Döbler rau nws libraryGUI nraaj tsev qiv ntawv

Kev sib tw Sensors
Kev sib tw Sensors

Khiav Tawm Hauv Kev Sib Tw Sensors

Pom zoo: