This is a Javascript demo Mongoose OS app. The aim of this project is to demonstrate how to drive a Nextion HMI display from an ESP32 device.
Here is what you get when you deploy the application on your ESP32 board and your Nextion display:
- ESP32 Device
- Nextion 2.8" TFT 320x240 HMI
- Breadboard, wires, USB data cable ...
- For the mos tool, please follow the Mongoose OS instructions.
- For the nextion editor (optional), check this hint (Windows only).
git clone https://github.com/aschuma/esp32_nextion_js_binary_clock.git
This is an optional step. It might work without any preparation of the Nextion display.
If not, change to src/nextion
directory and follow the instructions in the README.md
file.
ESP32 5V <-> Nextion 5V (do NOT use 3V, this might kill the Nextion display)
ESP32 GND <-> Nextion GND
ESP32 GPIO16 <-> Nextion TX (optional, might be required in case of further development)
ESP32 GPIO17 <-> Nextion RX
cd src/mos
cp deploy.sh.template deploy.sh
- Open
deploy.sh
and alter the WiFi settings.
- Alter WiFi settings (ESP32 only support 2.4Ghz networks)
- Adjust the timezone
sys.tz_spec
. Please consult Google to find the value for your local time zone.
This could take some time. Be patient.
mos build --platform esp32 --local
- Power up the ESP32 device.
mos flash
- In case of problems, try to hold down the 'boot' button during the flashing process and/or explicitly set a port value, e.g.
mos flash esp32 --port /dev/tty.SLAB_USBtoUART
init.js
is the starting point.- Redeploy the altered sources by executing the
deploy.sh
script. - In case of problems, start the mos ui by calling
mos ui
and observe the log.
Be aware that my primary coding language is not javascript and I'm not an ESP32 or Mongoose OS expert at all. I'm still learning ESP32 development.
Please feel free to issue a bug report or submit a PR. Any helping hand is welcome.
- Espressif ESP32
- Nextion 2.8" TFT 320x240 HMI
- Mongoose OS
- Mongoose OS quick start guide
- mJS - Embedded JavaScript engine for C/C++
- https://wiki.iteadstudio.com/index.php?title=Nextion_Instruction_Set&oldid
- https://nextion.tech/editor_guide/
- pynextion - A Python library for Nextion smart display management. A little bit out of scope but helpful to see how to control Nextion via UART