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. 


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 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
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. 

The Wi-Fi manager AP page will show up on your smartphone now. 

On this page let's,  click configure Wi-Fi. Wi-Fi Manager will scan adjacent available Wi-Fi AP and show them here.  Let me click my home Wi-Fi AP named stonez24 and and type in Wi-Fi password. Password entered and click Save. 

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!

That's all for today's tutorial. I hope you find this useful! 

The YouTube video is here:


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


Smartphone mount for camera tripod [3D Print]

I needed a smartphone mount for my tripod, so I designed this from a sketch using Fusion 360. I know there are relatively cheaper smartphone mounts for tripod out there in the market, but I just can't help to make one myself to learn.

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


3D Print; Howto remove broken filament

Problem to solve for 3D printer:

Filament was broken inside the Bowden tube during a print.

My printer is Creality Ender 3s (or Ender 3 Pro). Maybe the tension on the filament spool was so tight caused filament broken inside the tube.

How to remove the broken filament:

  1. Turn on Ender 3s 
  2. Adjust nozzle temperature to 210 degree Celsius (keep it at 210 degree the whole time)

    From main menu -> Control -> Temperature -> Set it to 210
  3. Raise the Z axis to see the nozzle from below
  4. 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.

  5. Cut the end of filament flat and then push it through Bowden tube, until the broken filament is pushed out of the Bowden tube.
  6. Use the socket wrench to screw the nozzle back to the printer. 
  7. 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.)
  8. Readjust the bed with paper method
  9. Done.


==== 中文版 ====



我的3D印表機是 Creality Ender 3s(或Ender 3 Pro)。 可能是我把線材軸上放在地上, 造成它的張力過,導致線材在送料管內斷裂。


  1. 打開 Ender 3s 電源
  2. 將噴嘴溫度調到210度(一直保持在210度)

  3. 用手旋轉Z軸,從下方看噴嘴
  4. 用扳手慢慢的轉下噴嘴。 注意: 噴嘴已加熱到210度,超級熱! 最好使用套筒扳手轉下噴嘴。

  5. 將新的線材剪平,然後將它推入送料管中,用新的線材推出斷的線材,一直到把斷掉的線材從送料管裡面推出來。
  6. 使用套筒扳手將噴嘴擰回到印表機上。
  7. 請確保將噴嘴確實擰緊並請整印表磁床的水平。
    我在還沒有調整水平時, 就去按下HOME 的指令! 然後噴嘴就嚴重刮傷了我的磁床!
  8. 採用紙張的方式重新調整磁床水平
  9. 大功告成



Arduino ESP32-CAM for video stream notebook


Recently, I acquired an ESP32-CAM Wi-Fi + Bluetooth + OV2640 camera module. My first intent was to learn how to use new Arduino ESP32 compatible modules. Then, I quickly found out with ESP3D that I could use ESP32-CAM to monitor and control my Ender 3 Pro 3D printer remotely, what a bonus!

This is my personal notebook and you are welcome to follow along and hope it might actually help!

Goal for this post

Config ESP32-CAM to use it as a web server to stream videos.
Long term goal is to use ESP32-CAM and ESP3D to make a 3D printer remote monitoring device.

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


Since there is no USB on ESP32, I use a CP210x USB to UART bridge to upload.
Or, you can use a FTDI USB to UART bridge to upload sketches.

  • 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

Then, connect
  • Camera module to ESP32-CAM
  • Then, plug CP210x dongle to PC USB port

Download Arduino IDE version greater than V1.8.9

Version 1.8.9 or above is required for ESP32-CAM. Please visit Arduino official website to download the version, if needed.

After installation follow the steps below:

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

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.

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.

If you encountered ERROR message "Brownout detector was triggered", many articles indicated causes could be:
  • 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

After 2-3 hours, the config/setting on ESP32 was done. Next step is to install ESP3D to remote monitoring my 3D printer.  Until next time, see you!


======== 中 文 版 ==========


最近,我購買了ESP32-CAM Wi-Fi +藍牙+ OV2640相機模組。 本來是打算學習如何使用新的Arduino ESP32 相容模組。 後來我發現它可以搭配ESP3D,用ESP32-CAM遠程監視和控制Ender 3 Pro 3D打印機,這真是太好了!




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


由於ESP32上沒有USB孔,因此我使用CP210x USB至UART轉接器進行上傳。
您可以使用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

接線完成後,把模組及CP210x接到 PC USB 插槽
  • 相機模組接上 ESP32-CAM
  • 把CP210x 接到 PC USB 孔

下載Arduino IDE版本大於V1.8.9版本

ESP32-CAM需要版本1.8.9或更高版本。 如果沒有此版本,請到Arduino官方網站下載版本。

1. 點擊文件 -> 偏好


2. 點擊Additional board manager URL後面的小方框:

  • 輸入:https://dl.espressif.com/dl/package_esp32_index.json 按 OK
  • 這可以讓 Arduino IDE下載ESP32相關程式。 如果您有兩個URL,請用一個',' 將它們分開,再按 OK。 一般來說,第一個是用於ESP8266相關程式。

3. 選擇Boards Manager來安裝ESP32版子相關程式

4. 在搜索框中輸入“ ESP32”,然後按Enter

  • Board Manager 將開始搜索ESP32程式庫。 當找到“ Espressif Systems esp32”時,點擊“安裝”。

5. 等到安裝過程完成

6. 安裝ESP32程式後,點擊“Close”。

7. 從Arduino IDE中,選擇 Tools,選擇 Board,然後選擇“ ESP32 Wrover Module”

  • 另外,將“上傳速度”更改為ESP32默認傳輸速率“ 115200”。 (這張沒有截圖)

8. 從“Tools”中,選擇“Partition Scheme”,然後選擇“Huge App”(3MP No OTA / 1MB SPIFFS)
  • 由於ESP32-CAM的程式很大,因此請選擇此項目以將程式憶空間保持為ESP32的最大容量

  • 至這裡,Arduino IDE設定完成。

9. (選項)只有你確認 PC / Mac中沒有FTDI / CP210x USB驅動程式時才需要做

10.將CP210x USB 連接到PC USB

  • 在Arduino IDE中,選擇 Tools,  Serial Monitor
  • 傳輸速率更改為115200以搭配默認ESP32認傳輸速率

11. 打開測試程式 File, Examples, WiFi, 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


  • 現在來測試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不同參數。
  • 解析度越大,每秒顯示的幀率越少。

如果您遇到錯誤訊息“Brownout detector was triggered”,則表明原因的許多文章可能是:
  • USB電線品質不良
  • USB電線太長
  • USB端電量不足



經過2-3小時後在ESP32上的配置/設置已完成也測試成功。 下一步是安裝ESP3D以遠程監視我的3D打印機! See you next time!