Make a Private Chat Room via ESP8266

Tell us the story of your project.: 

First of all, thank you for reading this demonstration project as to how to utilize TheAmplituhedron IoT Services. If you want to see previous projects, please click here. I have always excited about exploring new ways of adding IoT features on my projects hence the fact that I programmed my own IoT Services on my website :) In this project, I wanted to show you how to create a private chat room over the Internet through a communication path or channel by using ESP8266. Of course, you can use any other device that can make an HTTP Get Request to a server instead of ESP8266. As I said before, I used TheAmplituhedron IoT Services for creating a connection path so that the private chat room is confined for three entry processes. In other words, only three devices are capable of reaching the dedicated server path to change the integrated variables as messages at the same time. Not surprisingly, this system is not the fastest communication service on the Internet; it, approximately, has four second lag time while retrieving the message string from the database after saving. So, I can say that this tutorial is more like a fun project about the Internet of Things than creating a full version communication system like WhatsUp but it provides new and significant additions in the extent of the embedded IoT features on ESP8266. To summarize, you can create a private chat over the Internet through TheAmplituhedron database for three different devices by taking the following steps below.

How-to: 
How It Works

As explained at the source code below, it works like a turn-based recovery system. Each of the message string transmitters changes the same connection path saving the message string to the database to be displayed. And therefore, each HTTP Request changes other devices' message strings to notify the user whether a new message string is sent by other devices or not. In other words, every time you send a message string your connection path, you change other data packets that are sent by external devices along with yours. So that you can think of the connection path as a hub which collects data packets from three different resources and saves them synchronously. In that regard, if you are the Guest_1 defined at the source code; when you send a message string from your device, you overwrite other guests messages at the same time. For instance, you sent HELLO as the message string to the connection path then other message strings are turned into Waiting… automatically as if other devices sent them.

Guest_1 = HELLO

Guest_2 = Waiting…

Guest_3 = Waiting…

For entering the message string, I used an 8 LED 4x4 Keypad Module which has the integrated push buttons. But, unfortunately, it occupies all available GPIO pins on the NodeMCU so that I had to monitor the message string through the serial monitor on Arduino IDE. However, you can use an LCD screen if you have extra GPIO pin to spare on your development board.

When you enter a symbol by using the keypad, it is saved as the message string to be displayed on the serial monitor after it notifies you when the WiFi connection is successful. And, when you write your message on the serial monitor, you can send it to your connection path by pushing the send button defined at the source code.

Collecting Message Strings

Every time you enter a new character by using the keypad, this character is saved to the message string to be monitored on the serial monitor.

And, when you decide to send the message string, you can send it to the connection path and other devices by merely pushing the send button.

How to use a Keypad Module with NodeMCU

NodeMCU pin mapping is not coherent so that occupying its all GPIO pins can be tricky. Most of them has already a predefined value for booting as depicted below. But only one of them can be a problem for you in this project tutorial. The reason is as follows. I had to attach D8 to the send button in input mode but it has already an internal current for activating sleep mode in the boot process. In that regard, do not forget to detach D8 when booting the NodeMCU.

Download the keypad library here.

Connections

Connect the keypad module as showed at the source code introduction in which all connection details are well-explained.

Demonstration

Serial Monitor Settings and Hedron

Sending Message Strings via ESP8266

Source Code and SSL Connection Instructions

To view the source code and the aforementioned IoT Services guideline, please click here.

 

Difficulty: 
Duration: 
Share a "Show & Tell" video.: 
https://www.youtube.com/watch?v=61CJa5rzsMk&t=1s
Collaborators: 
kutluhanaktar
Number of Forks: 
0
Tools: 
Name: 
Hot Glue Gun
Quantity: 
1
Materials: 
Name: 
8 LED 4x4 Keypad Module
Quantity or amount: 
1
Name: 
Male/Female Jumper Wires
Quantity or amount: 
10+
Name: 
Mini Breadboard
Quantity or amount: 
2
Boards & Kits: 
Name: 
NodeMCU [ESP-12E]
Quantity: 
1
Team Members: 
Team member name: 
kutluhanaktar
What role did this person play on the project?: 
Project Lead
Public
Sort Order: 
0
Teaser: 
Communicate up to three devices by sending message strings to a shared connection path, displayed on the Arduino IDE serial monitor. This project is to communicate with two devices instantly and privately on the same connection path.
Aha! moment: 
When I saw the first message string from my friend's NodeMCU on my communication path at my home.
Uh-oh! moment: 
Creating a system that handles the requests of three different message resources at the same time.
Show & Tell video as default: 
Creation Date: 
Wednesday, January 9, 2019 - 01:18

Add new comment