== ESP-WROOM-32のセットアップについて == ESP-WROOM-32は、Xtensa Dual-Core 32-bit LX6 マイクロプロセッサを搭載する、上海のESPRESSIF社が開発した無線モジュールです。WiFiとBluetooth v4.2に対応しています。 開発ボードはスイッチサイエンスでも販売されている(要追記)他にも、ESPRESSIF社からESP32-DevKitCなどが発売さています。 本ページでは、このESP-WROOM-32をArduinoIDEで開発するためのセットアップとATコマンドモードのセットアップ手順を記述します。記述内容は2017/04/15現在のものであるため、最新版では内容は変更されている場合があります。必要に応じて下記の資料[Arduino Core for ESP32 - Github]などを参照してください。 == ESP-WROOM-32 仕様 == ESP32製品サイトより抜粋。 > * KeyFeatures > * 240 MHz dual core Tensilica LX6 microcontroller with 600 DMIPS > * Integrated 520 KB SRAM > * Integrated 802.11BGN HT40 Wi-Fi transceiver, baseband, stack and LWIP > * Integrated dual mode Bluetooth (classic and BLE) > * 16 MByte flash > * 2.2V to 3.6V operating voltage > * -40°C to +125°C operating temperature > * On-board PCB antenna / IPEX connector for external antenna > * Sensors > * Ultra-low noise analog amplifier > * Hall sensor > * 10x capacitive touch interface > * 32 kHz crystal oscillator > * 32x GPIO > * 3 x UARTs, including hardware flow control > * 3 x SPI > * 2 x I2S > * 12 x ADC input channels > * 2 x DAC > * 2 x I2C > * PWM/timer input/output available on every GPIO pin > * OpenOCD debug interface with 32 kB TRAX buffer > * SDIO master/slave 50 MHz > * Supports external SPI flash up to 16 MB > * SD-card interface support > * Security Related > * WEP, WPA/WPA2 PSK/Enterprise > * Hardware accelerated encryption: AES / SHA2 / Elliptical Curve Cryptography / RSA-4096 > * Performance > * Supports sniffer, station, softAP and Wi-Fi direct modes > * Max data rate of 150 Mbps@11n HT40, 72 Mbps@11n HT20, 54 Mbps@11g, and 11 Mbps@11b > * Maximum transmit power of 19.5 dBm@11b, 16.5 dBm@11g, 15.5 dBm@11n > * Minimum receiver sensitivity of -98 dBm > * 135 Mbps UDP sustained throughput > * 2.5 μA deep sleep current == 資料 == * [https://espressif.com/en/products/hardware/esp32/overview ESP32製品サイト] * [https://espressif.com/en/products/hardware/esp32/resources ESP32リファレンスサイト] * [https://github.com/espressif/arduino-esp32 Arduino Core for ESP32 - Github] * [https://espressif.com/en/products/hardware/esp32-devkitc/resources ESP32-devkitCリファレンスサイト] * [https://github.com/espressif/esp32-at AT application for ESP32 ESP-IDF] == ArduinoIDEを用いた開発のセットアップ手順 == 参照元は[https://github.com/espressif/arduino-esp32/blob/master/doc/windows.md Windowsでのセットアップ手順]です。基本的な流れは、coreライブラリをGithubからダウンロードし、ArduionoIDEのシステムに導入するというものです。 ArduinoIDEのインストールは済まされているものとします。また、ArduinoIDEの`スケッチブックの保存場所`はデフォルトの`C:\Users\%USERNAME%\Documents\Arduino`から変更されていないものとします。変更した場合、適宜読み替えてください。 1. Githubからディレクトリをクローンし、`\Arduino\hardware\espressif\esp32`に展開する git環境を利用するのは、アップデートに対応しやすくするためです。 2. `\Arduino\hardware\espressif\esp32\tools\get.exe`を実行する `xtensa-esp32-elf`というディレクトリが作成されます。 3. 必要に応じてデバイスドライバを導入する スイッチサイエンスのものであれば[http://www.ftdichip.com/FTDrivers.htm FTDI社のデバイスドライバ]、ESP32-DevKitCであれば[https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers CP210x用のデバイスドライバ]を必要に応じて導入してください。 4. ArduinoIDEのツール->ボード設定が以下のようになれば導入成功です [[Image(board.png)]] === 動作確認 === 他のArduinoボードと同じように開発できます。非常に基本的なサンプルスケッチとしては以下のようなものがあります。 {{{ void setup() { Serial.begin(115200); } void loop() { Serial.println("Hello World."); delay(10000); } }}} これを書き込んで、シリアルモニターを開いたときの様子をいかに示します。 [[Image(hello.png)]] == ATコマンドモードのセットアップ == デフォルトではATコマンド用のファームウェアが書き込まれています。通信速度115200bps、改行モードCR+LFでコマンドの送信がができます。下は、ArduinoIDEでシリアルモニタを開いたときの様子です。 [[Image(serial.png)]] ATコマンド用の資料は[https://espressif.com/en/products/hardware/esp32-devkitc/resources ESP32-devkitCリファレンスサイト]のGetting Started->ESP32 AT Instruction Set and Examplesにあります。 このバージョンのファームウェアは、ArduinoIDEで開発をすると上書きされてしまうので、ArduinoIDEで開発を行ったあとにATコマンドモードに戻したくなった場合、別の手順を踏む必要があります。