You can make a standalone local chat server that works without the internet from your ESP8266 NodeMCU.
When you connect the ESP to the power, it creates a WiFi network and hosts a local chat server. You can send messages to a public channel, without the internet, and read them.
The ESP stores the messages in its EEPROM, so your messages remain after a server reboot. In the off-canvas menu, you can check how much space is left in the disk and empty the storage.
By default, the NodeMCU blinks its built-in LED every second. You can turn this off in the menu.
This project is based on Kuuhhl's esp8266Chat but has many improvements.
- 📱 New, modern, responsive, mobile-friendly, lightweight (1 kb) theme
- 🚀 Performance boost: browser side caching, gzipped files, fewer HTTP request
- 📈 Display telemetry data
- 👨⚕️ Better browser support (HTML errors fixed)
- 💡 Toggleable built-in LED blinking
- 📖 Lot of code refactoring
- 📖 Documentation extensions
- Download the latest release
.bin
files. - Download and install esptool.py.
- Flash the
.bin
files using this command:esptool.py write_flash 0x0 firmware.bin 0x00300000 littlefs.bin
.
- Connect the esp8266 to a power bank.
- Connect to the newly created Wifi-Hotspot
Chat Server
. - Open any URL in your browser, it should automatically redirect you. (it doesn't work? try to replace
https://
in your URL withhttp://
.)
- Install VS Code and PlatformIO extension
- Clone (download) the repository from GitHub
- Open the project with PlatformIO
- To change the theme you have to copy the selected theme minified and gzipped
index.html.gz
file to thedata
folder (the PlatformIO uses this folder to build the file system image for the ESP) - Build and upload the code with the
General/Build
button - Build the file system image with the
Platform/Build Filesystem Image
button - Upload the file system image with the
Platform/Upload Filesystem Image
button
- Copy
index.html
to compressed folder - Minify CSS and copy to the
<style>
tag: https://www.toptal.com/developers/cssminifier - Minify JavaScript and copy to the
<script>
tag: https://www.toptal.com/developers/javascript-minifier - Minify HTML: https://codebeautify.org/minify-html
- Gzip HTML: https://gzip.swimburger.net/
- Copy the combined, minified, and compressed HTML to the
data
folder
We do some optimizations on the website before uploading to the ESP. to make it as small as possible. This task can be automatized. This can be done with Python (extra_script.py
) or with Marlin, but it is not working yet, so we need to do it manually.
- Minify CSS: https://www.toptal.com/developers/cssminifier
- Minify JS: https://www.toptal.com/developers/javascript-minifier
- Combine HTML CSS, and JS into one HTML file
- Minify the combined HTML https://www.toptal.com/developers/html-minifier
- Gzip the combined HTML https://gzip.swimburger.net/
/
default landing page.- removed, because the CSS merged to one HTML file/styles.css
css styles for the landing page.- removed, because the JS merged to one HTML file/scripts.js
js scripts for the landing page./sendText
POST endpoint to send a new message. Parameters:nickname
,text
./showText
content of messages.txt file./lastWrite
timestamp of last write./clear
clear all messages./toogleBlynk
toggle led blinking function. Returns the actual state of blinking (0
or1
)./getFreeSpace
free space in the EEPROM in bytes
- Use WebSocket instead of REST API
- Automate data minify, gzip, compress, build Filesystem image and upload Filesystem image
- Improve UI Design to look like Messenger, with animations
- Tranform the frontend to a PWA
- Notifications