How to Upload Program to Esp8266 Using Note 9
The ESP8266 contains a Serial Peripheral Interface Flash File System (SPIFFS). SPIFFS is a lightweight filesystem created for microcontrollers with a flash chip. This article shows how to hands upload files to the ESP8266 filesystem using a plugin for Arduino IDE.
Notation: if you lot take an ESP32 board, read Install ESP32 Filesystem Uploader in Arduino IDE.
Introducing SPIFFS
SPIFFS lets yous access the flash flake memory similar you would do in a normal filesystem in your computer, just simpler and more than limited. You tin can read, write, close, and delete files. SPIFFS doesn't back up directories, so everything is saved on a flat structure.
Using SPIFFS with the ESP8266 board is specially useful to:
- Create configuration files with settings;
- Save data permanently;
- Create files to save small amounts of information instead of using a microSD bill of fare;
- Salvage HTML and CSS files to build a spider web server;
- Salve images, figures and icons;
- And much more than.
In well-nigh of our web server projects, we've written the HTML code for the web server as a String directly on the Arduino sketch. With SPIFFS, you can write the HTML and CSS in separated files and save them on the ESP8266 filesystem.
Installing the Arduino ESP8266 Filesystem Uploader
You tin create, save and write files to the ESP8266 filesystem by writing the code yourself in Arduino IDE. This is not very useful, because you'd accept to type the content of your files in the Arduino sketch.
Fortunately, there is a plugin for the Arduino IDE that allows y'all to upload files directly to the ESP8266 filesystem from a folder in your reckoner. This makes it really easy and uncomplicated to work with files. Allow's install information technology.
Showtime, make sure you accept the latest Arduino IDE installed, and you have the ESP8266 add together-on for the Arduino IDE. If you don't, follow the side by side tutorial to install the add-on:
- Windows, Mac and Linux instructions – Installing the ESP8266 Board in Arduino IDE
Follow the next steps to install the filesystem uploader:
one) Get to the releases page and click the ESP8266FS-Ten.zip file to download.
2) Go to the Arduino IDE directory, and open the Tools folder.
iii) Unzip the downloaded .zip binder to the Tools folder. You should take a similar folder structure:
<home_dir>/Arduino-<version>/tools/ESP8266FS/tool/esp8266fs.jar
4) Finally, restart your Arduino IDE.
To check if the plugin was successfully installed, open your Arduino IDE and select your ESP8266 lath. In the Tools bill of fare check that y'all take the selection "ESP8266 Sketch Data Upload".
Uploading Files using the Filesystem Uploader
To upload files to the ESP8266 filesystem follow the next instructions.
1) Create an Arduino sketch and save information technology. For demonstration purposes, you can save an empty sketch.
2) Then, open up the sketch folder. You can get to Sketch > Testify Sketch Binder. The folder where your sketch is saved should open up.
3) Inside that folder, create a new folder called information .
iv) Within the data folder is where you lot should put the files you want to be saved into the ESP8266 filesystem. As an example, create a .txt file with some text called test_example.
5) In the Arduino IDE, in the Tools menu, select the desired SPIFFS size (this will depend on the size of your files)
6) Then, to upload the files, in the Arduino IDE, yous simply need to go to Tools> ESP8266 Sketch Data Upload.
You should get a similar bulletin on the debugging window. The files were successfully uploaded to the ESP8266 filesystem.
Testing the Uploader
Now, let's simply check if the file was actually saved into the ESP8266 filesystem. Only upload the following code to your ESP8266 board.
/********* Rui Santos Complete project details at https://RandomNerdTutorials.com *********/ #include "FS.h" void setup() { Series.begin(115200); if(!SPIFFS.begin()){ Series.println("An Error has occurred while mounting SPIFFS"); return; } File file = SPIFFS.open("/test_example.txt", "r"); if(!file){ Serial.println("Failed to open file for reading"); return; } Series.println(); Serial.println("File Content:"); while(file.available()){ Series.write(file.read()); } file.close(); } void loop() { }
View raw lawmaking
After uploading, open up the Series Monitor at a baud rate of 115200. Press the ESP8266 "RST" push button. It should print the content of your .txt file on the Serial Monitor.
You've successfully uploaded files to the ESP8266 filesystem using the plugin.
Wrapping Up
Using the filesystem uploader plugin is i of the easiest means to upload files to the ESP8266 filesystem. Yous can salve HTML and CSS files to build a web server, images or small icons, save configuration files, etc…
We have a project instance in which we build a web server using HTML and CSS files saved on the filesystem. The example is for the ESP32, simply it should be compatible with the ESP8266 with pocket-sized changes on the code.
If you like the ESP8266, y'all may similar the following resources:
- Habitation Automation using ESP8266
- ESP8266 DHT11 Temperature and Humidity Web Server
- ESP8266 Web Server Control Outputs
- ESP8266 GPIO Reference Guide
- More ESP8266 resource
Thanks for reading
Source: https://randomnerdtutorials.com/install-esp8266-filesystem-uploader-arduino-ide/
0 Response to "How to Upload Program to Esp8266 Using Note 9"
Postar um comentário