ArduinoIDE - xoseperez/espurna GitHub Wiki
🔴 NOTICE that Arduino IDE support is provided as-is and is not guaranteed to work well (or, at all). Please consider using VS Code + PlatformIO extension or PlatformIO CLI.
You can install the Arduino IDE by downloading it from arduino.cc. Do not download the installer but the compressed file targeted to your OS. This way you will be able to decompress it on your system or on an USB pendrive for instance and carry it with you anywhere. They call it portable Arduino IDE.
All you have to do is decompress it (unzip it or unbzip it) where you want, open the folder and create a "portable" subfolder there. Now you can open the Arduino IDE by clicking on the executable.
Minimum required version is 2.x.x
First step is to install support for ESP8266 based boards on the Arduino IDE through the Board Manager. These instruction are copied and adapted from the Arduino Core for ESP8266 documentation here: https://github.com/esp8266/Arduino/.
- Start Arduino and open Preferences window.
- Enter
https://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas. - Open Boards Manager from Tools > Board menu and find esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
- Select the version you need from a drop-down box.
- Click install button.
This step is not required but strongly recommended.
Since version 1.13.6, ESPurna includes custom board configurations to help with IDE builds:
- https://github.com/xoseperez/espurna/tree/dev/dist/arduino_ide/
- https://github.com/xoseperez/espurna/tree/dev/dist/ld/
Depending on the Core version that you want to use, choose either latest
or 2.3.0
directories.
The ESPurna project relies on several 3rd party and custom libraries. These libraries have to be loaded in you arduino environment before attempting to build the project. Some of these libraries are available through the library manager in Arduino IDE, others you will have to install them manually.
🔴 When updating your local sources, make sure to come back here and update our libraries before reporting any issues!
Click on the "Manage Libraries" menu under "Sketch > Include Library". You will be presented a form with a search box on top. The first thing it will do is to connect to the Arduino servers to download the latest list of available libraries. Then you will have to search and install them. Please note that some libraries are optional and depend on the functionalities you want to include.
For the most up-to-date list, please see code/platformio.ini
lib_deps = ... in the [common]
section.
In case the library is missing from the Library Manager, you would need to manually install it, see the list below.
- Benoit Blanchon's ArduinoJson (Notice! Only version 5.13.5 is supported)
- Marvin Roger's AsyncMqttClient [1]
- Hristo Gochkov's ESPAsyncTCP
- Hristo Gochkov's ESPAsyncWebServer
- Xose Pérez's EEPROM Rotate
Button management, WiFi control and settings storage inspired by:
- Xose Pérez's DebounceEvent (Notice! No need to install)
- Xose Pérez's JustWifi (Notice! No need to install)
- The PatternAgents (et al.) Embedis (Notice! No need to install)
- Joël Gähwiler's Arduino MQTT [1]
- Nick O'Leary's PubSubClient [1]
- Pascal Kurtansky's Brzo I2C [2]
- Xose Pérez's FauxmoESP
- Xose Pérez's HLW8012 [3]
- Xose Pérez's my92xx [4]
- Xose Pérez's NoFUSS
- David Conran's, Mark Szabo (et al.) IrRemoteES8266 Paul Stoffregen (et al.) OneWire
- Mariusz Kacki's PMS [4]
- Randy Simons' RemoteSwitch
- Maxim Prokhorov's fork of Xose Pérez's RPNLib [5]
- @1technophile fork of Suat Özgür's RCSwitch [6]
You will have to install manually the libraries that are not available from the Library Manager. The Arduino IDE lets you install a library from a ZIP file, so we will download all the required libraries from their repositories in a ZIP file and install them. You can look for them manually but I have gathered the URLs to those ZIP files here for convenience:
Download the ZIP files from the links in the table below only for those libraries you actually need. If you are unsure start with the mandatory ones. Then use the menu under "Sketch > Include Library > Add .ZIP Library..." and load them one by one.
Depending on your level of GIT confidence you can check out the repositories for all of them into your library folder instead of installing them as ZIP files.
Assuming you have already checked out the project from github using git, you just have to open the 'code/espurna/espurna.ino' file. The rest of the files will open as tabs in the IDE. Unfortunately the IDE does not support opening files under subfolders, and that includes the configuration files you will have to modify in the next step.
The ESPurna firmware uses build flags to target specific boards or enable support for certain sensors. The Arduino IDE does not have a friendly way to specify build flags from the interface so the best option is to manually modify the 'code/espurna/config/arduino.h' file to define what we want to build. Edit that file with your favorite editor (it's not accessible from the IDE, the pic below is from Atom) and uncomment the options to suit your need. In the example below we are compiling for Sonoff TH with DHT support.
Also, you might want to take a look at other compilation options and default values in 'code/espurna/config/general.h'.
First you will have to choose the right board and memory map. Here you have a list of the supported board types and the suggested configuration:
Board type | Board names | Flash size | Flash mode | IwIP |
---|---|---|---|---|
ESP-12 based modules | Wemos D1 & D1 mini, NodeMCU, Electrodragon, OpenEnergyMonitor MQTT Relay Board,... | 4M (1M SPIFFS) | DOUT | LWIP v2 |
Generic ESP8285 module | Sonoff 4CH, Sonoff 4CH Pro, Sonoff Touch, Sonoff B1, Sonoff T1, AI-Thinker Wifi Light | 1M (no SPIFFS) | DOUT | LWIP v2 |
Generic ESP8266 module | All the rest | 1M (no SPIFFS) | DOUT | LWIPv2 |
When using custom boards.local.txt and ld scripts:
Board type | Board names | Flash size | Flash mode | IwIP |
---|---|---|---|---|
Generic ESP8266 module | Any | DOUT | Any |
There will be 4 additional flash sizes available:
- 1M (1 EEPROM Sector, no SPIFFS)
- 2M (4 EEPROM Sectors, 1M SPIFFS)
- 4M (4 EEPROM Sectors, 1M SPIFFS)
- 4M (4 EEPROM Sectors, 3M SPIFFS)
Now you are ready to build the project clicking on the 'tick' button. Take a close look at the output window in the IDE for errors (in red). Common errors here could be missing libraries (go back to the installing dependencies section above) or the "Unsupported hardware" error, meaning you have not defined the target device (go back to the configuring hardware section).
Finally, if there were no errors, connect your device (check the Hardware document for instruction on how to connect your device to flash it), choose the port your programmer is listening to, and flash it clicking on the 'upload' button.
1 See MQTT configuration.
2 See I2C configuration.
3 See Sensors configuration.
4 See Lights configuration.
5 See RPN Rules configuration.
6 See RFBridge configuration.