Cov txheej txheem:

MicroPython PCF8591 DACtest: 3 Cov Kauj Ruam (nrog Duab)
MicroPython PCF8591 DACtest: 3 Cov Kauj Ruam (nrog Duab)

Video: MicroPython PCF8591 DACtest: 3 Cov Kauj Ruam (nrog Duab)

Video: MicroPython PCF8591 DACtest: 3 Cov Kauj Ruam (nrog Duab)
Video: Master GPIO with Raspberry Pi Pico & MicroPython - Uncover the Secrets! 2024, Kaum ib hlis
Anonim
MicroPython PCF8591 DACtest
MicroPython PCF8591 DACtest

Kuv yuav phau ntawv no txhawm rau txhim kho kuv li Micropython-txawj: MicroPython rau ESP8266 Rhiav Kev Txhim Kho los ntawm Agus Kurniawan. Phau ntawv no yog pib zoo heev, I2C txoj haujlwm siv PCF8591 tus qauv. Tab sis tsis muaj DAC qhov piv txwv li ntawd kuv yuav tsum txiav txim siab tawm ntawm kuv tus kheej:-).

Khoom siv

Peb xav tau dab tsi:

- Wemos D1R2 (lossis D1mini) ESP8266 ci nrog qhov tseeb MicroPython pom ntawm no

-PCF8591 module: pom ntawm no

-DMM lossis oscilloscope (zoo dua: qhov haujlwm no tsim cov sawtooth waveform)

- Lub laptop lossis PC nrog Thonny IDE (lossis uPyCraft) -USB cable txuas D1R2 rau lub khoos phis tawj

Kauj Ruam 1: Npaj PCF8591 Module, Flash WemosD1R2 Nrog MicroPython

Npaj PCF8591 Module, Flash WemosD1R2 Nrog MicroPython
Npaj PCF8591 Module, Flash WemosD1R2 Nrog MicroPython

Ua ntej kev sim Kuv tau tshuaj xyuas tus qauv thiab pom A0 chaw nyob tsis txuas thiab nthuav tawm ntawm cov khoom siv txuas. Kuv tsab ntawv siv adress 72 (decimal) yog li tus pin no yuav tsum txuas nrog GND.

Saib Datasheet rau txhua cov ntaub ntawv. Qhov duab qhia pom cov xaim xaim txuas GND thiab A0.

Wemos D1R2 yuav tsum tau flashed nrog MicroPython. Ahmed Nouira ua txoj haujlwm zoo thiab piav qhia txhua yam ntawm no. Ua haujlwm nrog Micropython tuaj yeem ua tiav ntawm REPL thiab lub davhlau ya nyob twg emulator tab sis nws yooj yim dua nrog IDE: Kuv siv Thonny IDE ntawm Linux.

Txhua cov ntaub ntawv ntawm Thonny IDE muaj nyob ntawm no. RNT blog piav qhia yuav siv uPyCraft li cas, lwm IDE rau Windows cov neeg siv (Kuv tau sim tab sis kuv li qub Linuxlaptop tsis yuav uPyCraft …).

Kauj Ruam 2: Txuas D1R2 rau PCF8591

Txuas D1R2 rau PCF8591
Txuas D1R2 rau PCF8591

Kuv tshem tawm txhua tus dhia los ntawm PCF8591 tus qauv, lawv txuas lub lauj kaub, LDR, thermistor rau cov tswv yim thiab cov khoom sib piv rau LED. Yog tias DAC cov zis tau ntim nrog 10k resistor nws yuav ua rau cov zis tso tawm vim li cas thiaj tso lub LED tso rau ntawd?

Nov yog Daim Ntawv Teev Npe Hluav Taws Xob:

WemosD1R2 PCF8591

3v3 wb

GND GND

SCL (D1) SCL

SDA (D2) SDA

xyuas kom lub jumper hlau txuas nrog A0 rau GND yog tias koj sim kuv tsab ntawv (ua dag):-)

Kauj Ruam 3: Thauj Cov Ntawv thiab Xeem

Yog tias koj siv Thonny IDE koj tuaj yeem rub DAC.py thiab DAC1.py, thiab thauj lawv mus rau D1R2

rau kev sim. Yog tias Koj Siv REPL nkag mus rau kab ib kab, nws yog ib qho yooj yim heev thiab cov ntawv luv.

DAC.py yog lub tshuab hluav taws xob sawtooth yooj yim (txheeb xyuas los ntawm qhov muaj peev xwm) thaum DAC1.py muaj 1s ncua kev ua haujlwm yog li koj tuaj yeem siv DMM.

Muaj Kev Lom Zem!

Pom zoo: