Phyiscal Wi-Fi Messenger… IoT

I have plans to make a simple WiFi messenger. There will be two ‘computers.’ A keyboard (with the enlightenment of a 1602 LCD) will input some simple text to a Wemos D1 board. Which in turn will send the text to a server (through server.send). Then the other computer’s LCD will receive the text on the server… The LCDs will always display the last Message sent.

So far I have uploaded a sketch that takes some text input from the Serial Monitor (baud rate 115200) and sends it to a server. I have also just ordered a USB port shield for the Wemos D1 Found Here that should accept the keyboard input in the future.

In other words, I don’t plan to use the serial monitor once I get my USB Host shield.

Update: Just got my USB Host so stuff is about to get lit!


This is the code I uploaded to the Wemos Board:


const char* ssid = “WiFi Name with Quotes”;
const char* password = “Password with Quotes”;
const byte numChars = 255;
char receivedChars[numChars];

boolean newData = false;

ESP8266WebServer server(80);

const int led = 13;

void handleNotFound() {
digitalWrite(led, 1);
String message = “File Not Found\n\n”;
message += “URI: “;
message += server.uri();
message += “\nMethod: “;
message += (server.method() == HTTP_GET) ? “GET” : “POST”;
message += “\nArguments: “;
message += server.args();
message += “\n”;
for (uint8_t i = 0; i < server.args(); i++) { message += ” ” + server.argName(i) + “: ” + server.arg(i) + “\n”; } server.send(404, “text/plain”, message); digitalWrite(led, 0); } void setup(void) { pinMode(led, OUTPUT); digitalWrite(led, 0); Serial.begin(115200); Serial.println(“What do you want to send?”); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.println(“”); // Wait for connection while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print(“.”); } Serial.println(“”); Serial.print(“Connected to “); Serial.println(ssid); Serial.print(“IP address: “); Serial.println(WiFi.localIP()); if (MDNS.begin(“esp8266”)) { Serial.println(“MDNS responder started”); } server.on(“/”, handleRoot); server.on(“/inline”, []() { server.send(200, “text/plain”, “this works as well”); }); server.onNotFound(handleNotFound); server.begin(); Serial.println(“HTTP server started”); } void loop(void) { server.handleClient(); recvWithEndMarker(); showNewData(); } void recvWithEndMarker() { static byte ndx = 0; char endMarker = ‘\n’; char rc; while (Serial.available() > 0 && newData == false) {
rc =;

if (rc != endMarker) {
receivedChars[ndx] = rc;
if (ndx >= numChars) {
ndx = numChars – 1;
else {
receivedChars[ndx] = ‘\0’; // terminate the string
ndx = 0;
newData = true;

void showNewData() {
if (newData == true) {
Serial.print(“Sent… “);
newData = false;

void handleRoot() {
digitalWrite(led, 1);
server.send(200, “text/plain”, receivedChars);
digitalWrite(led, 0);

If you use this board be sure to install the ESP library (google it), and put your own WiFi name and password.

Then open up serial monitor and set baud rate to 115200 press reset on the Wemos Board to see results!

Comment if you have any suggestions or ideas…

This post will be updated regularly. It is not finished!

Published by


TI-83 Plus enthusiast, TI-BASIC Programmer, poster, Arduino and Esp 8266 Learner...

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s