## DLP6500使用python 控制教學 到以下網站 https://github.com/csi-dcsc/Pycrafter6500 下載zip檔並以vscode開啟 ![image](https://hackmd.io/_uploads/H1sday_KT.png) 裝 `pip install usb` `pip install pyusb` 下載並裝 https://sourceforge.net/projects/libusb-win32/ 裝完後會自動開啟 ![image](https://hackmd.io/_uploads/HkX4AyOYa.png) 按下Next 會到這個頁面,有許多hardware,插拔電腦上裝的usb裝置後可以發現,上面內容會改變,一直插拔DLP的usb,觀察哪些是DLP的,然後將那些選擇並按下下面的install ![image](https://hackmd.io/_uploads/S1vBAkdtT.png) 範例程式中引入三個函示庫 ![螢幕擷取畫面 2024-01-30 225100](https://hackmd.io/_uploads/SkHX6K896.png) 需先至CMD輸入以下程式安裝函示庫 ``` pip install numpy //安裝numpy pip install Pillow //安裝PIL //pycrafter6500在github壓縮檔中,需手動引入 ``` 將範例code的讀圖片改成下面這種寫法(絕對路徑)。 ![image](https://hackmd.io/_uploads/H1LT01dFp.png) 右鍵範例code,直接run應該可以發現DLP6500的圖變成貓咪 ![image](https://hackmd.io/_uploads/S1glJldFp.png) 如下 ![image](https://hackmd.io/_uploads/SybOkgOtp.png) images: python list of numpy arrays, with size (1080,1920), dtype uint8, and filled with binary values (1 and 0 only) 表示使用此函示庫圖片格式限制為png、tif或tiff檔 尺寸 1920*1080 解析度 96dpi 位元深度 8 先指令DLP stopsequence ![螢幕擷取畫面 2024-01-30 225535](https://hackmd.io/_uploads/r1mUAFIcp.png) 選擇DLP模式,這裡我們選取 mode(3) ![螢幕擷取畫面 2024-01-30 225838](https://hackmd.io/_uploads/S1cn0tUqp.png) **mode=0** 為影片模式(video mode),可做第二螢幕 **mode=1** 預存圖像模式(pre stored pattern mode),DLPC900可以存 400 個 1-bit 圖像. 8-bit可以存 50 個圖像 **mode=2** 表示視訊影像模式(video pattern mode),將圖像嵌入到HDMI中,然後透過視訊圖像模式顯示它們 **mode=3** 表示動態模式(pattern on the fly mode) 接下來設定參數 ![螢幕擷取畫面 2024-01-30 231500](https://hackmd.io/_uploads/HJgpzc8q6.png) **exposures**:**曝光時間**,以**us**為單位,python list or numpy array,長度必須等於images list **dark time**: 曝光後**黑暗時間**,以**us**為單位,python list or numpy array,長度必須等於images list **trigger in**: python list or numpy array of boolean values,長度必須等於images list,確定在曝光之前是否等待外部觸發。 **trigger out**:python list or numpy array of boolean values,長度必須等於images list,確定在曝光之後是否發出外部觸發。 ``` controller.defsequence(images,exposures,trigger in,dark time,trigger out, repetitions) ``` ![螢幕擷取畫面 2024-01-30 232830](https://hackmd.io/_uploads/BJNTr9Uc6.png) **repetitions**: 重複次數,設定為 0 表示無限循環。 指令DLP startsequence ![螢幕擷取畫面 2024-01-30 233228](https://hackmd.io/_uploads/Syn98qUqT.png) GUI:https://www.ti.com/tool/DLPC900REF-SW ![螢幕擷取畫面 2024-01-30 234232](https://hackmd.io/_uploads/BJ7rF5L9a.jpg) for any problem email : srlin@ntumems.net ###### tags: `DLP6500` `python` `optic`