DESHBOT ROBOTIC SHIELD

Arduino Robot Demo Code

Learn robotics using the Deshbot Robotic Shield, Arduino Nano, DC motors, LCD display and Bluetooth / Serial communication.

Deshbot Robotic Shield Demo

A beginner-friendly robotics project for learning motor control, serial communication and LCD interfacing.

About This Project

This program demonstrates basic robot movement using the Deshbot Robotic Shield. The robot receives commands through Serial communication or a Bluetooth module such as HC-05.

What You Will Learn

  • Arduino Serial Communication
  • DC Motor Control
  • LCD Interfacing
  • Robot Movement Logic
  • Embedded Systems Basics

Hardware Required

  • Arduino NANO
  • Deshbot Robotic Shield
  • 16×2 LCD Display
  • L293D Motor Driver
  • 4 DC Motors
  • HC-05 Bluetooth Module

Pin Configuration

Pin configuration used by this Deshbot demo program.

Component Connection Arduino Pin Description
LCD RS A4 Register Select
LCD EN A3 Enable
LCD D4 A2 Data Line 4
LCD D5 A1 Data Line 5
LCD D6 A0 Data Line 6
LCD D7 13 Data Line 7
Motor 1 Motor_1a 8 Direction A
Motor 1 Motor_1b 9 Direction B
Motor 2 Motor_2a 6 Direction A
Motor 2 Motor_2b 7 Direction B
Buzzer / LED / WS2812B Selectable 11 Jumper Selectable
Switch 1 SW1 10 Push Button
Switch 2 SW2 12 Push Button
Ultrasonic Trig 4 Trigger
Ultrasonic Echo 5 Echo

Robot Control Commands

Send these commands through Serial Monitor or Bluetooth.

U
Forward Move Forward
D
Backward Move Backward
L
Left Turn Left
R
Right Turn Right
C
Stop Stop Robot

Complete Arduino Demo Code

Copy the code below and upload it to your Arduino Nano.

deshbot_robot_demo.ino
/*
============================================================
        DESHBOT ROBOTIC SHIELD - DEMO CODE
============================================================

Author: Deshraj Dhiman

Description:

This program demonstrates basic robot control using the
Deshbot Robotic Shield. The robot is controlled via
Serial commands (Bluetooth / USB), and movement status
is displayed on a 16x2 LCD.

------------------------------------------------------------
HARDWARE USED
------------------------------------------------------------

1. Arduino NANO
2. Deshbot Robotic Shield
3. 16x2 LCD Display
4. L293D Motor Driver
5. 4 DC Motors
6. Bluetooth Module (HC-05) / Serial Input

------------------------------------------------------------
PIN CONFIGURATION
------------------------------------------------------------

LCD:

RS -> A4
EN -> A3
D4 -> A2
D5 -> A1
D6 -> A0
D7 -> 13

Motor 1:

Motor_1a -> Pin 8
Motor_1b -> Pin 9

Motor 2:

Motor_2a -> Pin 6
Motor_2b -> Pin 7

------------------------------------------------------------
CONTROL COMMANDS
------------------------------------------------------------

U -> Move Forward
D -> Move Backward
L -> Turn Left
R -> Turn Right
C -> Stop Robot

============================================================
*/

#include <LiquidCrystal.h>


// ==========================================================
// LCD CONFIGURATION
// ==========================================================

const int rs = A4;
const int en = A3;
const int d4 = A2;
const int d5 = A1;
const int d6 = A0;
const int d7 = 13;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);


// ==========================================================
// SERIAL DATA
// ==========================================================

byte datarx;


// ==========================================================
// MOTOR CONTROL PINS
// ==========================================================

int Motor_1a = 8;
int Motor_1b = 9;

int Motor_2a = 6;
int Motor_2b = 7;


// ==========================================================
// SETUP
// ==========================================================

void setup()
{

    Serial.begin(9600);

    lcd.begin(16, 2);

    lcd.setCursor(0, 0);

    lcd.print(" Deshbot Robot ");


    pinMode(Motor_1a, OUTPUT);
    pinMode(Motor_1b, OUTPUT);

    pinMode(Motor_2a, OUTPUT);
    pinMode(Motor_2b, OUTPUT);


    Serial.println(F("=================================================="));

    Serial.println(F("       DESHBOT ROBOTIC SHIELD"));

    Serial.println(F("              QUICK REFERENCE"));

    Serial.println(F("=================================================="));

    Serial.println(F("Commands:"));

    Serial.println(F("  U = Forward"));
    Serial.println(F("  D = Backward"));
    Serial.println(F("  L = Left"));
    Serial.println(F("  R = Right"));
    Serial.println(F("  C = Stop"));

    Serial.println();

    Serial.println(F("Shield Pin Reference:"));

    Serial.println(
        F("Motors : Motor_1a=8 Motor_1b=9 Motor_2a=6 Motor_2b=7")
    );

    Serial.println(
        F("LCD    : RS=A4 EN=A3 D4=A2 D5=A1 D6=A0 D7=13")
    );

    Serial.println(
        F("Buzzer/LED/WS2812B : Pin 11")
    );

    Serial.println(
        F("Switches : SW1=10 SW2=12")
    );

    Serial.println(
        F("Ultrasonic : Trig=4 Echo=5")
    );

    Serial.println(F("=================================================="));

}


// ==========================================================
// MAIN LOOP
// ==========================================================

void loop()
{

    if (Serial.available() > 0)
    {

        datarx = Serial.read();

        Serial.println(datarx);

    }


    //--------------------------------------------------------
    // FORWARD
    //--------------------------------------------------------

    if (datarx == 'U')
    {

        lcd.setCursor(0, 1);

        lcd.print(" Moving Forward ");

        digitalWrite(Motor_1a, HIGH);
        digitalWrite(Motor_1b, LOW);

        digitalWrite(Motor_2a, LOW);
        digitalWrite(Motor_2b, HIGH);

    }


    //--------------------------------------------------------
    // BACKWARD
    //--------------------------------------------------------

    if (datarx == 'D')
    {

        lcd.setCursor(0, 1);

        lcd.print("Moving Backward");

        digitalWrite(Motor_1a, LOW);
        digitalWrite(Motor_1b, HIGH);

        digitalWrite(Motor_2a, HIGH);
        digitalWrite(Motor_2b, LOW);

    }


    //--------------------------------------------------------
    // LEFT
    //--------------------------------------------------------

    if (datarx == 'L')
    {

        lcd.setCursor(0, 1);

        lcd.print("  Moving Left  ");

        digitalWrite(Motor_1a, HIGH);
        digitalWrite(Motor_1b, LOW);

        digitalWrite(Motor_2a, LOW);
        digitalWrite(Motor_2b, LOW);

    }


    //--------------------------------------------------------
    // RIGHT
    //--------------------------------------------------------

    if (datarx == 'R')
    {

        lcd.setCursor(0, 1);

        lcd.print(" Moving Right  ");

        digitalWrite(Motor_1a, LOW);
        digitalWrite(Motor_1b, LOW);

        digitalWrite(Motor_2a, LOW);
        digitalWrite(Motor_2b, HIGH);

    }


    //--------------------------------------------------------
    // STOP
    //--------------------------------------------------------

    if (datarx == 'C')
    {

        lcd.setCursor(0, 1);

        lcd.print(" Robot Stopped ");

        digitalWrite(Motor_1a, LOW);
        digitalWrite(Motor_1b, LOW);

        digitalWrite(Motor_2a, LOW);
        digitalWrite(Motor_2b, LOW);

    }

}


/*
============================================================
                    NOTES FOR STUDENTS
============================================================

• Motors are controlled using HIGH/LOW logic.

• LCD provides real-time movement feedback.

• Serial commands can come from:
    - Bluetooth App
    - Serial Monitor

• This is a basic differential-drive robot.

------------------------------------------------------------
EXTENSIONS
------------------------------------------------------------

• Add obstacle sensors
• Add autonomous navigation
• Add ultrasonic sensors
• Integrate mobile app control
• Add line-following functionality
• Add Wi-Fi / IoT control

============================================================
                 HAPPY DESHBOT CODING 🚀
============================================================
*/

Learning Outcomes

Skills students can develop through this project.

1
Serial Communication
2
Motor Control
3
LCD Interfacing
4
Robotics Logic
5
Embedded Systems

Make This Deshbot Yours

Personalize your Deshbot by giving it your own name. Open Deshbot.h and change DESHBT_OWNER_NAME near the top of the file to your name or nickname.

On the first boot after uploading the updated sketch, the robot can generate and save its unique serial number along with the owner's name and build information in EEPROM.

This information remains stored across power cycles and future sketch uploads.

Open the Arduino Serial Monitor at 9600 baud to view the robot identity.

Try More With Deshbot

Take your robot to the next level with these projects.

Bluetooth Control

Control your Deshbot wirelessly using a smartphone and an HC-05 Bluetooth module.

Obstacle Avoidance

Add an ultrasonic sensor and program the robot to detect and avoid obstacles.

Autonomous Robot

Build autonomous movement logic and create intelligent robot behavior.

Mobile App

Create a custom Android application for controlling your Deshbot.

IoT Control

Upgrade your project with Wi-Fi and experiment with IoT-based robotics.

Advanced Robotics

Combine sensors, motors and programming to build advanced robotic projects.

Do you have a great idea?