Prerequisite: Arduino IDE Configuration for Windows
Once you have created a fresh project, you must set the Board type. Most of the settings below the “Board: <type>” entry are specific to the board type selected. These settings only show up once you have set the board type. For many Arduino boards, there will only be a couple of entries. With ESP8266 based boards there are many. Many of these can be left with their defaults and I’ll only discuss setting the ones commonly requiring changes when using InqPortal projects.
Picking Your Board
When doing one-off projects or even when in the prototyping stage, the majority of people developing on ESP8266 based boards use either the NodeMCU or the WeMos as shown above. Their main advantage as development boards are that they supply USB connectivity for powering and programming the board. They also come in a form factor that easily fits on breadboards. InqPortal has been tested on NodeMCU, WeMos, ESP-01, ESP-07 and various other raw controllers without issue. If you’re using one of these more production-level boards types (ESP-01 and ESP-07), you are probably familiar with these settings and need very little coaching.
Upload Speed
This is merely the speed that it uploads your compiled project to the microcontroller. Setting too low and you just wait longer for it to upload. Setting too fast and your start getting write errors. I’ve found that 921,600 bits/second has worked on all ESP8266 reliably, but YMMV.
CPU Frequency
The default is 80 Mhz. I have yet to find a need to bump it up to the 160 Mhz option. The InqVent project retrieved two pressure readings and two temperature readings from two distinct sensors, did PID calculations, controlled two servos and one motor speed controller all updating at 100 Hz WHILE handling all web server requests and pumping out continuous real time data of system status at about 1 KB/sec to multiple clients. All using the 80 Mhz setting. These thumbnail size computers are surprisingly powerful! I usually opt for the slower rate and increased controller longevity. Besides upping the CPU does nothing for the WiFi side. The WiFi throughput is handled on a separate clock rate and is not configurable.
Flash Size
For the NodeMCU or WeMos the Flash Size selection is pretty simple. For some it can be quite a potpourri… the generic ESP8266 has 26 options. InqPortal is pretty stout… or should I say portly? Yeah! Cheap pun. Here are some guidelines. The FS signifies how much of the 4MB is allocated to act as your File System’s disk space. OTA stands for how large a program you can use and still take advantage of Over-The-Air project upgrading. OTA works by allocating two program spaces of either 512KB or 1019KB depending on your selection above. When upgrading the program, the current program uploads the new one into the “other” space and then sets the “start” pointer to the other program space and then re-boots. Bam! New program. For many programs, InqPortal is still lean enough to fit in the 512KB version even while controlling a bunch of hardware libraries for all your sensors. This way you can use the second menu entry and thus maximize your website disk space. If at some time, your program gets too bloated, you might have to bump up the the first menu entry and only have a 2MB hard disk.
Erase Flash
As far as InqPortal is concerned there are three sections of storage.
- Only Sketch – This is space that can hold two of your programs (see OTA comments in Flash Size)
- WiFi Settings – There is a small space of 4KB used EEPROM Settings. InqPortal uses it to persist some system data. This data are server settings, but InqPortal provides means for your Sketch to store data in this area. More about this later in the documentation.
- The left-over is used as a flash hard disk.
Best Practice – The first time I compile and upload a Sketch to a ESP8266, I always set it to erase All Flash Contents. I want to make sure there are no data anywhere that might corrupt the running of the project. Once you start configuring your InqPortal project with WiFi connections and loading web files onto the disk, you really don’t want to erase and reload them every time. After this first time, I set it to erase Only Sketch. The boot time will be quicker and it will retain your settings, other configuration data and files.
Port
Although the most important, it’s also the most simple. Have your ESP8266 connected via USB and it’ll show as an available port. Select your port.