Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Build a WiFi‑Controlled Robot with Raspberry Pi & Android Smart Phone

Ever wanted to steer a robot with your phone? With a Raspberry Pi, an L293D motor driver, and the RootSaid WiFi Command Center app, you can bring a mobile‑controlled robot to life. This guide walks you through every step—from selecting components to writing the listener script.

Components You’ll Need

Click the links to purchase each item from Amazon (or your preferred retailer).

Step‑by‑Step Build Guide

1. Assemble the Chassis

Design a sturdy base that can hold the Raspberry Pi, L293D, and battery. Light materials like foam board or a thin metal sheet keep weight low. If you prefer, purchase a pre‑made robot chassis online.

2. Set Up the Power System

The 12 V LiPo powers the motors and the L293D’s internal regulator. To protect the Raspberry Pi, step down the voltage to 5 V using a DC‑DC converter or a buck regulator before feeding it to the Pi’s 5 V input.

3. Mount the Motor Driver

Secure the L293D on the chassis and wire it to the two DC motors. Refer to the L293D datasheet for pinout details. Ensure the motor driver’s enable pins are set high (logic 1) for continuous operation.

4. Prepare the Raspberry Pi

Insert a microSD card loaded with Raspberry Pi OS (formerly Raspbian). Power up the Pi, set a password for the pi user with sudo passwd pi, and run sudo apt update -y && sudo apt upgrade -y to keep the system up to date.

5. Connect to WiFi

Link the Pi to your WiFi network. Open a terminal and note the Pi’s IP address with ifconfig or hostname -I. Verify connectivity by pinging the phone’s IP from the Pi.

6. Wire the GPIO Pins

Use six GPIO pins to control the motors:

7. Install the Listener Script

On the Pi, download the following Python script and save it as controller.py. This script listens on UDP port 5050 and translates incoming commands into motor actions.

import socket
import RPi.GPIO as GPIO

# GPIO setup
GPIO.setmode(GPIO.BOARD)
# Motor 1
GPIO.setup(33, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)
# Motor 2
GPIO.setup(13, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
# Enable pins
GPIO.setup(29, GPIO.OUT)
GPIO.setup(31, GPIO.OUT)
GPIO.output(29, GPIO.HIGH)
GPIO.output(31, GPIO.HIGH)

# UDP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('', 5050))

print('Listening for commands on port 5050...')

while True:
    data, addr = sock.recvfrom(1024)
    cmd = data.decode().strip().lower()
    if cmd == 'forward':
        GPIO.output(33, GPIO.HIGH); GPIO.output(11, GPIO.LOW)
        GPIO.output(13, GPIO.HIGH); GPIO.output(15, GPIO.LOW)
    elif cmd == 'backward':
        GPIO.output(33, GPIO.LOW); GPIO.output(11, GPIO.HIGH)
        GPIO.output(13, GPIO.LOW); GPIO.output(15, GPIO.HIGH)
    elif cmd == 'left':
        GPIO.output(33, GPIO.LOW); GPIO.output(11, GPIO.HIGH)
        GPIO.output(13, GPIO.HIGH); GPIO.output(15, GPIO.LOW)
    elif cmd == 'right':
        GPIO.output(33, GPIO.HIGH); GPIO.output(11, GPIO.LOW)
        GPIO.output(13, GPIO.LOW); GPIO.output(15, GPIO.HIGH)
    elif cmd == 'stop':
        GPIO.output(33, GPIO.LOW); GPIO.output(11, GPIO.LOW)
        GPIO.output(13, GPIO.LOW); GPIO.output(15, GPIO.LOW)
    else:
        print('Unknown command:', cmd)

Run the script with python controller.py. The Pi is now ready to receive UDP commands.

8. Install RootSaid on Your Phone

Download the RootSaid – WiFi Command Center app from the Google Play Store. Open the app, enter the Pi’s IP address and port 5050, and use the on‑screen arrow buttons to send movement commands.

9. Test Your Robot

With everything connected and powered, try each direction from the phone. The motors should respond immediately, confirming a successful link between your Android device and the Raspberry Pi.

Congratulations! You’ve built a fully functional WiFi‑controlled robot that can be steered right from your smartphone.

Manufacturing process

  1. Raspberry Pi–Controlled Aquaponics System: Build Guide & Code
  2. Build and Control a Pi‑Powered Robot with Live Video Streaming
  3. DIY Wall‑E Inspired Raspberry Pi CD‑Box Robot
  4. Build a Bluetooth‑Controlled Raspberry Pi Robot with Audio Feedback
  5. Build an Internet‑Controlled Video‑Streaming Robot with Arduino & Raspberry Pi
  6. Gesture‑Controlled Robot Powered by Raspberry Pi
  7. Build a Wi‑Fi‑Controlled Raspberry Pi Robot with Python – Step‑by‑Step Guide
  8. Build an Android‑Controlled Remote Vehicle with Raspberry Pi Motor Shield
  9. MobBob: Build Your Own Arduino Robot, Controlled Seamlessly via Android Smartphone
  10. Autonomous Sudoku Solving Robot