1 # Temperature Sensor Example
3 ## Building the Example Application
5 Building the example application requires the use of the Espressif ESP32 IoT
6 Development Framework and the xtensa-esp32-elf toolchain.
8 The VSCode devcontainer has these components pre-installed, so you can skip this
9 step. To install these components manually, follow these steps:
11 - Clone the Espressif ESP-IDF and checkout release/v4.2 branch
15 $ git clone https://github.com/espressif/esp-idf.git
17 $ git checkout release/v4.2
18 $ git submodule update --init
19 $ export IDF_PATH=${HOME}/tools/esp-idf
24 $ sudo apt-get install ninja-build
26 ### To build the application, follow these steps:
28 Currently building in VSCode _and_ deploying from native is not supported, so
29 make sure the IDF_PATH has been exported(See the manual setup steps above).
31 - Setting up the environment
33 To download and install packages.
35 $ cd ${HOME}/tools/esp-idf
38 $ cd {path-to-connectedhomeip}
39 $ source ./scripts/bootstrap.sh
40 $ source ./scripts/activate.sh
41 $ cd {path-to-connectedhomeip-examples}
43 If packages are already installed then simply activate it.
45 $ cd ${HOME}/tools/esp-idf
48 $ cd {path-to-connectedhomeip}
49 $ source ./scripts/activate.sh
50 $ cd {path-to-connectedhomeip-examples}
52 - Configuration Options
54 To choose from the different configuration options, run menuconfig
58 Select ESP32 based `Device Type` through `Demo`->`Device Type`.
59 The device types that are currently supported include `ESP32-DevKitC` (default),
62 If you are using `standalone chip-tool` to communicate with the ESP32, bypass the
63 Rendezvous mode so that the device can communicate over an insecure channel.
64 This can be done through `Demo`->`Rendezvous Mode`->`Bypass`
66 To connect the ESP32 to your network, configure the Wi-Fi SSID and Passphrase through
67 `Component config`->`CHIP Device Layer`->`WiFi Station Options`->`Default WiFi SSID` and
68 `Default WiFi Password` respectively.
70 - To build the demo application.
74 - After building the application, to flash it outside of VSCode, connect your
75 device via USB. Then run the following command to flash the demo application
76 onto the device and then monitor its output. If necessary, replace
77 `/dev/tty.SLAB_USBtoUART`(MacOS) with the correct USB device name for your
78 system(like `/dev/ttyUSB0` on Linux). Note that sometimes you might have to
79 press and hold the `boot` button on the device while it's trying to connect
80 before flashing. For ESP32-DevKitC devices this is labeled in the
81 [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description).
83 $ idf.py flash monitor ESPPORT=/dev/ttyUSB0
85 Note: Some users might have to install the
86 [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
87 before the device shows up on `/dev/tty`.
89 - Quit the monitor by hitting `Ctrl+]`.
91 Note: You can see a menu of various monitor commands by hitting
92 `Ctrl+t Ctrl+h` while the monitor is running.
94 - If desired, the monitor can be run again like so:
96 $ idf.py monitor ESPPORT=/dev/ttyUSB0
98 ## Using the Echo Server
100 ### Connect the ESP32 to a 2.4GHz Network of your choice
102 1. If the `WiFi Station Options` mentioned above are populated through
103 menuconfig, then ESP32 connects to the AP with those credentials (STA mode).
105 2. Now flash the device with the same command as before. (Use the right `/dev`
108 $ idf make flash monitor ESPPORT=/dev/ttyUSB0
110 3. The device should boot up and connect to your network. When that happens you
111 will see a log like this in the monitor.
113 I (5524) chip[DL]: SYSTEM_EVENT_STA_GOT_IP
114 I (5524) chip[DL]: IPv4 address changed on WiFi station interface: <IP_ADDRESS>...
116 Note: If you are using the M5Stack, the screen will display the server's IP
117 Address if it successfully connects to the configured 2.4GHz Network.
120 [standalone chip-tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool)
122 [iOS chip-tool app](https://github.com/project-chip/connectedhomeip/tree/master/src/darwin)
123 to communicate with the device.
125 Note: The ESP32 does not support 5GHz networks. Also, the Device will persist
126 your network configuration. To erase it, simply run.
128 $ idf make erase_flash ESPPORT=/dev/ttyUSB0
130 The demo application supports temperaturemeasurement and basic cluster.
134 Optimization related to WiFi, BLuetooth, Asserts etc are the part of this
135 example by default. To enable this option set is_debug=false from command-line.
138 idf make build flash monitor 'is_debug=false'