Introduction: Chatting Using 'evive' and ESP8266

About: STEMpedia is a place bringing project-making tools at one place- kits, online courses, coding platforms, controller app and tons of free learning resources.

Chatting is fun and interesting, but what if hobbyists can do it using the ultimate IoT enabled platform? We made a chatting project using evive which is a very handy all-in-one platform to build our projects.

With this project, we will be able to send and receive messages between two devices, one using Arduino IDE's Serial Monitor and the other connected to evive via Wi-Fi (ESP8266). Usually, connecting a Wi-Fi module to an Arduino board involves lots of complex wiring and takes huge amount of time, but evive has a dedicated slot (adapter) for it in its Communication Module, making it a plug and play feature. Also ESP is recommended to work on 3.3V signals, but Arduino's serial communication works on 5V TTL for most of the boards. So forget connecting it directly, you will require a potential divider or additional logic level shifter to convert 5V to 3.3V. But evive took care of that for us, it has an inbuilt high speed logic level shifter (74LVC245).

Components Required:

  • evive
  • ESP-12E Wi-Fi module ESP8266

You may also need to install a telnet client (eg. PuTTY) for windows but no such software is required for a Linux machine. You can download PuTTY from here.

Step 1: Connecting to ESP8266 (Wi-Fi)

  • Plug the Wi-Fi module on evive as shown in the picture
  • Make sure you see a blue led blinking on the module
  • Now, connect to the Wi-Fi network "AI-Thinker-xxxxx" from the other device [second computer]
  • You are now connected to the Arduino Mega via serial 3. (DO NOT connect Bluetooth module or XBee along with the Wi-Fi module)

Now, your first computer is connected to evive via serial and second is connect to evive via Wi-Fi.

To know more about ESP, visit http://www.esp8266.com/wiki/doku.php?id=getting-st...

The good thing is, there are no messy wires around. Thanks to evive, just plug it and play.

Step 2: Exploring AT Commands

The ESP8266 Wi-Fi runs through AT commands. A lot of these commands are available for various functions. You can take a look at this for example. You can try these AT commands in the serial monitor by uploading the following arduino code.

When you have tried all the AT commands in this code you may proceed to the next step for making the chatting platform.

Step 3: Understanding the Coding Procedure

Using the previous code you can have a chat like experience already. All you have to do is the following:

  1. First, check whether the ESP module is connected properly by giving command AT in the serial monitor.You should get an "OK"
  2. Now get the IP Address on which your ESP module is working by giving the command AT+CIFSR=?. If you get "OK" then enable the module to act as a “Station” by giving entering AT+CWMODE=2in the serial monitor
  3. After getting the affirmative response, enable the module to work for multiple connections by entering AT+CIPMUX=1 in the serial monitor
  4. Now, start the server using AT+CIPSERVER=1,1338, here 1338 is the port number. You can use any port number of your choice
  5. Next, open the telnet command prompt for Windows on the second computer. You can download PuTTY and use the IP address obtained in step 2 and the port number from step 4. For Linux terminals, all you have to do is type the command telnet "IP_address" "Port ".
  6. Now your telnet session is activated. Sending a message from telnet is very easy. You just have to type the message and press return.
  7. However for the serial monitor (first computer) you have to give the command AT+CIPSEND=0,"size_of_message" and then the message.

Step 4: Adding the Code

By this time, you know all the magic beneath.

We have developed a nice looking platform in this code.

Note that we have included the serial (mentioned in previous step) in the code itself. The remaining commands to begin the chatting are -

  • AT+CIPMUX=1
  • AT+CIPSERVER=1,1338

Step 5: Further Scope

You can modify it to work for three or more persons in a chat. This will lead you to a group chat with all your maker friends around. Of course we are trying to do so but you can also develop it.

evive product video can be found here.