Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: ESPTerm - webbased VT100 Post ReplyPost New Topic
<< Prev Page of 2
Message << Prev Topic | Next Topic >>
Regular Member
Regular Member

Joined: 20 February 2014
Location: Austria
Online Status: Offline
Posts: 68
Posted: 15 September 2017 at 8:36pm | IP Logged Quote bigfix

Useful Code Snippet from Rob to test Mouse functionality:

Const ESC=Chr$(27)

Print ESC "[?9h";              ' enable mouse reporting
Print ESC "[?1015h";           ' select URXVT encoding (if available)
Print ESC "[?1006h";           ' select SGR encoding (if available)

  Do: A$=Inkey$: Loop Until A$<>""
  If A$=Chr$(27) Then Print
  If Asc(A$)<32 Then Print "<" Str$(Asc(A$)) ">"; Else Print A$;
Loop Until A$=Chr$(120)

Print ESC "[?1006l";           ' disable SGR encoding
Print ESC "[?1015l";           ' disable URXVT encoding
Print ESC "[?9l";              ' disable mouse reporting

it makes use of alternative encoding for the mouse location reporting - SGR (1006) is the preferred reporting method, URXVT (1015) is ok but not great, while the default encoding can not encode beyond column 95 if using 7-bit characters.

To exit type "x"

Mousebuttons are encoded in first Value - even the wheel works
Scren shows left button clicks in corners & center

Back to Top View bigfix's Profile Search for other posts by bigfix
Regular Member
Regular Member

Joined: 20 February 2014
Location: Austria
Online Status: Offline
Posts: 68
Posted: 23 October 2017 at 9:21am | IP Logged Quote bigfix

Ondrej, the main author, is back to University, writing his Master
But he implemented some great features to ESPTerm before
I was running some simple tests for a week and it looks very stable to me

ESPTerm Releases

This release was tested with ESP-01, ESP-01S and ESP-12.
It's known to work best in Chrome (Chromium, Brave, Opera), Firefox and Safari.
Internet Explorer is not supported.
MS Edge reportedly works to some degree, but is very slow.

Some 2.2. Features:

Image backgrounds - allow a DYNAMIC background behind Text Forground

Image background can be configured in the Terminal Settings form, or sent using an OSC command:
[Escape] = Chr$27
[Bell] = Chr$7

OSC 70 ; url ST -
eg. [Escape]]70;https://goo.gl/sh4dny[Bell]

is the damselfly from the above screenshot (source: Wikipedia).

The URL is resolved by user's browser, so HTTPS or even FTP can be used.
Animated gifs will work too.
Note: don't use this if you expect users to connect to the built-in AP,
they won't be able to access the image.

This feature is useful for: logos, process diagrams, pre-rendered UI elements, etc.

The URL can be max 100 characters long.
The image will be centered and scaled to fit the screen. Note that about 6px on either side of the screen is used for the margins and the screen size, resp. aspect ratio, may slightly vary with the font used.
Don't expect pixel-perfect graphics, if you need that, use any of the Unicode line / box drawing characters.
The image will be visible where the default background color is used - use [Escape][0m or [Escape][49m to reset to the default color.
The background color around and behind the image is your configured default background color
Clear the background URL box or send [Escape]]70;[Bell] if you want no background image.

Debug parser - select in terminal settings.
this parser captures all input and instead of interpreting the sequences, shows them right on the screen.
Green codes are low ASCII control characters, red are corrupt UTF-8 sequences.

Here's an example sending an image file to the UART.

Partial screen updates
This is a big performance boost, the terminal should now redraw faster in most cases.
Implementing this feature was quite challenging, and to make it happen, we had to completely re-work the message format sent through the WebSocket.

Color pickers in the theme form

click inside the fg / bg text field to open a color picker.

Multiple Languages

we now offer a Czech and German build alongside the main English one
all except the Help and About pages (which are full of text) are translated
because this changes the embedded html pages, at the moment the language cannot be switched other than by flashing a different binary
New download format

each zip package with the localized 0x00000 and 0x40000 bins also includes a readme, check-sums file, and a flash script.
to verify checksums, run sha256sum -c checksums.txt in the inner folder.
the flash script can be customized using env variables (open it for more info)

Networking commands!

Simple messages for ESPTerm-to-ESPTerm messaging
Command to request an external server and get back the response headers and/or body
API endpoint that can be used for remote control from PC (/api/v1/msg, GET or POST)
For more info, please refer to the build-in help page, it explains it in great detail.

This can run intermixed with terminal traffic on the same COM port
It is done with private messages, which are usually ignored by terminals

[Escape] = Chr$27
[Bell] = Chr$7
^ is the plain "Uparrow" Ascii Symbol - not "Control"

Device-to-device Messaging

To send a message to another ESPTerm module or IP Node, use: [Escape]^M;DestIP;message[Bell].

This command sends a POST request to http://<DestIP>/api/v1/msg.
The IP address may be appended by a port, if needed (eg. :8080).
In addition to POST, a GET request can also be used.
In that case, any GET arguments (/api/v1/msg?arguments) will be used instead of the request body.
This is intended for external access when sending POST requests is not convenient.

Each ESPTerm listens for such requests and relays them to UART:
with length being the byte length of message, as ASCII.

Notice a pattern with the first letter:
capital is always a command, lower case a response.
This is followed with the HTTP commands and any networking commands added in the future.

Example: Node sends a message to
Node receives [Escape]^m;;L=5;Hello[Bell] on the UART.

Note that the IP address in the reception message is that of the first node,
thus it can be used to send a message back.

External HTTP requests

To request an external server, use [Escape]^H;method;options;url\nbody[Bell].

method - can be any usual HTTP verb, such as GET, POST, PUT, HEAD.
options - is a comma-separated list of flags and parameters:
H - get response headers
B - get response body
X - ignore the response, return nothing

N=nonce - a custom string that will be added in the options field of the response message.

Use this to keep track of which request a response belongs to.

T=ms - request timeout (default 5000 ms), in milliseconds
L=bytes - limit response length (default 0 = don't limit).
Applies to the head, body, or both combined, depending on the H and B flags
l=bytes - limit the response buffer size (default 5000 B).
This can reduce RAM usage, however it shouldn't be set too small,
as this buffer is used for both headers and the response body.
url - full request URL, including http://. Port may be specified if different from :80,
and GET arguments may be appended to the URL if needed.
body - optional, separated from url by a single line feed character (\n).
This can be used for POST and PUT requests.
Note: the command may be truncated to the maximum total length of 256 characters if too long.
The response has the following format: [Escape]^h;status;options;response[Bell]

status - a HTTP status code, eg. 200 is OK, 404 Not found.
options - similar to those in the request, here describing the response data.

This field can contain comma-separated B, H and L=bytes and N=nonce.
response - the response, as requested.
If both headers and body are received, they will be separated by an empty line
(i.e. \r\n\r\n). Response can be up to several kilobytes long, depending on the L= and l= options.

Example: [Escape]^H;GET;B;http://wtfismyip.com/text[Bell]
- get the body of a web page (wtfismyip.com is a service that sends back your IP address).
A response could be [Escape]^h;200;B,L=11;[Bell].

Back to Top View bigfix's Profile Search for other posts by bigfix
Regular Member
Regular Member

Joined: 20 February 2014
Location: Austria
Online Status: Offline
Posts: 68
Posted: 24 October 2017 at 8:02am | IP Logged Quote bigfix

A message from Ondrej just came in on the mailing list:

A quick update about the current development.
I don't have as much time as before,
so it's going a bit slower, but has not stopped!

Here's a line-up of the features that will, hopefully, be in the next release, 2.3:

- Settings export and import with INI files

this feature is already implemented and working, there will be a testing build soon.
This essentially lets you clone or back-up a well configured module, all in readable,
easy to edit text files that can be archived and exchanged.
An example INI file exported from my testing module:

- Support for access via port forwarding / https tunnel
(we have some bugs in the front-end code that prevent this from working)

- Configurable button count
a command and setting to lower the number of buttons

- Configurable button colors
again, a command and setting

Let me know if there's any features or fixes you want added (reply here,
or post it on GitHub).
ESPTerm GitHub
ESPTerm Mailinglist

Any small improvements can still be squeezed into this release,
which should be ready in a couple weeks at most.

Back to Top View bigfix's Profile Search for other posts by bigfix

Joined: 02 October 2012
Location: Australia
Online Status: Offline
Posts: 502
Posted: 25 October 2017 at 12:48am | IP Logged Quote panky


A very interesting project and congratulations to Ondrej for his work.

It is not completely clear to me how the Micromite and the esp interact and where the web fits into this - could you explain a little more on how it all ties together please?

A simple diagram might also assist?


DonTSM1,Duinomite,CGCMM1,CGCMM2,2xDimitech,3xWWuMites,MicksMuP,Grogster1A,4xPeterMuM+,Zonker DIP-600,3xCGuKits,CGuBoard2,SnadPic100,SCBP64 & Exp100,PMMZ144,PMMZ100 .. and loving it![:D
Back to Top View panky's Profile Search for other posts by panky
Regular Member
Regular Member

Joined: 20 February 2014
Location: Austria
Online Status: Offline
Posts: 68
Posted: 25 October 2017 at 8:38am | IP Logged Quote bigfix

it is really very simple

The ESPTerm acts basically like a VT102 without a physical screen/keyboard

When you flash the code into a ESP and powercycle it, then you will see a new WLAN with the SSID TERM-xxxxx

You connect to this WLAN and get an IP address from the built in DHCP

Then you type in in the Web-Browser (best use Chrome)

If everything is working, you should see a small terminalwindow and a few buttons
You have an integrated Help page, which should explain everything

Then you click on WiFi & Network and configure your preferences
Recommend to join existing network with a fixed IP and disable integrated accesspoint
then powercycle and join the normal network and type the assigned IP address

Now config Terminal to 80x24, dark foreground, light background, capture F5,11,12
- this makes it working smoothly with MMbasic edit

Config Baudrate - recommend 230kbit (same on MMite !!)

As a test you can short the ESP xmit/rcv wires and type some characters
- this should be echoed to the terminalwindow in the browser

Now you should be able to connect the rcv/xmt wires to a MMite (crossed)
and work just like your usual terminal emulation
You can run the MMBasic editor etc...

If you open another window on another PC/Tablet you will see the same screen synced in realtime - Input will be mixed from both
Do not use more than 2 open windows for best performance

If you send the charactersequences from the help page you can steer many things like title line, screen size ...

you can also insert a background in a dynamic fashion
Chr$27 + ]70;https://goo.gl/sh4dny = Chr$7
should display a damselfly from the web

The URL string can be max 100 Char long - be careful with naming

So for instance you can create a Weatherstation background with all the bells and whistles on Powerpoint or Photoshop
Then you create i.e. 8 Versions of this, with different wind direction pointers
Store this at your local NAS - or you could trust some internet hoster

Now you dynamically select the right background based on wind direction and send the right ascii sequences to overlay the text fields on the background

This approach has limited scaleabilty if you have more than one variable graphic
i.e. wind direction & weather status gives you 8x4 = 32 pictures

Together with Touch/Mouse enabled (Discussed earlier here) you can create complete GUIs mixing static background with colored text buttonfield overlay
You can create professional looking tabbed menu pages

access to MMbasic device from any normal Web browser without special APPs or plugins
dirt cheap user interface ...

What is the tradeoff ?

Currently only WiFi - slim chances of getting wired connectivity with ESP32

No real fonts/sizes in the text foreground - but all attributes/colors

Not integrated in MMbasic with simple commands
You need to build character sequences yourself or create functions

Input parser required, IF you want to use more than classic terminal
KB Input
Per2Peer Networking
WEB Api Networking
can all work concurrently over the same COM port
MMbasic needs to demultiplex those streams

just play with it, use help, then you will understand


Edited by bigfix on 25 October 2017 at 8:40am
Back to Top View bigfix's Profile Search for other posts by bigfix
Senior Member
Senior Member

Joined: 07 August 2016
Location: United States
Online Status: Offline
Posts: 141
Posted: 26 October 2017 at 10:39am | IP Logged Quote Quazee137

Still waiting for my two seems to be a very slow boat when I was marked airmail.

Firefox fonts

Thanks for getting to know Ondrej and getting this working for us.

Funny thing Ondrej wrote the minecraft editor my Granddaughter uses.
Back to Top View Quazee137's Profile Search for other posts by Quazee137

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
<< Prev Page of 2
In the news...
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1094 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11