Cov txheej txheem:

CircuitPython thiab TinyLiDAR: Piv Txwv Yooj Yim: 3 Kauj Ruam
CircuitPython thiab TinyLiDAR: Piv Txwv Yooj Yim: 3 Kauj Ruam

Video: CircuitPython thiab TinyLiDAR: Piv Txwv Yooj Yim: 3 Kauj Ruam

Video: CircuitPython thiab TinyLiDAR: Piv Txwv Yooj Yim: 3 Kauj Ruam
Video: Arduino VS CircuitPython Speed Comparison 2024, Kaum ib hlis
Anonim
CircuitPython thiab TinyLiDAR: Piv txwv yooj yim
CircuitPython thiab TinyLiDAR: Piv txwv yooj yim

MicroElectronicDesign me meLiDAR yog ST VL53L0X raws lub sijhawm-ntawm-davhlau (ToF) suav nrog cov qauv nrog i2c npav txuas. Adafruit microcontroller boards tau yooj yim txuas nrog lub ntsuas no vim lawv tuaj yeem hais lus i2c raws tu qauv hla lawv cov ntaub ntawv pins.

M0/M4 series muaj qhov zoo dua lwm cov laug cam vim tias lawv txhawb nqa ib pawg ntawm Python uas ua rau cov phiaj xwm nkag tau mus rau cov neeg siv ntau dua li C ntawm Arduino. Nov yog qhov piv txwv yooj yim siv CircuitPython ntawm lub Rooj Tswjhwm Saib Gemma M0 los nyeem qhov kev ntsuas qhov deb ntawm me me LiDAR thiab qhia qhov nrug deb los ntawm qhov sib txawv qhov ci ntawm lub teeb RGB LED. Pawg thawj coj yuav tsum yog M0 version rau kev txhawb nqa nab hab sej.

Nco tseg: Adafruit tseem ua ntau yam kev ntsuas pom kev nrug deb suav nrog ib qho raws VL53L0X.

Kauj ruam 1: CircuitPython Code

  1. Rub tawm lib/adafruit_dotstar.mpy thiab lib/adafruit_bus_device/i2c_device.mpy yog tias koj tsis muaj lawv. Cov no yog ib feem ntawm kev xaiv lub tsev qiv ntawv pob, saib thawj ntu ntawm CircuitPython I2C rau kev sau ntawv yuav ua li cas rau nruab cov no. Cov ntaub ntawv no yuav tsum mus hauv lib thiab lib/adafruit_bus_device cov npe ntawm Gemma M0.
  2. Rub tawm gemma-m0-tinylidar-simple.py, hloov nws mus rau main.py thiab luam rau lub hauv paus npe ntawm Gemma M0.

Qhov kev zov me nyuam sau cov ntawv tso tawm rau lub tshuab txuas ntxiv nrog rau qhov sib txawv ntawm qhov ci ci ntawm Gemma MO RGB LED nyob rau hauv kev faib ua feem rau kev nyeem nrug. Lub Gemma M0 coj hloov ntawm ntawm thiab tawm rau nyeem yog li yuav nyem ntawm kwv yees li 5Hz thiab kev coj ua tsis raug ntawm lub me meLiDAR lub rooj tsavxwm yog nyem nws cov xim xiav coj los hais kom ua ntawm 10Hz.

Lub tsheb npav tau tsav ntawm 100kHz uas ua haujlwm zoo rau rooj plaub no. Zoo li txhua lub npav, kev sib txuas lus sib txuas lus nrawm tau txwv los ntawm cov yam ntxwv ntawm cov kab sib kis (s) yog li yuav tsum tau them nyiaj mloog kom ntev, lub peev xwm thiab lwm yam.

Kauj Ruam 2: Txuas TinyLiDAR mus rau Gemma M0

Txuas TinyLiDAR mus rau Gemma M0
Txuas TinyLiDAR mus rau Gemma M0

Daim duab qhia tau tias muaj txiaj ntsig tab sis tsis tsim nyog teeb tsa ib ntus los txuas qhov me meLiDAR mus rau Gemma M0 board. Me meLiDAR's "Grove" 4pin tus txuas txuas thoob ntiaj teb tau siv los ntawm Seeed Grove hloov pauv cable, lub taub hau ntsaws thiab cov khej kab txuas los txuas rau Gemma M0. Qee qhov sib cais ntawm cov pins ntawm lub taub hau tshem tawm qhov kev pheej hmoo ntawm qhov tsis raug. Cov kev sib txuas yog:

  • Dub: gnd rau gnd
  • Liab: +V rau 3Vo
  • Dawb: SDA rau D0 (cov ntaub ntawv)
  • Daj: SCL rau D2 (moos)

Adafruit cov laug cam muaj qee tus pin uas txhawb nqa i2c cov txheej txheem ua tau zoo hauv kho vajtse. Hauv qhov xwm txheej ntawm Gemma M0, cov no yuav tsum tau siv, D0 rau cov ntaub ntawv thiab D2 rau moos.

Lub tsheb npav i2c xav kom rub tus neeg tawm tsam ntawm cov ntaub ntawv thiab kab kab. Hauv qhov no, qhov me meLiDAR muab qee qhov 4.7K on-board resistors. Yog tias cov no tau raug tshem tawm ntawm Circuit Court los ntawm kev txiav cov kab ces qhov sib npaug yuav tsum tau ntxiv rau hauv Circuit Court.

Kauj ruam 3: Serial Output

Serial Tso Tawm
Serial Tso Tawm

Qhov kev zov me nyuam sau qhov tso tawm mus rau lub console txuas qhia qhov ntsuas ntsuas, ntawm no yog qhov piv txwv piv txwv ntawm lub davhlau ya nyob twg qhia qhov khoom txav deb ntawm lub ntsuas cua.

Pom zoo: