Monday, 8 April 2013

Bench Inspection Day

Bench inspection day photograph of our group, our poster and our creation - a wireless controlled robot using the Raspberry Pi.

Friday, 8 March 2013

Project Week 6 (Bench Inspection)

Today is the official end to the practical side of this project, as we presented our project to our project supervisor and a external assessor with the aid of our poster, log books and this very blog. In the morning before we were assessed we made final adjustments to the project (by now a robot controlled by the Raspberry Pi) and also attempted to get the second robot working after we successfully cloned another SD memory card. However, we had constant technical problems with the power and drive circuit which we cannot figured out throughout the day. Eventually we conducted both assessments with one robot only, but we were quiet disappointed that we didn't get both robots working and play football with them.

We were amazed with interests shown to our project by university academics and our fellow peers, we would like to thank them for their interest shown!

From Figure 1 as shown below, we have now completed all tasks and objectives set out for this project thus completed the practical side of this project as mentioned previously.

Figure 1: Gantt Chart after project week six

We will now move on to the paper work relating to this project, the thesis.

Wednesday, 6 March 2013

Circuitry

the circuit that is used to control the robot has been completed

Robotic Remote Control


After the completion of our raspberry pi's wireless control we then decided to attach it to a robot car that we can steer and control, find below a video of it in action.


Monday, 4 March 2013

DONE!!

Using ajax we were able to complete our goal, please view the video link below



Ajax - A new link to the chain

After we had managed to get the server to run our php code, we looked into how we are going to get the respected buttons to run there assigned php code this seemed like a straight forward procedure but after many attempts we were not able to produce the outcome that we wanted. the method we were using was to create a on-click event in our html page using jquery, this was supposed to trigger a function which contained its php code when the mouse clicked. This however is not possible since php is a server side function and cannot be ran directly from the client side html page. This meant that however we tried to manipulate the php code on the client side to preform the task it would simple just run the code in the html on the server side. 

A solution around this was to create several html page all linked to one another that would run the respected php code on the client side. This solution worked but came with the sacrifice of speed as the page would have to constantly reload and the browser would sometimes not responded to the link. this is he goal we wished to achieve but there must of been a much smpler more responsive way. This led us to the programming language called ajax a new link in our ever growing chain to find a solution.

The ajax language is another form of the java script, just like jquery but this is intended too send small requests to the server from a webpage without the need to reload/ refresh the page itself. This gave us the a solution to our problem we can use this functions to call the selected php code when requested, keeping the response time high and without the need of several pages. this is what we will be working on in these final days to have our project working the way we intend it too, preparing ourselves for the bench inspection this week.

Project Week 5 Timetable

In project week five, we hoped to apply the finishing touches to the project early on during the session by configuring out the control element of the web-page so that we can pick and choose which LED to switch on and or switch off. Then for rest of the day we will work on improving the project my adapting it to ultimately control a robot. However, the problem with achieving total desired control was actually bigger than we thought. It took us until end of the day before we fixed the problem, therefore we didn't have any time to make improvements on the project as hoped but then we did achieved the ultimate goal of this project by achieving "Wireless Control Using the Raspberry Pi"


As the above figure of our Gantt chart shows, the following week is bench inspection when our project will be assessed. We have now officially finished on the practical side on this project and moving onto the paper work, first by creating a poster for the upcoming bench inspection.

Tuesday, 26 February 2013

Project Week Four Timetable

Followed by our successful week in project week four, this is how our timetable stand as shown in Figure 1.

Figure 1: Project week four timetable as it stands

As shown in the timetable, we have completed all our key goals and tasks of this project and in project week five we will apply the finishing touches to the project where necessary before we begin improvements on our project. To ultimately control a robot, on project bench inspection week six.

Monday, 25 February 2013

Absolute Privileges

During project week four we have found out that whatever we do in terms of programming requires privileges. Throughout the project we thought that the "sudo" lead commands provides all the privileges that we need however, in the project week four we found out with further research that "sudo" does not provide the absolute command privileges. To gain absolute command privileges, we need to give everything the absolute privileges using the following command:

chmod 777 "File Name"

Project Week Four

After our project meeting prior to project week four, we knew that we need to push ahead with the project at all costs before we descend down the slippery slope and fall behind altogether.

Pushed ahead we did, during the morning session of project week four we work fast and furiously to cover the grounds we failed to cover in the past two project weeks. Our strong committed work ethic in the morning session paid off, we have successfully published our webpage which holds the control commands to be sent wirelessly to the Raspberry Pi which in turn will execute the Python command code scripts and switch a set of LED's on or off. Although the webpage was published and online, it took us close to the end of the day before we successfully attached the Python command code scripts to the webpage as we didn't realise that we need to gain absolute privileged on everything we do on the Raspberry Pi.

On 22/02/13 of project week four at approximately 16:00 we have attained the main goal and objective of the project as we achieved "Wireless Control Using the Raspberry Pi" as show in Figure 1.

Figure 1: Wirelessly switched on two LED's

For more information: Project goal achieved!

Although we claim that, we have we achieved wireless control using the Raspberry Pi however, we haven't exactly achieved the desired control element of this project such that we can pick and choose which LED(s) to switch on and switch off. In the upcoming final project week, project week five, we will continue to work on the absolute control aspect which we hope wouldn't take long before we move on to improve our project. To ultimately control a robot.

Project Goal Reached!

On project week four (22/02/13) the main goal and objective of this project have been achieved by wirelessly control a set of LED's using the Raspberry Pi as shown in Video 1:

Video 1: Wireless Control Using the Raspberry Pi

Although we have successfully switch on and switch off a set of LED's wirelessly using the Raspberry Pi, we haven't achieved the desired control element of this project such that we can pick and choose which LED(s) to switch on and switch off.

In the upcoming final project week, project week five, we will continue to work on the absolute control aspect which we hope that it wouldn't consume much time.

Thursday, 21 February 2013

Project Week 3 Timetable

As reported earlier, project week three was met with setbacks as the SD memory card has again corrupted which took a good three hours to get back to where we were at the end of project week two. We then once again attempted to install Apache2 after the disappointment in project week 2. Again this time the installation went nowhere as the Apache2 was installed but the server failed to work and as we entered into the sub-systems of the Apache2 to debug the problem, we just got lost in the huge maze of sub-systems. Thus after project week three, we are now slipping behind schedule after these summations of little setbacks. In the upcoming project week four, we are determined to make up the lost ground!


Making the web-page live?


So far we have managed to achieve running the python code from the putty software which controls the respected GPIO's and we are at a point where we are looking to have a PHP page run this code for via a button activation on the default servers web-page but what if we want (and hopefully so) to do this from any location for example active our raspberry pi GPIO from another building or even different part of the world. We then need to take into consideration, how we can make the raspberry pi have a web-site control its GPIO since we already have a copy of our GUI on the internet already.

This is the next area we will look into; publishing our webpage and having it control our device!

 

SSh and putty


SSH is secure shell this is a protocol built into the raspberry pi, this gives the user the ability to access the lx terminal via a different computer on the same network. This is secure communication between two devices over an insecure network.

 

Simple software for this is Putty; this recreates a terminal screen on your P.C via this SSH allowing for wireless (in our case) control of the raspberry pi. This allows for us to remove the keyboard, mouse, USB hubs etc. from the Pi allowing for much lower power consumption. This gave us the idea not only to control the Pi wirelessly but also make the raspberry Pi portable.

 

This turned out to be a success and via the putty terminal we can manually control the GPIO terminals and also power the raspberry pi via a portable battery cell.

 

Below is a video of this being achieved.

http://www.youtube.com/watch?v=x8eDQzVorKM

The use of FTP

FTP or File Transfer Prototcol is a web-server application that allows for files to be transfered or access via the host server or as we wish to use it as a way of transfering files that we construct on a PC directly to the Pi with having to load the raspberry Pi user interface. This seem to be saving alot of time as we wish to work in the Bash control (Lx terminal) without having to deleve into each directory just to access certain files to edit. The FTP software that was installled was VSFTPD this is a file transfer application that works along with apache and is built specifiaclly for unix/linux systems. One installed and specific file privelage changed all we needed to do was download FileZilla( recommended on internet forums) and use this software from our PC to simple transfer files.

This is not a necessity but felt we could install it to speed up our production.

PHP over HTML

Now that we have a running server and updated the default web page index.HTML on the server to that of our GUI design we now need a way of getting our HTML to talk to our server and activate a python script that in turn controls a GPIO port on the Raspberry Pi. This is where PHP comes into the design, as much as HTML is designed to allow the programmer to make websites that can hyperlink here hyperlink there upload photos that will be displayed etc. it fails on the part where information can be submitted and received from a server. PHP is designed to be a much more dynamic webpage allowing for coding and the submission of information repeatedly whereas HTML is a lot more static. Therefore we are going to be converting our HTML page to PHP. To install this on the Pi we simply entered the code sudo apt-get install php5 which then directed the Pi download and extract the package, giving the Pi the ability to handle PHP files.

We are still in the development stage of the PHP site but shouldn’t be too long away now from a working web-page, as far as the GUI goes for the moment it will be kept the same.
 

apache2 solution,Server is now running!


After having numerous problems with apache we looked for an alternative, which after some research two common results appeared. We could either use the Cherokee web server application or a lighter version of apache customised for devices that run using an ARM processor, this we assumed to be the solution to the problem the apache was too demanding for the Raspberry pi(RPi) to handle. After installation the RPi was running without any problems, restarting the apache server didn’t hinder the RPi performance and we were able to access the default HTML page via another networked device. This now gave the RPi the functionality of being a web server.

 

CODE: The directory of the apache web-server:


sudo apt-get install apache2 php5 libapache2-mod-php5

Tuesday, 19 February 2013

Project Meeting 19/02/13

Me and my project partner had a project meeting on 19/02/13 to discuss the progress of this project so far and agreed that we are going around in circles with the Apache2 install which now lead us us to slip behind on schedule as well as further weekly setbacks with the corruption of the SD memory cards. We discussed what we have to do to get ourselves back on track including completing side task early and the fact that we need to push ahead at all cost in the final two project weeks. If Apache2 continues to fail to work, we will use the alternative which is called the Cherokee which is also a lighter systems compared to Apache2 to run on the Raspberry Pi as well as doing the same job as Apache2.

SD Memory Card Corruption

As I nosed around my fellow colleagues projects and exchanged kind words, some of my colleagues suggested some possible reasons to why our SD memory card may corrupt including not shutting down the Raspberry Pi in a controlled manner, removal of the SD memory card at the end of the day for safe storage or even problems with the Raspberry Pi itself. Followed by these kind suggestions, we switched to using our own Raspberry Pi's which me and my project partner personally own, we then research Python safe shutdown commands which we will now use for normal shutdown or reboot. We will now also not remove the SD memory card from the Raspberry Pi at the end of the day, until the end of this project.

Safe shutdown command:
sudo shutdown -h now

Safe reboot command:
sudo shutdown -r now

Python Command Code Scripts


Below are the Python command code scripts, the theory is that when a command is pressed on a handheld mobile device a certain sequence of script(s) will run thus executing the command given a distance away over a wireless network.

GPIO_SETUP:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)

GPIO_3_HIGH:
import RPi.GPIO as GPIO
GPIO.output(11, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(3, GPIO.HIGH)

GPIO_5_HIGH:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(11, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(5, GPIO.HIGH)

GPIO_7_HIGH:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(11, GPIO.LOW)
GPIO.output(7, GPIO.HIGH)

GPIO_11_HIGH:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(11, GPIO.HIGH)

GPIO_RESET:
import RPi.GPIO as GPIO
GPIO.output(3, GPIO.LOW)
GPIO.output(5, GPIO.LOW)
GPIO.output(7, GPIO.LOW)
GPIO.output(11, GPIO.LOW)

Project Week 3

Project week three started in disaster as the SD memory card of the Raspberry Pi has once again corrupted on start-up right at the start of the day. It was not until approximately three hours later, that we were back to where we finished on project week two. For the rest of the day we tried to install and configure Apache2 on the Raspberry Pi which allows us to create a web-server for the Raspberry Pi. We started off great during the installation as every command worked however, we began to go round in circles once Apache2 was installed and was configuring it. Soon we just got lost in the maze of sub-system commands. We tried restarting the system and begin the procedure again but again no hope as anger and frustration builds. On the other hand, the Python command code scripts were written and typed up.

Tuesday, 12 February 2013

Project Week 2 Timetable

After project week two this is where we stand in terms of our timetable:


As shown in the timetable after project week two, we are still on track and well on our way to complete our project on time. In the upcoming project week three we will try and install Apache2 which allows us to create a web-server on the Raspberry Pi. We also aim to type up some Python command scripts that when connect and a command is given from a website on a handheld mobile device, that script will be called up and run. If we are ahead of schedule in project week three, we will try and connect the whole system together and begin initial system test.

GPIO Install / Configuration Code

Below was the code used to download, install and configured the GPIO ports which allows us to program the GPIO ports using the official Raspberry Pi programming language - Python.

First open the "LX Terminal" which can be found at the desktop and then enter the following code:

sudo apt-get update
# downloads the latest updates #
sudo apt-get install git
# install specific update, the software: git #

git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
# collect a collection of codes from this website directory using the software just installed: git #
cd Adafruit-Raspberry-Pi-Python-Code
# enter into that directory #
ls
# confirm #

When prompted to confirm, enter "Y"

Exit LX Terminal before opening it again and enter:

sudo apt-get update
# downloads the latest updates #
sudo apt-get install python-dev
# install specific update, Python Development Toolkit #
sudo apt-get install python-rpi.gpio
#  install specific update, which allows us to program the GPIO ports in Python #

When prompted to confirm, enter "Y"

The GPIO were setup and configured, ready to be commanded by programming each port using Python.

Project Week 2

Project week two started fantastically, with the wireless internet set up in no time as shown figure 1 below.

Figure 1: Successful configuration of wireless internet

Then within an hour of programming the general purpose input/output pins (GPIO) using the official Raspberry Pi programming language - Python. After installation and configuration of the GPIO pins, they were tested as we picked two random pin (11 and 8) and typed in a simple Python command script to switch on a LED on and off as shown in figure 2 and figure 3 below.

Figure 2: A simple command script to turn on and off a LED at pin 11

Figure 3: GPIO pins test after configuration successfully switching a LED on and off

We then moved on to install Apache2 which allows us to create a web-server for the Raspberry Pi to receive information or commands from a certain website. However, during the installation process, the SD memory card which acts like a computer hard drive was corrupted. We tried to reboot the memory card but failed. We spent nearly two hours to download a new Raspian Wheezy operating system as well as installing it onto the formatted SD memory card. We then had to re-install everything we done in the past two weeks, and by the end of project week two we where back in business as GPIO pins were again configured. For the upcoming project week three, we will try to install Apache2, type up Python code scripts for the server to run upon command from a website and maybe even start testing the communication link between the web-site on our handheld mobile devices and the Raspberry Pi's web-server.

Thursday, 7 February 2013

Project Timetable

Prior to the start of project week one, we have created a simple Gantt chart to help keep ourselves on track as well as to illustrate our current progress. As shown in the screenshot of our timetable below after week one of the project week, we are pretty much on target as predicted.


Project Week 1

In the first week of the project, we have received and inspected all the parts and components ordered before the Christmas holidays. Everything were working with no defects or missed items, everything were in place to start. Embodiment of parts where necessary such as soldering the Raspberry Pi cobbler breakout kit were completed in no time.


Then the Raspberry Pi was connected to the necessary peripherals.



The Raspberry Pi was ready for its initial start-up.


Upon initial start-up, basic setup procedure was completed along with installation of new updates as well as the installation of the necessary software packages and hardware also such as the wireless dongle.

As the day draws to an end on project week one, me and my project partner discussed our plans for the following project week two where we will be doing some hardcore programming.

Thursday, 31 January 2013

Set up of the Web GUI


http://raspberrypi.site90.net/html.html this is a link to the site we have set up in order to control the raspberry pi over a wireless network

Tuesday, 29 January 2013

Tutorial on wireless raspberry pi control

After looking for sources on the internet i have found two tutorials that essential cover how we want our project to run http://trouch.com/2012/08/21/webiopi-control-your-pis-gpio-with-a-browser/  and https://github.com/nneves/Raspberrypi_GPIO, accessing our raspberry pi GPIO via a web browsers interface controlling an external circuit