Cov txheej txheem:

Khawv koob khawm 4k: 20USD BMPCC 4k (lossis 6k) Wireless Chaw Taws Teeb: 4 Kauj Ruam (nrog Duab)
Khawv koob khawm 4k: 20USD BMPCC 4k (lossis 6k) Wireless Chaw Taws Teeb: 4 Kauj Ruam (nrog Duab)

Video: Khawv koob khawm 4k: 20USD BMPCC 4k (lossis 6k) Wireless Chaw Taws Teeb: 4 Kauj Ruam (nrog Duab)

Video: Khawv koob khawm 4k: 20USD BMPCC 4k (lossis 6k) Wireless Chaw Taws Teeb: 4 Kauj Ruam (nrog Duab)
Video: khwv nyiaj los ntawm kov xov tooj saib video tau nyiaj zoo heev li 2024, Hlis ntuj nqeg
Anonim
Image
Image

Coob leej neeg tau hais kom kuv qhia qee cov ntsiab lus hais txog kuv lub wireless tswj rau BMPCC4k. Feem ntau cov lus nug tau hais txog kev tswj bluetooth, yog li kuv yuav hais ob peb yam lus ntxaws txog qhov ntawd. Kuv xav tias koj paub nrog ESP32 Arduino ib puag ncig.

Qhov no ntawm cov chaw taws teeb tuaj yeem tswj hwm cov ntaubntawv povthawj siv, tsom mus rau lub aperture ntawm lub koob yees duab ntawm bluetooth. Ua tibzoo saib daim vis dis aus. Nws yooj yim heev los ntxiv kev tswj hwm ntau ntxiv raws li kev tswj hwm bluetooth phau ntawv ntawm BMPCC4k. Yeej txhua yam hauv lub koob yees duab tuaj yeem tswj tau, raws li kuv tau pom.

Nws yuav yog cov kauj ruam yooj yim los ntxiv LIDAR qhov ntsuas los ntsuas qhov kev ncua deb ntawm cov ncauj lus, yog li koj tuaj yeem tau txais qee yam ntawm lub kaw lus autofocus … Txawm hais tias nws muaj lus nug yog tias koj tuaj yeem tau txais qhov tseeb txaus tsom mus rau thaj chaw tshwj xeeb xws li qhov muag thiab lwm yam …

Hloov tshiab 2020: Kuv tau ua version 3.0. Nws yog raws lub log tig dawb siv lub tshuab nqus hlau sib nqus. Nws kuj tseem txuas rau kuv ua raws lub tshuab ua kom pom tseeb, uas pib dhau los ua lub cuab yeej bluetooth thib ob (ESP32 txhawb nqa ntau lub bluetooth sib txuas). Daim vis dis aus tshiab qhia qhov no.

Yog tias koj xav xaj xaj 3, thov saib ntawm MagicButton lub vev xaib

Khoom siv

Ib qho ESP32 module nrog wifi thiab bluetooth. Kuv siv TTGO micro32 vim nws me me: https://www.banggood.com/LILYGO-TTGO-Micro-32-V2_0 …

Lub log tsom, txhua lub hwj chim yuav ua. Kuv siv cov hauv qab no vim tias nws me me: https://www.aliexpress.com/item/32963061806.html? S … Hom no muaj zog nres ntawm qaum thiab qis ciam teb. Nyob rau yav tom ntej version kuv yuav siv lub cav nkag teb chaws. Txoj kev no ua kom pom tseeb lossis aperture tsis "dhia" rau lub log tam sim no thaum kuv nkag mus rau hom.

Ib qho rec/hom khawm. Kuv siv cov hauv qab no: https://www.aliexpress.com/item/32806223591.html? S …

Lwm cov txheej txheem txheem xws li cov neeg tiv taus, lub kaus mom,… (saib cov duab)

Kauj ruam 1: Txoj Cai

Kuv siv lub peev xwm wifi ntawm ESP32 txhawm rau txuas rau lub network paub hauv AP hom, lossis, thaum kuv nyob hauv qhov chaw, nws dhau los ua chaw nres tsheb (STA) uas kuv tuaj yeem txuas rau. Txoj kev ntawd kuv tuaj yeem teeb tsa tus qauv. Kuv yuav tsis nkag mus rau qhov nthuav dav ntawm ntu wifi/nplooj ntawv webpage, Kuv yuav ntxiv qhov no nyob rau theem tom ntej.

ESP32 txuas rau lub koob yees duab thiab dhau los ua Bluetooth LE cov neeg siv khoom. Tus lej bluetooth suav nrog hauv Arduino's ESP32 moj khaum tsis ua haujlwm nrog BMPCC4k. Wakwak-koba tau kho nws rau peb. Ua tsaug Wakwak-koba! Kuv siv lub tsev qiv ntawv BLE los ntawm no:

github.com/wakwak-koba/arduino-esp32

Txawm li cas los xij version ntawm BLE lib tseem tab tom txhim kho thiab qhov hloov tshiab kawg ntawm BLEUUID.cpp tsis zoo li ua haujlwm tam sim no, yog li coj ua ntej "txheeb xyuas" version ntawm cov ntaub ntawv no.

Txog qhov seem, feem ntau ntawm kuv tus lej bluetooth yog ntau raws li BLE piv txwv suav nrog hauv Arduino lub moj khaum:

Qee qhov BLE UUID thiab qhov sib txawv txhais tau tias:

zoo li qub BLEUUID BlackMagic ("00001800-0000-1000-8000-00805f9b34fb");

zoo li qub BLEUUID Tswj kev pabcuamUUID ("291D567A-6D75-11E6-8B77-86F30CA893D3"); zoo li qub BLEUUID DevInfoServiceControlUUID ("180A"); zoo li qub BLEUUID ControlcharUUID ("5DD3465F-1AEE-4299-8493-D2ECA2F8E1BB"); zoo li qub BLEUUID NotifcharUUID ("B864E140-76A0-416A-BF30-5876504537D9"); zoo li qub BLEUUID ClientNamecharUUID ("FFAC0C52-C9FB-41A0-B063-CC76282EB89C"); zoo li qub BLEUUID CamModelcharUUID ("2A24"); zoo li qub BLEScan *pBLEScan = BLEDevice:: getScan (); zoo li qub BLEAddress *pServerAddress; zoo li qub BLEAdvertisedDevice* myDevice; BLERemoteCharacteristic zoo li qub *pControlCharacteristic; BLERemoteCharacteristic zoo li qub *pNotifCharacteristic; zoo li qub boolean doConnect = 0; zoo li qub boolean txuas nrog = 0; volatilebool scanning = 0; volatileuint32_t pinCode;

Kev txheeb xyuas thiab lub ntsiab lus:

chav kawm MyAdvertisedDeviceCallbacks: pej xeem BLEAdvertisedDeviceCallbacks {

void onResult (BLEAdvertisedDevice advertisedDevice) {Serial.print ("BLE Cov Khoom Tshaj Tawm pom:"); Serial.println (tshaj tawmDevice.toString (). C_str ()); yog (advertisedDevice.haveServiceUUID () && advertisedDevice.getServiceUUID (). sib npaug (BlackMagic)) {Serial.print ("Pom peb lub cuab yeej!"); advertisedDevice.getScan ()-> nres (); myDevice = tshiab BLEAdvertisedDevice (tshaj tawm Devices); doConnect = muaj tseeb; }}}}; zoo li qub void scanCompleteCB (BLEScanResults scanResults) {Serial.println ("scanning ua"); scanning = tsis tseeb; } void loop (void) {if (! connected && (uint32_t) (millis () - Timer)> BLE_RESCAN_TIME || (! scanning))) {Serial.println ("scanning …"); scanning = tseeb; pBLEScan-> pib (BLE_SCAN_TIME, scanCompleteCB); Timer = millis (); } yog (doConnect == muaj tseeb) {yog (connectToServer ()) {Serial.println ("Tam sim no peb tau txuas nrog BLE Server."); txuas = muaj tseeb; } lwm {Serial.println ("Peb tau ua tsis tiav txuas rau lub server; tsis muaj dab tsi ntxiv peb yuav ua."); } doConnect = tsis tseeb; }}

Txuas mus rau lub koob yees duab:

bool txuasToServer () {

Serial.print ("Tsim kev sib txuas rau"); Serial.println (myDevice-> getAddress (). ToString (). C_str ()); BLEDevice:: setEncryptionLevel (ESP_BLE_SEC_ENCRYPT); BLEDevice:: setSecurityCallbacks (tshiab MySecurity ()); BLESecurity *pSecurity = tshiab BLESecurity (); pSecurity-> setKeySize (); pSecurity-> setAuthenticationMode (ESP_LE_AUTH_REQ_SC_MITM_BOND); pSecurity-> setCapability (ESP_IO_CAP_IN); pSecurity-> setRespEncryptionKey (ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK); BLEClient *pClient = BLEDevice:: createClient (); pClient-> setClientCallbacks (tshiab MyClientCallback ()); pClient-> txuas (myDevice); Serial.println (" - Txuas nrog server"); BLEDevice:: setMTU (BLEDevice:: getMTU ()); // OBTAIN CAMERA MODEL BLERemoteService *pRemoteService = pClient-> getService (DevInfoServiceControlUUID); yog (pRemoteService == nullptr) {Serial.print (" - Ua tsis tiav kom tau txais cov cuab yeej siv kev pabcuam"); Serial.println (DevInfoServiceControlUUID.toString (). C_str ()); ua tsis tiav; } Serial.println (" - Nyeem cov ntaub ntawv ntaus ntawv"); // Tau txais kev siv rau tus yam ntxwv hauv kev pabcuam ntawm BLE server deb. BLERemoteCharacteristic *pRemoteCamModelCharacteristic = pRemoteService-> getCharacteristic (CamModelcharUUID); yog (pRemoteCamModelCharacteristic == nullptr) {Serial.print (" - Tsis pom lub koob yees duab qauv"); Serial.println (CamModelcharUUID.toString (). C_str ()); ua tsis tiav; } // Nyeem tus nqi ntawm tus yam ntxwv. std:: hlua tus nqi = pRemoteCamModelCharacteristic-> readValue (); Serial.print ("Lub koob yees duab yog"); Serial.println (tus nqi.c_str ()); yog (CamModel! = value.c_str ()) {Serial.print (" - Lub koob yees duab tsis yog BMPCC4k"); ua tsis tiav; } // OBTAIN CONTROL pRemoteService = pClient-> getService (ControlserviceUUID); yog (pRemoteService == nullptr) {Serial.print (" - Ua tsis tau qhov kev pabcuam lub koob yees duab"); Serial.println (ControlserviceUUID.toString (). C_str ()); ua tsis tiav; } BLERemoteCharacteristic *pRemoteClientNameCharacteristic = pRemoteService-> getCharacteristic (ClientNamecharUUID); yog (pRemoteClientNameCharacteristic! = nullptr) {pRemoteClientNameCharacteristic-> writeValue (MyName.c_str (), MyName.length ()); } pControlCharacteristic = pRemoteService-> getCharacteristic (ControlcharUUID); yog (pControlCharacteristic == nullptr) {Serial.print (" - Ua tsis tiav kom tswj tau tus yam ntxwv"); Serial.println (ControlcharUUID.toString (). C_str ()); ua tsis tiav; } pNotifCharacteristic = pRemoteService-> getCharacteristic (NotifcharUUID); yog (pNotifCharacteristic! = nullptr) // && pNotifCharacteristic-> canIndicate ()) {Serial.println (" - tso npe rau kev ceeb toom"); const uint8_t qhov taw qhia = {0x2, 0x0}; pNotifCharacteristic-> registerForNotify (ceeb toomCallback, cuav); pNotifCharacteristic-> getDescriptor (BLEUUID ((uint16_t) 0x2902))-> writeValue ((uint8_t*) indicationOn, 2, muaj tseeb); } rov tseeb; ua tsis tau: pClient-> disconnect (); rov dag; }

Kev sib txuas/tsis txuas lus hu rov qab:

chav MyClientCallback: pej xeem BLEClientCallbacks {

void onConnect (BLEClient *pclient) {Serial.println ("Peb tau txuas nrog."); } void onDisconnect (BLEClient *pclient) {txuas = tsis tseeb; pclient-> disconnect (); Serial.println ("Peb tau txais kev sib txuas."); }};

Tus lej tus lej ntu:

Hauv kuv qhov tam sim no kuv tuaj yeem nkag mus rau pincode ntawm lub vev xaib interface tab sis cov no yog wifi/webpage cov ntsiab lus uas kuv yuav ntxiv tom qab.

chav kawm MySecurity: pej xeem BLESecurityCallbacks

{uint32_t onPassKeyRequest () {Serial.println ("- THOV NYEEM NTAWV 6 DIGIT PIN (xaus nrog ENTER):"); pin = 0; caj ch; ua {thaum (! Serial.available ()) {ncua (1); } ch = Serial.read (); yog (ch> = '0' && ch <= '9') {pinCode = pinCode *10+ (ch -'0 '); Serial.print (ch); }} thaum ((ch! = '\ n')); rov pinCode; } void onPassKeyNotify (uint32_t pass_key) {ESP_LOGE (LOG_TAG, "Tus passkey Qhia tus lej:%d", pass_key); } bool onConfirmPIN (uint32_t pass_key) {ESP_LOGI (LOG_TAG, "Tus passkey YOG/Tsis muaj tus lej:%d", pass_key); vTaskDelay (5000); rov qab los; } bool onSecurityRequest () {ESP_LOGI (LOG_TAG, "Thov Kev Ruaj Ntseg"); rov qab los; } void onAuthenticationComplete (esp_ble_auth_cmpl_t auth_cmpl) {Serial.print ("khub xwm txheej ="); Serial.println (auth_cmpl.success); }};

BLE ceeb toom:

Lub koob yees duab ceeb toom nws cov neeg siv BLE txog kev hloov pauv lub koob yees duab, suav nrog thaum lub koob yees duab pib thiab nres kaw. Txoj cai no toggles kuv LED thaum nws pib/nres kaw.

zoo li qub tsis muaj dab tsi ceeb toomCallback (BLERemoteCharacteristic *pBLERemoteCharacteristic, uint8_t*pData, size_t ntev, bool isNotify) {// BMPCC4k BLE cov ntawv xov xwm: // rov rau yog 255 9 0 0 10 1 1 2 2 0 64 0 2 // rov tawm yog 255 9 0 0 10 1 1 2 0 0 64 0 2if (ntev == 13 && pData [0] == 255 && pData [1] == 9 && pData [4] == 10 && pData [5] == 1) {if (pData [8] == 0) { recstatus = 0; } yog (pData [8] == 2) {rov qab = 1; }}}

Kauj Ruam 2: Txoj Cai Tshooj 2

Nov yog ntu uas tau xa cov lus txib mus rau lub koob yees duab.

Cov ntaubntawv povthawj siv:

uint8_t cov ntaub ntawv = {255, 9, 0, 0, 10, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // 0 = OFF, 2 = ON, [8] void Record (boolean RecOn) {yog (! RecOn) record [8] = 0; lwm cov ntaub ntawv [8] = 2; pControlCharacteristic-> writeValue ((uint8_t*) cov ntaub ntawv, 16, tseeb); }

Tsom ntsoov:

Lub koob yees duab xav kom muaj 11 tus lej me me, xws li nyob ze kom pom tseeb. Kuv tawm tswv yim muab lub lim rau koj tus nqi ADC, txwv tsis pub lub hom phiaj yuav ua rau muaj kev ntxhov siab.

uint8_t tsom = {255, 6, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}; // 0.0… 1.0, 11bit, [8] = LSB, [9] = MSBvoid Focus (uint16_t val) {// mus los ntawm 12bit ADC tus nqi rau 11bit tsom tus nqi [8] = (uint8_t) (((val> > 1) & 0xFF)); tsom [9] = (uint8_t) (((val >> 1) & 0xFF00) >> 8); pControlCharacteristic-> writeValue ((uint8_t*) tsom, 12, muaj tseeb); }

Qhov siab:

Lub koob yees duab xav kom muaj 11 tus lej, suav txij ntawm qis mus rau tus nqi qhov siab. Kuv qhia tawm kom muab lub lim dej rau koj li ADC tus nqi, txwv tsis pub lub aperture tus nqi yuav tshee tshee.

uint8_t aperture = {255, 6, 0, 0, 0, 3, 128, 0, 0, 0, 0, 0, 0}; // 0.0… 1.0, [8] = LSB, [9] = MSBvoid Aperture (uint16_t val) {// mus los ntawm 12 ntsis ADC tus nqi mus rau 11 ntsis aperture tus nqi aperture [8] = (uint8_t) (((val >> 1) & 0xFF)); aperture [9] = (uint8_t) (((val >> 1) & 0xFF00) >> 8); pControlCharacteristic-> writeValue ((uint8_t*) aperture, 12, muaj tseeb); }

Kauj ruam 3: Circuit Court

Qhov Circuit
Qhov Circuit

Kuv tau txuas daim PDF ntawm kuv lub voj voog. Qee cov duab ntawm PCB kuj tau txuas nrog.

Lub rooj tsavxwm tau siv nrog micro USB.

Tom qab tau txais PCB kuv txiav txim siab tias kuv xav tsav RGB LED, yog li kuv txuas ob WS2812B ua ntu zus mus rau "Button Led" tso tawm (uas xav tau qee qhov xaim ua haujlwm ntawm PCB). PCB yog 8USD nrog OSHPark.com.

Koj tuaj yeem pom qee qhov kev sib txuas ntxiv ntawm PCB xws li "adc" uas kuv tsis siv thiab uas tau raug tshem tawm ntawm cov kab lus txuas. Lub hom phiaj yog siv lub log tsom sab nraud yav dhau los tab sis tam sim no kuv zoo siab heev nrog lub me ntiv tes ntiv tes.

Kauj Ruam 4: Xaus

Kuv vam tias qhov no tau pab.

Kuv tau txais qee qhov hloov tshiab yav tom ntej hauv siab, xws li siv lub cav nkag teb chaws yam tsis muaj nres. Qhov no yuav xav tau tus tswj kom tau txais tus nqi tam sim no ntawm kev ua kom pom tseeb lossis aperture los ntawm lub koob yees duab, thiab txuas ntxiv los ntawm qhov ntawd. Txoj haujlwm "ceeb toomCallback" yuav tsum tau hloov kho rau qhov uas tej zaum.

PCB xav tau kev hloov kho tshiab los muab cov cim rau WS2812B RGB LEDs kom raug.

Kuv siv sijhawm ntau (loooot) ntawm lub sijhawm los ua txoj haujlwm no, tshwj xeeb yog BLE ib feem. Yog tias qhov no tau pab koj thiab koj xav yuav kuv haus, qhov ntawd zoo siab heev:) Qhov no yog Paypal pub dawb txuas:

Pom zoo: