Mobile controlled Pi Robot

Featured image

The goal of this tutorial is to help you begin programming with Python to control your Raspberry PI Robot using mobile Application (Android)

Components Required:

1. Rasbperry Pi(with Wifi Dongle)

http://elementzonline.com/raspberry-pi-2-model-b-wireless-starter-kit-rpi-2-case-adapter-noobs-card-hdmi-lan-wifi–198?search=pi

2. DIY Kit(robotic Base,Two DC Motors, etc)

http://elementzonline.com/diy-kit-acrylic-robot-chassis-body-with-platform-123?search=DIY%20kit

3. Motor Driver Board

http://elementzonline.com/dc-motor-stepper-motor-driver-board-with-l293d-ic-84?search=motor%20driver

Android Application for Pi Robot

    1. You can download the Android Application(apk file) from github

https://github.com/elementzonline/RaspberryPi-Sample-Codes/tree/master/Pi_Robot_V1.0/Android_apk_file

    2. You have to install it in your android phone

    3. Make mobile as Hotspot for controlling robot.

    (or you have to connect mobile and raspberry pi into same Wifi network)

Raspberry Pi configuration

1. You must install the Raspian OS in the SD card.

https://www.raspberrypi.org/documentation/installation/installing-images/

2. You can connect the internet using GUI or Terminal commands for Downloading python library file

Terminal commands:

1. Network Connection:

Check the available wifi

sudo iwlist wlan0 scan
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
               network={
                       ssid="The_ESSID_from_earlier"
                       psk="Your_wifi_password"
                       }

Now save the file by pressing ctrl+x then y, then finally press enter.

Reboot the Rpi

2. Python library File (GPIO library file Loading)

sudo apt-get install python-dev

If asked for confirmation on either of these, press Y

sudo apt-get install python-rpi.gpio

Python program for Pi Robot

    1. you can download python program from github

https://github.com/elementzonline/RaspberryPi-Sample-Codes/tree/master/Pi_Robot_V1.0/Python_code

2. Save the code raspberry_robot.py file in any Directory

3. Connect the mobile to the same Wifi network or Change the raspberry Pi network connection to mobile hotspot.

4. Check ip Address of RaspberryPi using the Terminal command

ifconfig

It will give list as follow

a1

    3. Run python program using Terminal commands

        – locate file Directory

cd (file Directory)

– View the python file

sudo nano raspberry_robot.py

– Change IP address in a code with your Rasbperry Pi IP Address

a2

(eg: 192.168.43.208 to rasbperry Pi IP)

-Save the file (Ctrl+x and ‘y’ for yes)

-Run the python programm using command

sudo python raspberry_robot.py

Android Application Configuration

1. Open your Android Application

2. Enter the IP address (Raspberry Pi IP Address) and port (9000) given in the Code. Then press the connect Button

3. Now, you can control the Pi robot using the five Button given in the Android Application

a3

Advertisements

10 thoughts on “Mobile controlled Pi Robot

    • hi there, already tried and construct the robo. Got few questions.
      Mine able to connect with rpi, everything in order. the thing is….robo dont move. Rpi indicated receive of signal but from rpi to output(the motors) thru gpio, cant get anything.
      Any suggestion?

    • Line number 18 is “state = True” and will not have any error. The error may be due to incorrect IP address. you need to give the correct IP address of your phone in the “HOST”. Check the IP address of your phone in settings or any 3rd party application

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s