Installing RaPiRo Web Control
Back to RPi Guides.
RaPiRo Web Control for Raspberry Pi
What does it do?
The RaPiRo robot is useless without means to controll it, this guide helps you to understand how it works and how to controll it with a webbrowser of your choise even wireless from a cellphone connected to the LAN via wifi.
What do you need?
- A Rapiro robot
- A Raspberry Pi, model B.
- A boot SD card for the Raspberry Pi.
- A network connection (WiFi if this is going to be usefull).
- Special software on the Raspberry Pi that is free and gpl
What skill level is required?
This project does not require any coding or compilation even though some clue it good. Very basic Linux and networking knowledge would be useful, to set up the WiFi on the raspberry pi prior to this guide.
You need to...
- Install software
- Enter basic Linux commands
- Use standard software tools to edit the settings on the Raspberry Pi
- Connect computers using WiFi in a local LAN
How does it work?
This Guide helps you set up the internal Raspberry Pi in the RaPiRo robot to controll the robot via a Webserver hosted in it.
Overview of this project
You need to
- Install Apache2 server software with friends for Serial and Python communication on the Raspberry Pi
- Install the web server files that actually orders the RaPiRo what to do.
- Connect to the RaPiRo over a network from your computer / cellphone to the Raspberry Pi in the head of the RaPiRo.
1. In order to use the Raspberry Pi’s serial port, we need to disable getty (the program that displays login screen) by find this line in file /etc/inittab
- T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
- And comment it out by adding # in front of it
- #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
2. To prevents the Raspberry Pi from sending out data to the serial ports when it boots, go to file /boot/cmdline.txt and find the line and remove it
- console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
3. Reboot the Raspberry Pi using this command:
$ sudo reboot
4. Now, Install minicom
$ sudo apt-get install minicom
- test it by issuing the following command:
$ echo "#PR255G000B000T050#PR255G000B255T050" | sudo minicom -b 57600 -o -D /dev/ttyAMA0
- This should change colors of the eyes only.
5. Using Python programming language, you can make Raspberry Pi do many fascinating stuff with the RaPiRo when you are connected. Install Py-Serial first:
$ sudo apt-get install python-serial $ sudo chmod 666 /dev/ttyAMA0
- Now test it by saving this file as serialtest.py
import serial import time ser = serial.Serial('/dev/ttyAMA0', 57600, timeout=1) ser.open() ser.write("#PS06A060T001") time.sleep(2) ser.write("#PS05A000T030") time.sleep(2) ser.write("#PS05A120T001") time.sleep(2) ser.write("#PS06A050T001") time.sleep(2) ser.write("#H") ser.close()
- Then run it form terminal issuing this command:
$ python serialtest.py
- This should raise the left hand and strike it down again.
6. Install Apache2
$ sudo apt-get install apache2 libapache2-mod-python
- Download the files that is needed for the webserver to handle the RaPiRo and copy them to the apropriate directories.
- The python cgi script goes to /usr/lib/cgi-bin/:
- The CSS syle sheet goes to /var/www/:
- The files for the icons should be extracted to the /var/www/ folder
- Then access the homepage from the webbrowser of your choise using the ip-address of the internal Raspberry Pi WiFi adapter.
If you would like to make your RaPiRo robot totally mobile and not depending on your local LAN access point you can use the Raspberry Pi as a router and access the robot from your cellphone by connecting to that accesspoint, in that way you only need the RaPiRo and a wifi connected webbrowser to use it anywhere. Instructions how to do that you can read here
To learn about the RaPiRo protocoll and how it works in a more deep level, here are some useful links: