Cov txheej txheem:

Taw qhia ESP32 Lora OLED Zaub: 8 Kauj Ruam
Taw qhia ESP32 Lora OLED Zaub: 8 Kauj Ruam

Video: Taw qhia ESP32 Lora OLED Zaub: 8 Kauj Ruam

Video: Taw qhia ESP32 Lora OLED Zaub: 8 Kauj Ruam
Video: Saib Taw qhia txog neeg tus yam ntxwv, cwj pwm thiab txoj Hmoov 2024, Hlis ntuj nqeg
Anonim
Image
Image
Taw qhia ESP32 Lora OLED Zaub
Taw qhia ESP32 Lora OLED Zaub

Nov yog lwm cov vis dis aus hais txog Kev Taw Qhia rau ESP32 LoRa. Lub sijhawm no, peb yuav hais lus tshwj xeeb txog cov duab nraaj (ntawm 128x64 pixels). Peb yuav siv SSD1306 lub tsev qiv ntawv los nthuav qhia cov ntaub ntawv ntawm OLED cov duab no thiab nthuav qhia piv txwv ntawm cov duab siv XBM cov duab.

Kauj Ruam 1: Cov Khoom Siv

Cov peev txheej siv
Cov peev txheej siv

1 Heltec WiFi LoRa 32

Protoboard

Kauj ruam 2: Zaub

Zaub
Zaub
Zaub
Zaub

Cov zaub siv ntawm pawg thawj coj loj yog OLED ntawm 0.96 nti.

Nws muaj 128x64 thiab yog monochrome.

Nws muaj I2C kev sib txuas lus thiab txuas nrog ESP32 ntawm 3 xov hlau:

SDA ntawm GPIO4 (rau cov ntaub ntawv)

SCL ntawm GPIO15 (rau moos)

RST ntawm GPIO16 (rau rov pib dua thiab pib pom)

Kauj Ruam 3: SSD1306 Library

SSD1306 Lub Tsev Qiv Ntawv
SSD1306 Lub Tsev Qiv Ntawv

Qhov no tuaj yeem pom ua ke nrog teeb tsa cov tsev qiv ntawv muab los ntawm Heltec-Aaron-Lee.

Nws muaj ntau txoj haujlwm rau sau cov hlua, kos kab, duab plaub, lub voj voos, thiab tso duab.

github.com/Heltec-Aaron-Lee/WiFi_Kit_series

Kauj Ruam 4: Cov Animation thiab XBM Cov Ntaub Ntawv

Animation thiab XBM Cov Ntaub Ntawv
Animation thiab XBM Cov Ntaub Ntawv
Animation thiab XBM Cov Ntaub Ntawv
Animation thiab XBM Cov Ntaub Ntawv
Animation thiab XBM Cov Ntaub Ntawv
Animation thiab XBM Cov Ntaub Ntawv

Peb yuav siv lub tsev qiv ntawv kosXbm ua haujlwm los tso saib cov tsiaj ntawv.

XBM cov duab hom muaj cov kab ntawv ntawm cov cim uas txhua lub ntsiab lus sawv cev rau ib txheej ntawm cov xim ib txwm (1 me ntsis txhua), los ntawm tus lej hexadecimal. Cov no yog sib npaug rau ib byte.

Vim tias ntau tus cim tau siv los sawv cev rau ib qho byte nkaus xwb, cov ntaub ntawv no zoo li loj dua li cov uas tau siv tam sim no. Qhov zoo dua yog lawv tuaj yeem suav sau ncaj qha yam tsis xav tau kev kho mob ua ntej.

Ntxiv rau qhov array, ob qhov chaw uas txiav txim siab cov duab loj tau suav nrog.

Txhawm rau tsim cov duab, peb xav tau cov duab uas yuav tsim cov thav duab.

Peb tuaj yeem siv cov software kho duab los ua haujlwm. Tsuas yog kev ceev faj peb yuav tsum tau ua yog ua ntej khaws qhov loj sib xws nrog cov zaub thiab siv cov ntaub ntawv monochrome.

Txhawm rau tsim cov ntaub ntawv, peb tuaj yeem kos lawv lossis rub cov duab. Ntawm no, peb txiav txim siab kho cov duab xim siv PaintBrush, thiab peb kos txhua tus ntawm tus thav duab

Thawj daim duab - 960x707 pixels - hom ntawv PNG

Cov kauj ruam tom ntej yog ua kom nws monochrome los ntawm kev txuag nws ua monochrome bitmap.

Tom qab ntawd, peb hloov nws mus rau qhov loj me sib xws nrog cov zaub.

Them nyiaj tshwj xeeb rau cov ntsuas ntsuas. Hauv qhov no, peb hloov kho cov duab kom nws nyob tag nrho qhov siab ntawm cov zaub (ntsug = 64 pixels).

Nrog cov duab hauv qhov loj me, peb yuav kho nws kom tsim cov thav duab. Ntawm no, peb tab tom tshem tawm txhua lub arc ntawm qib teeb liab thiab txuag lawv raws qhov sib xws.

Tam sim no, peb yuav tsum hloov cov ntaub ntawv BMP rau XBM hom.

Muaj ntau txoj kev xaiv software uas tuaj yeem ua qhov kev hloov pauv no. Peb kuj tau xaiv GIMP ua tus xaiv xaiv.

Hauv peb qhov piv txwv, peb siv PaintBrush los tsim thiab kho cov ntaub ntawv. Txawm li cas los xij, txhua qhov ntawm cov txheej txheem no tuaj yeem ua tiav hauv Gimp (lossis lwm yam kev hloov kho).

Txhawm rau hloov pauv, peb xub qhib cov ntawv.

Nrog daim duab qhib, peb tuaj yeem xaiv Cov Ntaub Ntawv => Export li …

Hauv qhov Export Image window, peb yuav tsum hloov cov ntaub ntawv txuas ntxiv mus rau XBM. Gimp yuav yog tus saib xyuas lub hom phiaj xav tau thiab nthuav qhia ntau txoj hauv kev…

Thaum xa tawm, Gimp yuav nthuav qhia lwm txoj hauv kev. Peb tuaj yeem tawm qhov txiaj ntsig qub.

Tom qab hloov tag nrho cov ntaub ntawv, peb yuav muaj plaub XBM cov ntaub ntawv, ib qho rau txhua tus ncej.

Tam sim no cia peb theej lawv mus rau qhov chaws cim npe thiab hloov lawv los ntawm kev hloov lawv qhov txuas mus rau.h.

Kauj Ruam 5: Tawm XBM Cov Ntaub Ntawv

Tawm XBM Cov Ntaub Ntawv
Tawm XBM Cov Ntaub Ntawv

Peb tuaj yeem qhib XBM cov ntaub ntawv hauv ib qho ntawv kho lus, qhov uas peb yuav pom cov duab sib piv thiab cov ntaub ntawv cov duab loj uas twb tau hais tseg lawm.

Kauj ruam 6: Source Code

Source Code: Cov nqe lus

Peb yuav suav nrog cov tsev qiv ntawv tsim nyog, ntxiv rau cov ntaub ntawv duab. Peb txhais cov haujlwm ntawm daim duab thiab ncua sijhawm hloov pauv. Peb kuj taw tes OLED pins txuas nrog ESP32. Thaum kawg, peb tsim thiab kho cov khoom pom.

// Incluindo as bibliotecas necessárias #include #include "SSD1306.h" // Incluindo os arquivos de imagem #include "frame1.h" #include "frame2.h" #include "frame3.h" #include "frame4.h" // definições de posição da imagem e intervalo de transição #define posX 21 #define posY 0 #define intervalo 500 // Pinos ua OLED estão conctados ao ESP32: I2C // OLED_SDA - GPIO4 // OLED_SCL - GPIO15 // OLED_RST - - GPIO16 #define SDA 4 #define SCL 15 #define RST 16 // O RST deve ser controlado por software SSD1306 zaub (0x3c, SDA, SCL, RST); // Cria e ajusta o Objeto zaub

Source Code: Teeb ()

Pib cov zaub thiab ntxeev ntsug ntawm lub vijtsam. Kev ua yog xaiv tau.

teeb tsa tsis muaj dabtsis () {display.init (); // inicia o tso saib display.flipScreenVertically (); // inverte verticalmente a tela (xaiv tau)}

Tau qhov twg los Code: Loop ()

Thawj qhov ua hauv lub voj yog tshem qhov screen. Peb thauj tus ncej 1 mus rau qhov tsis siv posX thiab posY thawj txoj haujlwm. Peb qhia qhov loj me ntawm daim duab nrog frame1_width thiab frame1_height, thiab lub npe ntawm cov kab uas muaj cov khoom me me ntawm daim duab. Peb qhia qhov tsis nyob ntawm cov zaub thiab tos rau ib ntus ua ntej qhia tus ncej tom ntej.

lub voj void () {display.clear (); // limpa tela // carrega para o buffer o frame 1 // usando as posições iniciais posX e posY // informa o tamanho da imagem com frame1_width e frame1_height // informa o nome da matriz que contem os bits da imagem, no caso frame1_bits display.drawXbm (posX, posY, frame1_width, frame1_height, frame1_bits); // mostra o tsis muaj zaub display.display (); // aguarda um intervalo antes de mostrar o próximo thav duab ncua (intervalo);

Peb rov ua cov txheej txheem rau tag nrho lwm cov thav duab.

// rov ua dua cov txheej txheem rau todos os outros thav duab display.clear (); display.drawXbm (posX, posY, frame2_width, frame2_height, frame2_bits); display.display (); ncua (intervalo); display.clear (); display.drawXbm (posX, posY, frame3_width, frame3_height, frame3_bits); display.display (); ncua (intervalo); display.clear (); display.drawXbm (posX, posY, frame4_width, frame4_height, frame4_bits); display.display (); ncua (intervalo); }

Kauj Ruam 7: Ua UpLoad of Code

Ua UpLoad ntawm Code
Ua UpLoad ntawm Code
Ua UpLoad ntawm Code
Ua UpLoad ntawm Code
Ua UpLoad of Code
Ua UpLoad of Code

Nrog rau IDE qhib, qhib cov ntaub ntawv nrog rau qhov chaws los ntawm ob npaug nias rau.ino cov ntawv, lossis los ntawm kev mus rau Cov Ntawv qhia zaub mov.

Nrog Heltec txuas nrog USB, xaiv cov cuab yeej ntawv qhia zaub mov => Daim npav: "Heltec_WIFI_LoRa_32"

Tseem nyob hauv Cov cuab yeej ntawv qhia zaub mov, xaiv COM chaw nres nkoj uas Heltec txuas nrog.

Nyem rau UPLOAD khawm…

… Thiab tos txog qhov xaus.

Kauj ruam 8: Cov ntaub ntawv

Rub tawm cov ntawv:

PDF

INO

Pom zoo: