Try   HackMD

Arduino:利用 WiFiEsp 讓 ESP8266 連網(IoT WiFi Module)

ESP8266 開發板(Default Baud Rate:115200)

ESP8266 開發板具有完整 TCP/IP Protocol stack 的 WiFi IoT 控制晶片。 這個 WiFi Module 允許微控制器通過 Hayes command set 使用TCP / IP Protocol stack 連接到 WiFi 無線網路。

預設調變速率(Default Baud Rate):115200

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Arduino UNO 與 ESP8266 電路接法

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 3v3->3v3
  • EN->3v3
  • GND->GND
  • RX->TX(Pin 7)
  • TX->RX(Pin 6)

下載安裝 Arduino IDE

Arduino IDE 官方載點:https://www.arduino.cc/en/software/
Python 官方載點:https://www.python.org/downloads/

編譯 Python 的 IDE 有很多種,這邊是使用 VSCode(官方載點

先匯入需要的程式庫

需要安裝 WiFiEsp Library(直接在 Arduino IDE 裡頭搜尋即可)

[工具 > 管理程式庫 > 搜尋 WiFiEsp > 安裝]

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

打開 Test Code 測試是否可以運作

安裝了 WiFiEsp 程式庫後可以在檔案裡找到範例測試程式碼,把最前面區塊的 ssid[] 改成自己的網路熱點名稱,pwd[] 輸入自己的無線網路熱點密碼,就可以驗證後上傳檢查板子是否成功連網了。

[ 檔案 > 範例 > WiFiEsp > test > Basic test ]

// 前後略
char ssid[] = "Twim";     // your network SSID (name)
char pwd[] = "12345678";  // your network password
char pwdErr[] = "xxxx";   // wrong password

記得把這段改成自己的網路數據熱點帳密。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

開啟序列埠檢查測試是否連上網路

點擊畫面左上角的打勾圖示可以驗證編譯,接著按旁邊的箭頭就可以上傳。要檢視序列埠監控視窗的話,按畫面最右上角的放大鏡圖示,進入序列埠監控視窗,就可以看到當前狀態,出現以下畫面代表連網成功。如果畫面呈現亂碼,記得修改序列埠視窗右下角的 baud rate,改到 115200 才會看到測試訊息。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

相關文章:https://hackmd.io/@withhhsong/arduino_DHT_python


: : 20211112 : : 與松 withhhsong : :

tags: tutorials arduino LectureNote withhhsong wifiesp