Cov txheej txheem:
- Kauj ruam 1: Tau txais Firmware thiab Libraries
- Kauj Ruam 2: Ua Haujlwm Nrog MicroPython
- Kauj Ruam 3: MicroPython Hla Serial
Video: MicroPython ntawm Txoj Kev Nyuaj Siab Sensor Board: 3 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Ib qho ntawm qhov zoo tshaj plaws ntawm ESP32 microcontroller yog nws lub peev xwm los ua haujlwm MicroPython. Qhov no tuaj yeem ua tiav hauv ob txoj hauv kev: khiav tag nrho cov haujlwm Python, lossis sib cuam tshuam los ntawm daim ntawv thov console. Cov Lus Qhia no yuav ua kom pom kev siv MicroPython yog ob txoj hauv kev siv Kev Nyuaj Siab Zoo Sensor Board. Peb yuav xub xub ua piv txwv daim ntawv thov uas sau cov ntaub ntawv ntsuas qhov ntsuas los ntawm BNO_085 IMU, tom qab ntawd peb yuav siv cov phiaj xwm txuas mus rau cuam tshuam nrog hauv program Python.
Qib: Cov ntawv qhia no kwv yees qee qhov kev paub txog Python, thiab Python tau teeb tsa. Nws tseem kwv yees kev paub txog cov lus txib dav dav dav dav.
Cov Cuab Yeej: Tsuas yog cov cuab yeej peb yuav xav tau yuav yog Lub Rooj Tswjhwm Saib Xyuas Sensor, lub davhlau ya nyob twg, thiab cov phiaj xwm phiaj xwm phiaj xwm. Ntawm Mac, koj tuaj yeem siv qhov davhlau ya nyob twg. Ntawm lub tshuab Windows, koj yuav tsum rub tawm thiab teeb tsa lub davhlau ya nyob twg. Rau serial console. Putty ib txwm yog qhov kev xaiv zoo.
Kauj ruam 1: Tau txais Firmware thiab Libraries
Txhawm rau pib, peb yuav tsum rub tawm cov kev cai tsim los ntawm Complex Arts thiab tom qab ntawd nyem nws mus rau Sensor Board. Cov firmware tuaj yeem pom ntawm no:
Rub tawm cov ntaub ntawv firmware.bin thiab muab tso rau hauv daim nplaub tshev uas koj xaiv. Koj kuj tseem yuav xav tau Txoj Haujlwm Piv Txwv Piv Txwv li no, yog li yuav ua tau tam sim no; mus rau: https://github.com/ComplexArts/SensorBoardPython thiab git clone lossis rub mus rau qhov chaw koj xaiv.
Thaum koj tau txais cov ntaub ntawv, peb yuav xav tau ob peb pob rau cuam tshuam nrog ESP32. Thawj pob peb yuav xav tau yog esptool.py. Txhawm rau nruab nws, tsuas yog ntaus
pip nruab esptool
hauv lub davhlau ya nyob twg.
Thaum esptool raug teeb tsa, peb tuaj yeem tshem tawm tom qab rov nyem lub nti. Txhawm rau ua li ntawd, nkag mus
esptool.py --chip esp32 --port COM4 lwv_flash
rau qhov chaw nres nkoj, nkag mus rau qhov chaw nres nkoj txuas uas ua ke nrog Sensor Board. Ntawm Mac, uas yuav zoo ib yam li --port /dev /ttyUSB0
Thaum qhov no ua tiav, peb yuav nyem lub nti nrog:
esptool.py --chip esp32 --port COM4 --baud 460800 write_flash -z 0x1000 firmware.bin
Ib zaug ntxiv, hloov chaw nres nkoj raws li.
Kauj Ruam 2: Ua Haujlwm Nrog MicroPython
Yog tias peb tshuaj xyuas cov ntawv tso tawm ntawm Sensor Board ntawm lub sijhawm no, peb yuav pom Python REPL (nyeem-ntsuas-luam tawm lub voj: >>>) Txhawm rau ua qhov no, peb yuav xav tau qhov kev pabcuam txuas ntxiv. Putty yog qhov kev xaiv zoo raws li nws muab kev xaiv rau SSH thiab telnet, tab sis kuj tseem muaj kev sib txuas lus yooj yim raws li peb yuav ua ntawm no. putty.org. Thaum koj tau teeb tsa qhov ntawd, qhib nws thiab xaiv "Serial" nyob rau hauv "Hom Kev Sib Txuas:" Koj yuav tsum tau ntaus hauv tib lub npe chaw nres nkoj uas koj tau nkag rau esptool saum toj no, tom qab ntawd baud tus nqi ntawm 115200 rau Kev Ceev. Mus tom ntej thiab nyem "Qhib". Thiab muaj Python!
Tam sim no peb yuav xav upload thiab khiav peb tus piv txwv piv txwv. Txhawm rau ua qhov ntawd, mus rau daim nplaub tshev uas koj tau khaws tseg ua ntej SensorBoardPython piv txwv. Peb yuav xav tau Adafruit qhov txaus ampy pob. Koj tuaj yeem nruab qhov ntawd nrog:
pip nruab adafruit-ampy = 0.6.3
Thaum koj muaj nws, siv ampy txhawm rau rub tus piv txwv ntsuas mus rau pawg thawj coj:
ampy -p COM4 muab accelerometer.py
(hloov chaw nres nkoj raws li, tau kawg). Tam sim no rov pib dua koj lub rooj tsavxwm nrog khawm rov pib dua. Peb yuav rov qab mus rau Putty ntawm qhov no thiab ntawm >>> sai, ntaus ntawv
ntshuam accelerometer
Viola! Tam sim no koj tab tom khiav qhov accelerometer.py code ntawm Sensor Board! Txoj cai yuav khiav rau 20 vib nas this, tom qab ntawd nres. Daim ntawv ceeb toom tias thaum tus lej ntsuas tus lej ua haujlwm, lub xiav LED ntawm lub rooj tsavxwm ntsais muag. Txog rau cov paub ntau dua nrog Python, koj yuav pom qhov no ua tiav yam tsis muaj xov thiab tsis ncua (). Qhov ntawd yog vim siv Python lub tsev qiv ntawv asyncio, uas muab txoj hauv kev zoo rau kev ua haujlwm ib txhij thiab muaj txiaj ntsig zoo ntawm kev teeb tsa platform xws li ESP32. Yog tias koj tsis paub nrog nws, nws tsim nyog txheeb xyuas; muaj cov lus qhia zoo ntawm no: https://github.com/peterhinch/micropython-async/b… (tab sis ceeb toom, nws 'taub hau me ntsis).
Kauj Ruam 3: MicroPython Hla Serial
Rov qab mus rau txoj haujlwm ntawm tes! Thaum tus lej ntsuas qhov ntsuas nres, koj yuav pom Python >>>. Tam sim no peb tuaj yeem cuam tshuam cov phiaj xwm siv Sensor Board ua peb tus neeg txhais lus Python. Txhawm rau ua li ntawd, nkag mus
>> x = np
>> y = 11
>> x + y
21
Thaum qhov no yog qhov piv txwv yooj yim tshaj plaws, peb tuaj yeem pib tsim ntau txoj cai siv Complex Arts cov tsev qiv ntawv los ua qhov pib. Qhov no tso cai rau koj los ntsuas qhov ntsuas thiab txav ntawm ya, nrog kev tswj lub sijhawm tiag. Nrog GPIO pins muaj nyob ntawm Sensor Board, koj tuaj yeem npaj tau yooj yim txuas servos, teeb, ntsuas, lub cev muaj zog, lossis ib tus lej ntawm lub cev, siv lawv ob qho tib si sib tham, lossis dhau los ntawm Python program. Muaj kev lom zem!
Yog xav paub ntxiv, txheeb xyuas lwm cov peev txheej no:
complexarts.net/home/
complexarts.net/docs/bno085/
Pom zoo:
Kev Tsim Nyog Txoj Kev Nyuaj Siab Semarang: 8 Kauj Ruam
Lub Teeb Nyhav Txoj Kev Tsim Kho Semarang: Lub tsev kawm ntawv txoj haujlwm Raws li tsev kawm ntawv txoj haujlwm rau Rotterdam University of Applied Science peb yuav tsum tau los daws teeb meem rau ob qho kev nce qib dej thiab qhov av nyob hauv Semarang, Indonesia. Cov khoom lag luam hauv qab no tau tsim thaum lub sijhawm no
Lub Quarantine Escape (Txoj Kev Nyuaj Siab) Box: 7 Cov Kauj Ruam (nrog Duab)
A Quarantine Escape (Tus Neeg Nyuaj Siab) Box: Qhov haujlwm no yog kuv tus kheej Arduino Quarantine Project. Kuv tau ua haujlwm tsis tu ncua rau thawj ob peb lub lis piam mus rau hauv kev cais tawm, tab sis tom qab ntawd kuv tau khiav mus rau qee qhov teeb meem siv servo motors uas kuv tsis tuaj yeem daws tau yooj yim, yog li kuv tso nws tseg rau ob peb lub lis piam
Txoj Kev Nyuaj Siab: 8 Kauj Ruam
Txoj Kev Nyuaj Siab Tsis Zoo: Rau txoj haujlwm no, peb tab tom tsim lub pluaj ntaus nrig nrog lub hauv caug ua haujlwm. Peb yuav xub tsim tawm peb cov pedal los ntawm kos siv cov khoom siv DIY muaj los ntawm (https://www.modkitsdiy.com/), tom qab ntawd hloov kho tus qauv kom suav nrog FSR (quab yuam-r
Kev Nyuaj Siab Ntawm Kev Tsim Lub Hwj Huam Ua Tau Raws Li Li Cas Los Ntawm DC-DC Technologies: 3 Kauj Ruam
Cov Kev Sib Tw Ntawm Cov Khoom Siv Hluav Taws Xob Ua Tau Raws Li DC-DC Cov thev naus laus zis li cas: Kuv yuav tshuaj xyuas qhov kev sib tw ntawm cov khoom siv hluav taws xob sib ntsib los ntawm DC-DC Technologies.Power system cov tsim qauv tau ntsib qhov tsis tu ncua los ntawm kev ua lag luam txhawm rau nrhiav txoj hauv kev kom ua tau zoo tshaj plaws hwj chim. Hauv cov khoom siv nqa tau, kev ua haujlwm siab dua ntxiv
Kev Nyuaj Siab: Kev Saib Xyuas thiab Saib Xyuas Ntxiv rau Kev Teeb Meem: 9 Cov Kauj Ruam
Hard Drive: Kev Saib Xyuas thiab Kev Saib Xyuas Ntxiv Teeb Meem: Daim duab saum toj no yog Hard Drive ib txwm muaj. Cov no yog cov tsav tsheb feem ntau siv niaj hnub no, tab sis tsis tas yuav nrawm tshaj. Tib neeg siv tus tsav no rau nws tus nqi qis dua gigabyte thiab lub neej ntev dua. Phau ntawv qhia no yuav qhia koj txog qhov sib txawv