Cov txheej txheem:

Kuv Puas Siv TinyLiDAR Hauv Kos?: 3 Kauj Ruam
Kuv Puas Siv TinyLiDAR Hauv Kos?: 3 Kauj Ruam

Video: Kuv Puas Siv TinyLiDAR Hauv Kos?: 3 Kauj Ruam

Video: Kuv Puas Siv TinyLiDAR Hauv Kos?: 3 Kauj Ruam
Video: Txhob Nco Kuv Lawm Nkauj Hmoob🌹Puas Coos Khem🌹Xis Thoj🌹official MV 2023 2024, Kaum ib hlis
Anonim
Kuv Puas Siv TinyLiDAR Hauv… Kos?
Kuv Puas Siv TinyLiDAR Hauv… Kos?

Peb tau txais kev thov txhua lub sijhawm tam sim no los nug yog tias me meLiDAR yuav ua haujlwm ntawm lawv lub platform tshwj xeeb suav nrog. Txawm hais tias me meLiDAR tau tsim los ua qhov yooj yim siv LiDAR sensor rau Arduino UNO, tsis muaj ib yam dab tsi nres nws los ntawm kev siv rau lwm lub platform zoo li Raspberry Pi (raws li qhia hauv cov lus qhia yav dhau los ntawm no). Ntawd yog, yog tias lub platform muaj lub npav I2C thiab tuaj yeem txhawb nqa lub sijhawm ncua ntawm I2C qhov tshwj xeeb. Yog li - ua li cas yog tias koj lub rooj tsav xwm tsis txawm txhawb I2C? - tsis txhob mloog lub sijhawm ncab cov khoom … Zoo uas yuav yog qhov xwm txheej nyuaj tab sis qhov tseeb nws yeej muaj nyob rau qhov nrov tshaj qhov muag pom cov lus programming hu ua "Kos".

Google nws yog tias koj tsis tau hnov dua nws ua ntej tab sis hauv qhov yooj yim, nws yog thawj hom lus zoo rau txhua tus kom ua rau lawv lub siab nkag mus rau hauv lub cajmeem. Kos tau tsim los ntawm MIT Media Lab thiab tau nyob ib puag ncig rau ntau dua 16 xyoo tam sim no. Nws yog lus Goto rau kev qhia menyuam yaus kom paub cai thoob ntiaj teb. Txhua tus tuaj yeem pib siv nws dawb - raws li nws ib txwm ua haujlwm ntawm koj lub desktop hauv lub vev xaib. Txheeb nws tawm ntawm no yog tias koj nyiam.

TL; DR version

YOG! Nrog tus yam ntxwv tshiab hu ua "Ultrasonic Emulation Mode" hauv me meLiDAR f/w version 1.3.9

Kauj Ruam 1: Kos Dab Tsi?

Muaj ntau qhov tsw ntawm Kos hauv cov tsiaj qus tam sim no. Cov neeg nyiam siv neeg hlau nyiam siv GPIO tsom mus rau cov qauv zoo li ScratchGPIO lossis lwm yam hloov pauv zoo li ScratchX uas tuaj yeem ua los txhawb ib qho 'kev sim kho vajtse'. Tag nrho cov no yog qhov zoo rau cov neeg siv qib siab tab sis cov ntsiab lus tseem ceeb uas tau teeb tsa los ntawm lub hauv paus ntawm pi yuav yog peb lub hom phiaj rau qhov kev qhia no vim tias lawv muaj kev xaiv kho vajtse tsawg.

Tus pi's Raspbian Stretch Desktop los nrog ob qho qauv ntawm Scratch ua ntej teeb tsa. Ntawd yog, "Kos" thiab "Kos 2". Peb yuav siv thawj qhov aka "Scratch 1.4 (NuScratch)" thiab yuav siv nws "offline" kom peb tuaj yeem siv GPIO server feature.

Koj tuaj yeem rub tawm cov duab pi duab raug cai ntawm no.

Vim li cas los xij, Scratch tus tsim tau txiav txim siab txhawb nqa tsuas yog qee qhov ntawm cov khoom siv feem ntau muaj los ntawm cov tuam txhab loj xws li Lego thiab lwm yam. Qhov no yog, tau kawg, muaj txiaj ntsig zoo tshaj plaws nyob deb nrug deb ntawm lub ntsej muag uas yooj yim tso tawm ib qho dav dav mem tes uas yog sib piv rau qhov ntsuas nrug.

Kev ntsuas qhov tseeb tuaj yeem sib txawv me ntsis nyob ntawm huab cua kub, av noo thiab cov khoom siv lub hom phiaj raws li tau hais ntawm no, ntawm no thiab ntawm no. Tab sis feem ntau, tsuas yog hais txog ib lub platform tuaj yeem ntsuas qhov dav dav ntawm cov khoom siv no.

Kauj Ruam 2: Feature Tshiab

Tshiab Feature
Tshiab Feature

Tso tawm qhov tseeb microsecond-scale pulses tsis yog teeb meem rau peb ntawm meLiDAR raws li peb muaj cov khoom siv daws teeb meem siab kho vajtse timers sab hauv ntawm on-board 32bit micro. me meLiDAR kuj ib txwm pib ntsuas ntsuas kub vim nws muaj zog li ntawd tsis muaj kev hloov kho ntxiv yog qhov tsim nyog rau kev ua haujlwm ib puag ncig.

Cia Peb Ua Nws

Okay - peb tuaj yeem yog li peb tsuas yog ntxiv qhov tshiab rau me meLiDAR (raws li ntawm firmware 1.3.9) hu ua "Ultrasonic Emulation Mode". Koj tuaj yeem nkag nws los ntawm kev siv "u" hais kom ua los ntawm qhov hloov tshiab me meLiDAR GUI Terminal.

Kev siv nws yuav hloov pauv qhov chaw nyob hauv lub cim xeeb tsis hloov pauv yog li nws yuav ua rau me me LiDAR zoo ib yam li lub ntsuas hluav taws xob ultrasonic txawm tias tom qab koj tsis muaj zog nws. Koj tuaj yeem hloov nws rov mus rau hom I2C ib txwm los ntawm nias lub pob pib dua thiab muab lo lus "az". Cov ntsiab lus ntxiv yog nyob hauv phau ntawv siv.

Txhawm rau ua kom lub neej yooj yim dua, peb tab tom ua qhov me me LiDAR sensor muaj ua ntej rau qhov tshiab Ultrasonic Emulation Mode los ntawm peb lub vev xaib. Tsuas yog xaj "-u" version.

Saib Ma, Tsis muaj Soldering

Tsis muaj qhov txuas thiab kuj tsis muaj daim ntawv tais diav xav tau xws li suav nrog "Grove to Female 4pin" cables yuav ntsaws ncaj qha rau hauv Raspberry pi header pins. Tus ntsuas tus pin yog xaim daj thiab tus ncho tus pin yog Cov Hlau Dawb. Dub thiab Liab yog rau lub zog ntawm chav kawm. Xa mus rau daim duab tseem ceeb saum toj no kom paub meej.

Btw, peb tau mus ib kauj ruam ntxiv thiab ua rau tus lej daj coj zoo ib yam li PING)))) sensor uas siv ib tus xaim rau ob qho ua rau thiab ua rau lub suab nrov.

Vim li no, koj tam sim no tuaj yeem ntsuas nrog me meLiDAR siv lub neej ntawd "PING" ultrasonic kos duab uas nkoj nrog txhua Arduino IDE yam tsis muaj kev hloov pauv tus lej! Koj tuaj yeem sim nws yam tsis tau ncua ib yam.

Yog lawm, koj tuaj yeem teeb tsa qhov ntsuas zoo li qhov raug siab, nrug deb lwm yam ntawm koj LiDAR kev ntsuas ua ntej xaiv qhov "u" hais kom ua thiab tom qab ntawd nws yuav ntsuas qhov ntsuas txhua lub sijhawm nws pom tus lej pin poob raws li qhia hauv daim duab saum toj no.

Kev phom sij, Yuav Robinson

Nco tseg SR04 lub ntsuas hluav taws xob ultrasonic xav tau qee qhov tiv thaiv kom tiv thaiv +5v cov khoom los ntawm kev puas tsuaj koj li pi. Tab sis txij li me meLiDAR khiav ib txwm los ntawm +3.3v, tsis tas yuav muaj ib qho kev tawm tsam los cuam tshuam nrog pi:)

Kauj ruam 3: Coding Nws

Coding Nws
Coding Nws
Coding Nws
Coding Nws

Yog li ntawd, dab tsi yog txoj cai peb xav tau rau me meLiDAR los ua haujlwm hauv Kos?

Zoo siab koj nug!

Nws tsuas yog teeb meem ntawm kev rub ob peb kab lus tshaj tawm yooj yim raws li qhia hauv cov duab saum toj no.

Txhawm rau pab kom GPIO tus pin peb tuaj yeem tshaj tawm "tshaj tawm gpioserveron" Tom qab ntawd teeb tsa tus lej pin peb tshaj tawm "tshaj tawm config16out" Tom ntej no peb tuaj yeem teeb tsa tus ncho tus pin los ntawm "tshaj tawm config26in" thiab tom qab ntawd pib ntsuas los ntawm "tshaj tawm ultrasonictrigger16echo26". Qhov no yuav ua rau ntsuas ntsuas tas mus li ntawm 140ms cadence. Koj tuaj yeem nyeem cov ntaub ntawv ntsuas los ntawm kev siv lub siab ntsuas "ultrasonic nrug sensor tus nqi".

Zoo uas yog tam sim no, ua tsaug rau kev nyeem thiab nco ntsoov txheeb xyuas qhov kev lom zem me me Scratch demo program (sib qhia ntawm no) peb tau hu ua "me meLiDAR_catch_me" thiab … Kos rau!;)

Pom zoo: