SIGN IN

IoT Enabled Serial LCD Display

Bolt IoT Community January 13, 2020

Overview

Have you ever wanted to display custom messages on an LCD screen from anywhere in the world? With the Bolt IoT WiFi module and an Arduino, you can send text to a 16x2 LCD display remotely via the Bolt Cloud.

This project demonstrates how to interface a serial LCD display with the Bolt WiFi module using UART communication. You can type a message on the Bolt Cloud dashboard and have it appear on the LCD display connected to your Arduino in real time.

Things Used In This Project

Hardware Components

ComponentQuantity
Bolt WiFi Module1
Arduino Uno R31
16x2 LCD Display1
10K Potentiometer1
220 Ohm Resistor1
Breadboard1
Jumper WiresAs Required

Software and Online Services

Hardware Setup

Step 1: Connect the LCD to Arduino

Wire the 16x2 LCD display to the Arduino as follows:

LCD PinArduino Pin
VSSGND
VDD5V
V0 (Contrast)Potentiometer Wiper
RSDigital Pin 12
RWGND
E (Enable)Digital Pin 11
D4Digital Pin 5
D5Digital Pin 4
D6Digital Pin 3
D7Digital Pin 2
A (Anode)5V via 220 Ohm Resistor
K (Cathode)GND

Connect the potentiometer to adjust the contrast of the LCD display. The wiper pin goes to V0 on the LCD, with the other two pins connected to 5V and GND.

Step 2: Connect Bolt to Arduino

Connect the Bolt WiFi module to the Arduino for UART communication:

Bolt WiFi ModuleArduino
TXRX (Pin 0)
RXTX (Pin 1)
GNDGND
5V5V

Note: Disconnect the TX/RX wires when uploading code to the Arduino, as they share the same serial lines used for programming.

Software Programming

Step 3: Upload Arduino Code

Open the Arduino IDE and upload the following code to the Arduino Uno:

#include <LiquidCrystal.h>
#include <BoltIoT-Arduino-Helper.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Bolt IoT LCD");
  boltiot.begin(Serial);
  boltiot.setCommandString("display", displayMessage);
  Serial.begin(9600);
}

String displayMessage(String message) {
  lcd.clear();
  lcd.setCursor(0, 0);
  if (message.length() > 16) {
    lcd.print(message.substring(0, 16));
    lcd.setCursor(0, 1);
    lcd.print(message.substring(16));
  } else {
    lcd.print(message);
  }
  return "Message displayed";
}

void loop() {
  boltiot.handleCommand();
}

Step 4: Setup Product on Bolt Cloud

Log in to cloud.boltiot.com and create a new product. Set the product type to Output and the connection type to UART since the Bolt communicates with the Arduino over serial.

Link your Bolt device to the product and click Configure to add the following HTML/JS code to the product code section:

<!DOCTYPE html>
<html>
<head>
    <title>Serial LCD Display</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
    <h2>IoT LCD Display Controller</h2>
    <input type="text" id="message" placeholder="Enter message" maxlength="32">
    <button onclick="sendMessage()">Send to LCD</button>
    <p id="status"></p>

    <script>
    var API_KEY = ""; // Your API key
    var DEVICE_ID = ""; // Your device ID

    function sendMessage() {
        var msg = document.getElementById("message").value;
        $.get("https://cloud.boltiot.com/remote/" + API_KEY + "/serialBegin?baud=9600&deviceName=" + DEVICE_ID);
        $.ajax({
            url: "https://cloud.boltiot.com/remote/" + API_KEY + "/serialWR",
            data: { "data": "display " + msg, "deviceName": DEVICE_ID },
            success: function(r) {
                document.getElementById("status").innerHTML = r.success == 1 ? r.value : "Device offline";
            }
        });
    }
    </script>
</body>
</html>

Replace the API_KEY and DEVICE_ID with your own credentials from the Bolt Cloud dashboard. Save the product.

Step 5: Test the System

Power on the Arduino and make sure the Bolt WiFi module is connected to your WiFi network. Open the product view on the Bolt Cloud dashboard, type a message into the text field, and click "Send to LCD". The message should appear on the LCD display within a few seconds.

Messages up to 32 characters long are supported -- the first 16 characters appear on the first line of the LCD and the remaining characters wrap to the second line.

Conclusion

You now have a fully functional IoT-enabled LCD display that you can control from anywhere in the world through the Bolt Cloud. This project can be extended to display sensor data, notifications, or any other information you want to show remotely.

Want to build more such IoT and ML projects? Want to learn IoT and ML from basics? Check out the Bolt IoT and ML training. This online video training is excellent for those who want to start with IoT and ML because it teaches you to build projects from the basics.

Subscribe to our Newsletter

Get the latest IoT tutorials, projects, and updates delivered to your inbox.