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 $ sudo usermod -aG dialout www-data
- 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/:
$ wget https://dl.dropboxusercontent.com/u/54426040/test.py $ sudo chmod 755 /usr/lib/cgi-bin/test.py
- You should rename that file to rapiro.py but then you also have to change the reference in the code (line 103) to rapiro.py instead of test.py as well.
- The CSS syle sheet goes to /var/www/:
$ wget https://dl.dropboxusercontent.com/u/54426040/control.css
- The files for the icons should be extracted to the /var/www/ folder
$ wget https://dl.dropboxusercontent.com/u/54426040/Remote.Control.Icons.zip
- Then access the homepage from the webbrowser of your choise using the ip-address of the internal Raspberry Pi WiFi adapter.
- depending on if you renamed the file or not.
- depending on your apache setup you may need to use:
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:
http://forum.rapiro.com/thread/21/ https://docs.google.com/document/d/1frXtqllFRFBZKgjfUq7quw6Wh2Nw5CJ8y_F5vEpnkjA/edit?usp=sharing https://github.com/evilbluechickens/rapiro-orig http://www.rapiro.com/
As a beta for CAM Stream I want to make a fast note: First install the Raspberry Pi Camera Web Server: http://www.raspberrypi.org/forum/viewtopic.php?f=43&t=63276
Then use the files in this archive to change some of the behaviour in the previously installed RaPiRo controll. https://www.dropbox.com/s/jt6sn1o3rytau7t/RaPiRo.zip
If you don't want it to shine read from the camera led in the head of the rapiro edit the /boot/config.txt and add: