In recent years, Microsoft VS Code is considered the one of the best Arduino IDE!!
I've made a video to show you how to use VS Code to write your Arduino codes, in Chinese only...
2021/06/20
VS Code - One of the best Arduino IDE
2021/02/17
Arduino - No more SSID and password with Wifimanager
NOTICE: If you encountered problems in compiling the code, see this updated video.
ESP8226: https://youtu.be/NLRuqjhArg8
ESP32-CAM: https://youtu.be/TTdMKW6HhXM
Have you met this problem before? You were making an fantastic Arduino IoT project. However, in the code, Wi-Fi SSID and Password were hard-coded and the only way to change these is to edit the code and re-upload the code to Arduino. At home, this is okay, since you were experimenting things here and there anyway.
Let’s say you bring this project to a friend place or a venue to demo. And you didn’t know the Wi-Fi SSID nor the password beforehand. Then, you need to bring your computer to change SSID and password and re-upload to Arduino.
Is there a way to get rid this problem? Yes. The answer is use Arduino Wifimanager library.
Start
Open Arduino IDE. From Tools and select Manager Library
in space here type Wi-Fi Manager to search
Arduino IDE will filter keywords with Wi-Fi manager. Scroll down until you find a Wi-Fi manager by author Zabu. The current version 0.14 just click and install. Ok, install completed. Click close.
Upload "Auto Connect" sketch to NodeMCU
Next, let's get a Wi-Fi Manager code. example from Files-> Example, scroll down and find Wi-Fi manager. Let's open "Auto Connect" in a new window.
In the "Auto Connect" code., let's not make any change and upload this code directly to NODEMCU to understand how it worked.
Now, let me compile the code and upload this code to my NODEMCU Compiled sketch.
This will take a while depending on your computer configuration. You can see the progress bar is showing here it's uploading the flashing LED indicates the program is uploading. Let's wait until upload complete. Okay.
Set it up on your smartphone
Upload completed. Let's look at the Arduino Serial port right now. It says: using last saved values, should be faster. Since this is a new NODEMCU and I haven't set anything to it in the program code. There's neither Wi-Fi SSID nor password setting. The "AutoConnectAP" is AP name that you could define yourself.
Let's see the serial monitor NODEMCU now acts as Wi-Fi AP named AutoConnectAP and waiting for Wi-Fi client connection. As I said this NODEMCU is now in Wi-Fi AP mode with IP address 192.168.4.1 What I need to do now is to input this IP address in a browser either smartphone or a computer. Let me enter this IP address into my smartphone browser.
Type IP here 192.168.4.1
Remember to connect the phone to NODEMCU Wi-Fi AutoConnectAP first.
Swipe down and click Wi-Fi symbol and then click AutoConnectAP from available Wi-Fi list. It's connected to AutoConnectAP.
it shows Credential saved. Let's look here NODEMCU you will now connect tostonez24 AP automatically.
Ready to go!
Okay, connection result shows connected. Great!! We have connected NODEMCU to Stonez24 AP. In the future when you visit a new place or venue, there's no need to Hard-Code SSID or password in Arduino code let Wifimanager do the hard work for you!
2020/06/14
3D Print - iPAD Holder for Treadmill
Tired of using tape to glue the iPad to the treadmill, my wife asked me to design and print an iPad holder for her. Here it is!
This is a multiple weekends project, since the 3D design took me many weeks to complete. Hope you could also get some inspiration from this and design your own.
STL file on Thingverse: https://www.thingiverse.com/thing:4459427
2020/04/24
Smartphone mount for camera tripod [3D Print]
STL file is available here: https://www.thingiverse.com/thing:4309896
In fill: 70% for the middle part and 20% for rest
Nozzle: 0.4 mm
Layer high: 0.2 mm
For people who like to use this STL file, please be aware that not each tripod mount base has the same dimension, so, I highly recommend you to measure the base before 3D print.
Also, for the middle part, please use 70% infill to make the clip part stronger.
After couple of days struggling with Fusion 360, I was able to make the thing!! :)
![]() |
| My draft sketch about the mount design. |
For the base, I printed 3-4 times to perfectly match my camera tripod. I think this is due to the precision of my Ender 3 Pro printer or PLA material.
![]() |
| After assembled the 3 parts together |
![]() |
| Mount smartphone on the printed mount, perfect! |
![]() |
| Place the smartphone mount on the camera tripod |
2020/01/08
3D Print; Howto remove broken filament
Problem to solve for 3D printer:
Filament was broken inside the Bowden tube during a print.
How to remove the broken filament:
- Turn on Ender 3s
- Adjust nozzle temperature to 210 degree Celsius (keep it at 210 degree the whole time)
From main menu -> Control -> Temperature -> Set it to 210
- Raise the Z axis to see the nozzle from below

- Remove the nozzle with a wrench. Remember the nozzle is heated at 210 degree; it's super hot! It's better to use a socket wrench to remove the nozzle.
- Cut the end of filament flat and then push it through Bowden tube, until the broken filament is pushed out of the Bowden tube.
- Use the socket wrench to screw the nozzle back to the printer.
- Be sure the nozzle is really tight and level the bed before try to return nozzle back to home. Here is what happened to my magnetic bed! (see below) I forgot to level the bed and hit the HOME command, then the nozzle scratched it badly! (The photo shown was after I cut the scratched part off the bed.)
- Readjust the bed with paper method
- Done.
References:
==== 中文版 ====
- Turn on Ender 3s
- Adjust nozzle temperature to 210 degree Celsius (keep it at 210 degree the whole time)
From main menu -> Control -> Temperature -> Set it to 210 - Raise the Z axis to see the nozzle from below

- Remove the nozzle with a wrench. Remember the nozzle is heated at 210 degree; it's super hot! It's better to use a socket wrench to remove the nozzle.
- Cut the end of filament flat and then push it through Bowden tube, until the broken filament is pushed out of the Bowden tube.
- Use the socket wrench to screw the nozzle back to the printer.
- Be sure the nozzle is really tight and level the bed before try to return nozzle back to home. Here is what happened to my magnetic bed! (see below) I forgot to level the bed and hit the HOME command, then the nozzle scratched it badly! (The photo shown was after I cut the scratched part off the bed.)
- Readjust the bed with paper method
- Done.
References:
==== 中文版 ====
3D印表機要解決的問題:
在3D列印過程中,線材在送料管中間斷掉了。
如何取出折斷的線材:
- 打開 Ender 3s 電源
- 將噴嘴溫度調到210度(一直保持在210度)
從主選單—>控制—>溫度—>設定為210
- 用手旋轉Z軸,從下方看噴嘴

- 用扳手慢慢的轉下噴嘴。 注意: 噴嘴已加熱到210度,超級熱! 最好使用套筒扳手轉下噴嘴。
- 將新的線材剪平,然後將它推入送料管中,用新的線材推出斷的線材,一直到把斷掉的線材從送料管裡面推出來。
- 使用套筒扳手將噴嘴擰回到印表機上。
- 請確保將噴嘴確實擰緊並請整印表磁床的水平。
我在還沒有調整水平時, 就去按下HOME 的指令! 然後噴嘴就嚴重刮傷了我的磁床!
(照片是我從磁床上割下來劃傷的部分,右邊沒受傷的部份繼續用,哈!)
- 採用紙張的方式重新調整磁床水平
- 大功告成
從主選單—>控制—>溫度—>設定為210

我在還沒有調整水平時, 就去按下HOME 的指令! 然後噴嘴就嚴重刮傷了我的磁床!
(照片是我從磁床上割下來劃傷的部分,右邊沒受傷的部份繼續用,哈!)
參考資料:
2019/11/03
Arduino ESP32-CAM for video stream notebook
Preface
Goal for this post
ESP32-CAM Spec
- ESP32 32bit dual core 600 DIMPS
- 520KB SRAM + 4MB PSRAM
- I/O: UART, SPI, I2C, PWM
- MicroSD: Up to 4GB
- Baud Rate: Default 115200 bps
- Photo format: JPEG( OV2640 only), BMP, GRAYSCALE
- Wi-Fi: 802.11 b/g/n/d/e/i/k/r
- Bluetooth: V4.2 BR/EDR and BLE
- Power: 5V/2A
- Built-in flash light
- Camera module: OV2640, 200 Mega pixels
Schematic
Or, you can use a FTDI USB to UART bridge to upload sketches.
IMPORTANT NOTICE:
- Enable ESP32 upload mode: Connect ESP32 IO0 to GND
- ESP32 Normal operation mode: Remove ESP32 IO0 to GND connection
- Power: must connect ESP32 VCC (5V) to VCC
- Wiring:
- ESP32 GND <-> ESP32 IO0 (Upload only, remove for normal operation)->
- ESP32 GND <-> CP210x GND->
- ESP32 VCC(5V) <-> CP210x VCC->
- ESP32 U0R <-> CP210x TXD->
- ESP32 U0T <-> CP210x RXD->
- Camera module to ESP32-CAM
- Then, plug CP210x dongle to PC USB port
Download Arduino IDE version greater than V1.8.9
1. Click File -> Preferences

2. Click the small square at end of Additional Boards Manager URL:
- Enter: https://dl.espressif.com/dl/package_esp32_index.json
- This URL allows Arduino IDE to download ESP32 package. If you had two URLs, separate them with a ',' common. Click OK to exit. Usually, the first one is for ESP8266 related package.
3. Select Boards Manager to install ESP32 library
4. Type 'ESP32' in the search box and hit enter
- Board manager will start to search ESP32 library. When 'esp32 by Espressif Systems' is found, click Install.
5. Wait till the installing process finish
6. Click 'Close' when ESP32 package is INSTALLED
7. From Arduino IDE, Tools, select Board, and select "ESP32 Wrover Module"
- Also, change Upload Speed to "115200", the ESP32 default baud rate. (No screenshot shown here)
8. From Tools, select Partition Scheme, select Huge APP (3MP No OTA/1MB SPIFFS)
- Due to ESP32-CAM sketch size is quite large, select this item is necessary to keep program memory at it's maximum for ESP32
- By now, Arduino IDE setting is completed.
9. (Optional) Only needed if you do not have FTDI/CP210x USB drivers in PC/Mac
- Visit URL here to get Virtual COM Port drivers:
https://ftdichip.com/Drivers/VCP.htm
10. Connect CP210x USB dongle to PC USB port
- From Arduino IDE, select "Toos"->"Monitor"
- Change baud rate to 115200 to match default ESP32 baud rate setting
11. Load a sketch from File->Examples->WiFi->WiFiScan
- Load WiFiScan sketch to ensure the hardware and software /IDE settings are correct.
- Load WiFiScan sketch to ensure the hardware and software /IDE settings are correct.
12. Upload the sketch
- Just click the small arrow circled below to upload to ESP32
If you encountered ERROR: Upload failed: "Timed out waiting for packet header"
- CAUSE: This error indicates ESP32 IO0 didn't connect to GND. This connection is needed enable ESP32 upload mode.
- Push reset button: when you see ....._____....._____.....____
After the connection made from ESP32 IO0 to GND and the uploading worked.
- Message window shows "Writing at .......100%" indicates the upload completed!
13. Check out serial monitor for messages
- In this step, ESP32 will scan available AP nearby and show them in the monitor.
- If you encountered ERROR: "waiting for download" message! This error indicates that you need to remove ESP32 IO0 Pin to GND pin (Mentioned above that this connection must be removed for ESP32 to work properly!)
After remove the connection, and push reset, ESP32 found few Wi-Fi AP nearby
14. Load CameraWebServer sketch
- It's time to test out the ESP32 web server and stream videos
- From "File"->"Examples"->"ESP32"->"Camera"->CameraWebServer
15. Change Wi-Fi AP SSID and Password to match your own Wi-FI SSID/Password
16. Change the camera model to AI_THINKER
- The camera module is the in the package came with ESP32. So I selected the default "AI_THINKER"
17. Get web server IP address
- If everything goes well, the camera IP address would show on the serial monitor
- Copy the IP address shown
18. Open a browser and type the IP address specified above
- The screen below shows ESP32 web server is running successfully
- Select the resolution on the top
- Click Start Stream and the video will show on the right hand side
19. Real-time camera video stream in browser
- If you like, you could change the resolution and play around many OV2640 parameters.
- For the resolution, the larger the resolution, the fewer the frame rates.
- Poor quality USB cable
- USB cable is too long
- Or not enough power to USB port
After I changed to dedicated USB port to connect ESP32, the video came back alright and running for a while without the error messages.
What's Next
References:
======== 中 文 版 ==========
前言
本篇目的
ESP32-CAM 規格
- ESP32 32bit dual core 600 DIMPS
- 520KB SRAM + 4MB PSRAM
- I/O: UART, SPI, I2C, PWM
- MicroSD: Up to 4GB
- Baud Rate: Default 115200 bps
- Photo format: JPEG( OV2640 only), BMP, GRAYSCALE
- Wi-Fi: 802.11 b/g/n/d/e/i/k/r
- Bluetooth: V4.2 BR/EDR and BLE
- Power: 5V/2A
- Built-in flash light
- Camera module: OV2640, 200 Mega pixels
接線方式
您可以使用FTDI USB至UART來上傳程式。
請注意:
- 啟用ESP32上載模式:將ESP32 IO0連接到GND
- ESP32正常運行模式:拔開ESP32 IO0到GND的連接
- 電源:必須將ESP32 VCC(5V)連接到VCC
- 連接:
- ESP32 GND <-> ESP32 IO0 (只有上傳需要連接!)->
- ESP32 GND <-> CP210x GND->
- ESP32 VCC(5V) <-> CP210x VCC->
- ESP32 U0R <-> CP210x TXD->
- ESP32 U0T <-> CP210x RXD->
- 相機模組接上 ESP32-CAM
- 把CP210x 接到 PC USB 孔
下載Arduino IDE版本大於V1.8.9版本
安裝後,請執行以下步驟:
1. 點擊文件 -> 偏好

2. 點擊Additional board manager URL後面的小方框:
- 輸入:https://dl.espressif.com/dl/package_esp32_index.json 按 OK
- 這可以讓 Arduino IDE下載ESP32相關程式。 如果您有兩個URL,請用一個',' 將它們分開,再按 OK。 一般來說,第一個是用於ESP8266相關程式。
4. 在搜索框中輸入“ ESP32”,然後按Enter
- Board Manager 將開始搜索ESP32程式庫。 當找到“ Espressif Systems esp32”時,點擊“安裝”。
7. 從Arduino IDE中,選擇 Tools,選擇 Board,然後選擇“ ESP32 Wrover Module”
- 另外,將“上傳速度”更改為ESP32默認傳輸速率“ 115200”。 (這張沒有截圖)
- 由於ESP32-CAM的程式很大,因此請選擇此項目以將程式憶空間保持為ESP32的最大容量
- 至這裡,Arduino IDE設定完成。
9. (選項)只有你確認 PC / Mac中沒有FTDI / CP210x USB驅動程式時才需要做
- 如果有需要 Virtual COM port 驅動程式, 請到這裡:
https://ftdichip.com/Drivers/VCP.htm
10.將CP210x USB 連接到PC USB
- 在Arduino IDE中,選擇 Tools, Serial Monitor
- 傳輸速率更改為115200以搭配默認ESP32認傳輸速率
11. 打開測試程式 File, Examples, WiFi, WiFiScan
- 打開WiFiScan程式來測試 硬體及軟體設置是否正確
- 打開WiFiScan程式來測試 硬體及軟體設置是否正確
12. 上傳程式到 ESP32
- 只需點選下面圓圈的小箭頭,即可上傳到ESP32
如果遇到錯誤, 上傳失敗: "Timed out waiting for packet header"
- 原因:此錯誤表示ESP32 IO0未連接到GND。 上面有提到過了, ESP32上載模式需要此連接!。
- 當你看到 ....._____....._____.....____ 訊息時, 按一下 ESP32 Reset 鈕!
把ESP32 IO0到GND的連接成功後,就能上傳成功。
- Serial port 顯示“writing at 0x00000800....... 100%” 表示上傳已完成!
13. 查看Serial Monitor內容
- 在這裡,ESP32將掃描附近的可用Wi-FI AP並將其顯示
- 如果遇到錯誤:“Waiting for download! 該錯誤表明您需要移除ESP32的IO0至GND連線(上面提到必須移除此連接才能使ESP32正常工作!)
把ESP32的IO0至GND連線拔掉後, ESP32在附近發現了幾個Wi-Fi AP
14.加載CameraWebServer草圖
- 現在來測試ESP32 Web服務器及試試串流傳輸影像
- 從“文件, File, Example, ESP32, Camera, then 點選 CameraWebServer
15. 更改Wi-Fi AP SSID和密碼以成為您自己家裡的Wi-FI SSID /密碼
16. 將相機型號更改為AI_THINKER
- 相機模組是ESP32隨附的相機模組, 所以選擇了內定的“ AI_THINKER”
17. 取得 ESP32 IP 地址
- 如果一切順利,相機的IP地址將顯示在 Serial Monitor 上面
- 複製顯示的IP地址
18. 打開瀏覽器並輸入上面指定的IP地址
- 以下屏幕顯示ESP32 Web服務器運行成功
- 選擇頂部的解析度
- 點擊"Start to stream",開始串流, 影像將顯示在右側
19. 瀏覽器中的實時攝像機串流
- 你可以更改解析度, 並且更改OV2640不同參數。
- 解析度越大,每秒顯示的幀率越少。
- USB電線品質不良
- USB電線太長
- USB端電量不足



















































