Home » Blog » TonyBot

TonyBot

TonyBot

This project presents TonyBot, a two-wheeled mobile robot based on Arduino, controllable via Bluetooth through an Android app. The robot is designed to move in multiple directions thanks to two DC motors and offers a simple and intuitive interface for remote control.

TonyBot features multiple modes, including manual driving, line following, and a dance mode, where the robot performs random pre-programmed movements to music. Additionally, it includes a fun interactive game mode, allowing users to actively play with the robot through the app interface.

Components

Microcontroller:

  • Arduino Nano
  • Arduino Nano Expansion Shield

Motor Control:

  • TB8833 DC Motor Driver

Communication:

  • JDY-31 Bluetooth Module

Power Supply:

  • 9V battery
  • 4x AA battery
  • Power switch

Sensors:

  • TCRT5000 Optical Sensor
  • HC-SR04 Ultrasonic Distance Sensor

Output Devices:

  • MAX7219 8×8 LED Dot Matrix Module
  • KY-006 Buzzer

Actuators:

  • 2x SG90 Micro Servo Motors
  • 2x DC Gear Motors

Structure and Assembly:

  • 3D Printed Structure
  • Plastic parts for arms
  • Car chassis
  • Caster Wheel
  • 4x AA battery holder
  • Mini Breadboard
  • 2x Wheels
  • Screws and glue gun (for securing components)
  • Jumper wires and cables

Design 3D

We started the robot design on the basis of a pre-bought chassis containing a chassis plate, DC motors with gearboxes and wheels, a caster wheel, battery box, a switch and some mounting material.

Robot construction and connections

Functions

Tonybot is based on Arduino code. It defines TonyBot’s physical behavior in response to commands received via Bluetooth. It controls motors, servos, sensors, LEDs, and a buzzer for various operating modes, including movement, line following, dancing, and playing a game.

Upon startup, it greets the user by reproducing a melody similar to “HELLO” and displays “HI” on the matrix. 

Bluetooth communication is handled using the SoftwareSerial library. Tonybot continuously listens for specific characters sent from the mobile app, and each character triggers a specific behavior such as movement, switching modes, or starting music playback.

Motor and servo control is achieved through four digital output pins used to manage two DC motors, with PWM applied to control their speed. Additionally, two servo motors (one for each arm) are initialized and allow Tonybot to move its arms when instructed. The standard arm movement is to open and close it.
Movement commands such as forward, backward, left, right, and diagonals are implemented by combining motor directions and speeds accordingly.

In Line Following Mode, Tonybot reads analog input from a line sensor to detect surface color. Before use, the user calibrates the white and black thresholds through the app. During operation, Tonybot adjusts the speed of its motors based on the color detected, following a formula simulated in a course laboratory, where motor speeds are modulated depending on whether the sensor detects black or white, or in between. This allows Tonybot to autonomously follow a black line on a white surface with real-time corrections.

Dance Mode enables Tonybot to perform coordinated dances in sync with one of three predefined melodies: “Memories” by Maroon 5, “Happy Birthday,” and a piece by Beethoven. When a song is selected, Tonybot executes a random movement routine involving arm servos and LED matrix animations. Music is played using timer interrupts, which ensure non-blocking playback on the buzzer so that other components can operate simultaneously.

In Game Mode, Tonybot transforms into an interactive game bot that displays various shapes—square, triangle, diamond, and heart—on the LED matrix. The user must correctly respond to each shape. If the user misses one, Tonybot stops the game and displays a sad face on the matrix. If the user correctly identifies four shapes in a row, Tonybot celebrates by playing a joyful sound and showing a smiling face on the LED display.

Ultrasonic obstacle detection is implemented using a sensor that measures distance in front of the robot. This feature helps prevent collisions and can automatically stop the robot if an object is detected too close, whether in manual control or line following mode.

App

The mobile app was developed using MIT App Inventor and is structured as follows:

  • Home Page
    The home screen allows the user to connect their smartphone to Tonybot via Bluetooth. Pressing the “BT” button initiates a search for available Bluetooth devices. Once connected, the Bluetooth icon will no longer display the “X”, indicating a successful connection. At this point, the list of functional modes will become visible. A “Home” button to return to the main screen at any time after the selection.
  • Remote Control Mode
    When Remote Control Mode is selected, a control interface appears featuring 11 buttons:

    • 8 directional buttons (up, down, left, right, and diagonals)
    • 1 central “Stop” button
    • 2 arm control buttons (for moving the robot’s arms)

To move Tonybot, the directional buttons must be held down, while the arm buttons work with a single press.
Additionally, there is a toggle switch labeled “Buttons”, which is enabled by default. When this switch is turned off, the robot can be controlled using the phone’s accelerometer. In this mode, the user can steer Tonybot by simply tilting the smartphone in different directions.

 

  • Line Following Mode
    When Line Following Mode is activated, the first required step (if not already completed) is to calibrate the white and black threshold levels using two dedicated buttons—one for each color. Once calibration is complete, Start and Stop buttons will appear. After placing Tonybot over a black line, pressing Start will make it follow the line automatically.

  • Dance mode:
    When Dance Mode is activated, three buttons appear on the screen, each corresponding to a different song. The songs, in order, are “Memories” by Maroon 5, “Happy Birthday”, and a piece by Beethoven. When a button is pressed, Tonybot performs a dance with the selected track.

  • Game mode:
    When Game Mode is activated, the game starts immediately. Four shape buttons are displayed: a square, a triangle, a diamond, and a heart. The user interacts with these shapes as part of the game. Pressing the “Restart” button resets the game and starts it again from the beginning.

Demos

  • Remote control
  • Line Following
  • Dance
  • Game

Conclusion 

This project gave us the opportunity to design and build a functional robot using Arduino, combining both hardware assembly and software development. It was a valuable learning experience that helped us better understand how different components, motors, sensors, servos, and communication module, can work together to bring a robot to life. 

TonyBot responds to a variety of commands through a mobile app, performing actions like movement, dancing, line following, and playing games. Looking ahead, there’s plenty of room for improvement and new ideas. Adding extra sensors and modes could make TonyBot even more capable and interactive.

 

Matteo Tonello – Lennart Janzen