本論文使用STM32F103C8T6 作為主控制器,透過慣性測量單元 (IMU) 配合尤拉角等數學公式取得無人機的俯仰(pitch)、翻滾(roll)、 偏擺(yaw) 之角度及加速度,最後使用PID 進行回授控制完成四軸飛 行器的平衡。機器視覺則是考慮大小、耗電量、價錢等問題,決定使 用ESP32-CAM 為本論文之影像處理裝置,將取得之影像透過Wi-Fi 傳 送到瀏覽器配合OpenCV.js 進行影像處理之運算,並傳送控制訊號回 ESP32-CAM,再透過I2C 將控制訊號傳送給主控制器STM32 進行位置 微調,完成定位後將會進入卸除或安裝燈泡的程序。;STM32F103C8T6 is used as the main controller in this thesis, and use the inertial measurement unit (IMU) and mathematical formulas such as the Euler angle to obtained the angle and acceleration of the UAV’s pitch, roll, and yaw. Finally, use PID feedback control to complete the balance of the quadcopter. For machine vision, considering the issues of size, power consumption, and price, this thesis uses ESP32-CAM as the image processing device, and transmits the obtained image to the browser through Wi-Fi, to complete image processing with OpenCV.js, and the control signal is sent to ESP32-CAM. Finally, the control signal is sent to the main controller STM32 through I2C to complete the positioning in air. After the positioning in air is completed, the procedure of removing or installing the light bulb will be execute.