School of Science and Technology, United States International University (USIU)

From Raspberry Pi Min-Grant project
Revision as of 21:18, 27 July 2015 by Snamuye (talk | contribs)
Jump to: navigation, search

The Project Title - Leveraging Laboratory Experiments with Raspberry-Pi `Lab Mfukoni`

Abstract

A lot has been said about teaching with experiments set up with virtual Labs environment. While this is an effective way of demonstrating concepts, it is not very different from teaching a four-stroke combustion engine with only diagrams, or using emulators and simulators. It is very different from working with the real engine. The Raspberry-Pi is a single board computer almost the size of a credit card, having the capability of desktop or laptop computer functions. What is good about it is the portability, ability to make and break the experiments, which cannot be easily done with the desktop or laptop computers. As such it is suitable for computer applications kit, ranging from sensor environment, microcontroller environment, and programming environments. The United States International University-Africa (USIU-A) is proposing to adopt the Raspberry-Pi experimental environment with the objective of giving both the students and the lecturers the desktop power at a very low price. USIU-A intends to collaborate with University of Nairobi’s Institute of Computing and Informatics. It is expected that through well-designed experiments, 60 students will acquire hands-on experience for both in-lab and post-lab experiments on this first case. In the latter case, the students may continue with open-lab experiments or homework since they will be able to carry the kits to their homes on the concept of ‘Lab-Mfukoni’. USIU-A intends to use the Raspberry kits for both undergraduate and post graduate courses with target outcome of developing problem solving application and teaching modules for scalability.


About USIU

USIU-A is a private, independent, non-profit university located on 120 acres of land in the Kasarani District of County of Nairobi. The University’s mission includes a strong commitment to providing students an education with a global understanding and multicultural perspective through its formal curricula and the experiences of studying, working, and living cooperatively in a racially, ethnically and culturally diverse environment. The proposed Raspberry-Pi project will be aligned with the University’s current strategic plan. An aspect of one of the strategic goals in the current Strategic Plan is concerned with program and course curriculum development where USIU plans to broaden and deepen its programs. The proposed project will be made consistent with the institution’s mission i.e.to promote the discovery and application of knowledge, acquisition of skills, and development of intellect and character in a manner that prepares students to contribute effectively and ethically as citizens of a changing and increasingly technological world through the Mission outcomes of Higher Order Thinking, Literacy, Global Understanding and Multicultural Perspective, Preparedness for Career, Community Service, Leadership and ethics. Furthermore, the mission is carried out in an environment which encourages intellectual and scholarly development; fosters openness to a wide range of ideas, cultures, and people; and enhances personal growth.

Launching the Raspberry Pi at USIU

Background

Technology can help fuel Africa's development, facilitate peace and secure the continent's future. With the rapid change in technology, innovation and the increase in number of users, we can solve our problems using technology. The problem is lack of equipped state of the art students’ computer laboratories where students can develop applications. Our universities have competent faculties who deliver in classroom but students’ great ideas are limited due to lack of modern equipment in practical laboratories. Where the equipment are available, they are either in small quantities or so basic that limits the applicability of creativity. It is against this background that USIU-A through SST developed a proposal to adopt the Raspberry-Pi experimental environment with the objective of giving both the students and the lecturers the desktop power at a very low price. The project is undertaken by USIU-A in collaboration with University of Nairobi’s Institute of Computing and Informatics. The Raspberry PI computers creates a platform ‘Lab Mfukoni’ where students can run their own laboratories and use their creativity to solve problems. The Raspberry-Pi is a single board computer almost the size of a credit card, having the capability of desktop or laptop computer functions. What is good about it is the portability, ability to make and break the experiments, which cannot be easily done with the desktop or laptop computers? As such, it is suitable for computer applications kit, ranging from sensor environment, microcontroller environment, and programming environments.

It is expected that through well-designed experiments, 60 students will acquire hands-on experience for both in-lab and post-lab experiments on this first case. In the latter case, the students may continue with open-lab experiments or homework since they will be able to carry the kits to their homes on the concept of ‘Lab-Mfukoni’. USIU-A intends to use the Raspberry kits for both undergraduate and post graduate courses with target outcome of developing problem solving application and teaching modules for scalability.

Objectives

The objectives of adopting Raspberry-Pi system for computer experiments are: To enable students to develop microcontroller applications in a more flexible and cost effect manner; To enable lecturers to be innovative in the design of experiments that interactively engage students; To train students on real-life development kits instead of emulators and simulators hitherto used at USIU. To create synergies between faculty and students based on experiential learning on mobile platforms

Course content

The material for this course will be designed in such a way that the Raspberry-Pi is used for teaching courses in Information Systems Technology (IST): Computer organisation and Programming; Applied Computer Technology courses (APT): Digital Electronics; MSc. IST: IT Infrastructure. The course components will be as follows: The Raspberry-Pi will enable installation of tools such as Very High Definition Language (VHDL) to demonstrate concepts of Hardware programming etc. The practical exercises are expected to cover at least 10 experiments in a semester of 14 weeks. These experiments will emphasize the following broad areas:

  • Interface designs
  • Developing simple applications
  • Sensor designs for sensing environmental parameters
  • Testing live applications such as tracking objects
  • Design of intelligent systems

Expected Results

The experimental environment with Raspberry-Pi should:

  • Equip students with knowledge and skills to explore the insides of a computer;
  • Students who have a strong desire for control devices to write control programs;
  • Fire students’ imagination and drive to innovate;
  • Patent and Pilot innovative projects that meet the computing standards;
  • Publish and present

Status of the project

The project has already been funded by Kenya Education Network (KENET) to the tune of around 1 m Kenya shillings. The kits have already been procured ready for rolling out of the programme. The labs are in the process of being prepared and the actual teaching using the kits will be in May 2015 at the beginning of the semester. On 18th March 2015 the programme was launched and attendants included the dean SST, and the faculty members in the school. During the launch students expressed enthusiasm and demonstrated the curiosity for learning by use of the kits. (See the photos taken during the launch of the kits

Personnel

Professor Sylvester Namuye - Lead

Dr. Paul Okanda

Dr. Gerald Chege

Max Musau

Paul Bombo

Courses

In the initial stages, the kits will be experimented within the following courses:

Computer Organization and Programming

Offered in the Information Systems Technology Programme (IST), this course outlines the fundamental way in which a computer works: starting with simple logic and progressing to a simple model of a microprocessor.

Digital Electronics

Offered in the Applied Computer Technology (APT) program, this course describes the basic integrated circuit building blocks from which digital circuits and systems are assembled. This unit is intended to help the students keep pace with the rapid advances made in the field of Digital Electronics. The course will be the first to experiment on using the RPi

Applied Computer Technology Project

This project course utilizes teams and/or individuals working from problem requirements and specifications to produce a solution. This requires exploration of suitable information technologies to produce a solution that improves the problem situation. Students/teams analyze, plan, and report on the project and implement a prototype.

IT Infrastructure (MSc.IT)

This course studies the evolution of computer architecture and the factors influencing the design of hardware and software elements of computer systems. Topics include: instruction set design; processor micro-architecture and pipelining; cache and virtual memory organizations; protection and sharing; I/O and interrupts; in-order and out-of-order super-scalar architectures; VLIW machines; vector supercomputers; multi-threaded architectures; symmetric multiprocessors; memory models and synchronization; embedded systems; and parallel computers.

Methodology and Work Plan

After receiving the funding and purchasing the Raspberry PI, a mixed mode of delivery will be used as follow:

  1. Discovery method; students will be free to play around with the kit in their areas of interest;
  2. The formal lecturing method in which the lecturer will present the concepts of the subject content.
  3. Laboratory work: As the Raspberry-Pi is geared to laboratory work, the students are expected to be prepared and prepare for the lab sessions. This will be done at a five-tier mode:
  1. Pre-Lab preparations: set up and monitored by Lecturers with the help of the Laboratory Technicians and Laboratory Technologist.
  2. In-Lab  sessions: supervised by Lecturer or Lab Technicians/Technologists/Research Associate
  3. Post-lab sessions: open lab sessions or  students own time at home
  4. Lab report writing: lecturers will provide guidance to the students with a view to ensuring reports capture the exercises and their application to solve real-world issues.
  5. Lab report evaluation: student projects will be judged on their potential impact in finding solutions to real-world problems and its applicability.
  6. Industrial visits: the industrial visits will be undertaken at the beginning, and middle of the project as an exposure to students where such applications have been developed and used.

Towards the end of the semester, apart from the structured experiments that the students will carry out in the lab, the students will be expected to come up with innovative and real-life projects that they will demonstrate to their peers in a presentation session for value addition

Digital Electronics

Study of Logic Gates – AND, OR, NOT, NAND, NOR, XOR

LABORATORY 1

EXPLORING RASPBERRY PI
 Pre-Lab Exercise 1:  Installing OS on Raspberry PI

The RPI will not boot up without an SD Card that is properly formatted to contain a suitable boot loader and operating system.

The distribution we have chosen to run in this lab and subsequent labs is called Raspbian.

We will use NOOBS operating system installer to install Raspbian

  1. Using a computer with an SD card reader, visit the raspberry pi official downloads page.

RTENOTITLE

https://www.raspberrypi.org/downloads/

  1. Click on the download ZIP button under ‘NOOBS (offline and network install)’, and select a folder to save it to.
  2. Extract the files from the zip.
  3. Click on the download ZIP button under ‘NOOBS (offline and network install)’, and select a folder to save it to.
  4. Extract the files from the zip.
Preparing SD card on Linux/Windows Platforms
  1. Preparing SD card on Linux/Windows Platforms

On windows format your SD card before copying the NOOBS files onto it.

  1. You will need a 4GB or larger card. You will need a 4GB or larger card. NOOBS holds the various distros and support files for the “recovery” process. Basically, the installer lives on the card
  2. Go to the SD Association’s website and download SD Formatter 4.0 for Windows
    (https://www.sdcard.org/downloads/formatter_4/)
  3. Follow the instructions to install the software.
  4. Insert your SD card into the computer or SD card reader and make a note of the drive letter allocated to it.
  5. In SD Formatter software, select the drive letter for your SD card and format it.

Copy and Paste the NOOBS files

  1. Once your SD card has been formatted, copy all the files in the extracted NOOBS folder and paste them onto the SD card drive.
  2. When this process has finished, safely remove the SD card and insert it into your Raspberry Pi.

 

  1.  Format the SD card on the Linux Platform

On linux the following assumes you have root/administrator privileges

  1. First we need to download the ISO from the downloads page
    (https://www.raspberrypi.org/downloads/)
    Select an OS either Raspbian, UBUNTU mate or Snappy UBUNTU core
  2. Find the device, assuming your system is different to mine. The easiest way is to run the following:

#fdisk -l

(This command lists all the mounted and unmounted devices on your computer.)

  1. Once you have identified your device and the partition enter the following command that will format the SDcard

#dd if=/downloads/raspbian.img of/=sdb bs=512 conv=noerror,sync

  1. When this process has finished, safely remove the SD card and insert it into your Raspberry Pi and boot it.
Installing OS

Noobs installer First boot

  1. Plug in your keyboard, mouse and monitor cables.
  2. Now plug in the USB power cable to your Pi.
  3. Your Raspberry Pi will boot, and a window will appear with a list of different operating systems that you can install. We recommend that you use Raspbian – tick the box next to Raspbian and click on Install.

RTENOTITLE

  1. Raspbian will then run through its installation process. Note this can take a while.
  2. When the install process has completed, the Raspberry Pi configuration menu (raspi-config) will load. Here you are able to set the time and date for your region and enable a Raspberry Pi camera board, or even create users. You can exit this menu by using Tab on your keyboard to move to Finish.

Logging in with Default username and password

The OS will boot to command line where you will need to enter the default username and password

  • The default login for Raspbian OS
    Username: pi with the
    Password: raspberry

Loading the graphical user interface

To load the graphical user interface type
#startx

 

Pre-Lab Exercise 2:Connecting Pi to the Internet
  1. WiFi Configuration
  2. Using the command line
    1. LAN Configuration
      1. DHCP Configuration
      2. Static configuration
Pre-Lab Exercise 3:  Installing Applications on PI
  1. – Updating System
    1. Installing the Python Package Manager(PIP)
    2. Installing GPIO Library
  2. In-Lab Exercises
    1. In-Lab Exercise 1: Realizing a AND gate
      1. Wire up the circuit
      2.   Edit the Program
    2. In-Lab Exercise 2: Realizing a OR gate
    3. In-Lab Exercise 3: Realizing a NOT gate

Projects

Pi Cluster (Course: APT4030: Parallel Computing)


  1. In this project, we will build a cluster of identical raspberry pi nodes, networked togetherand running parallel processing software that allows each node in the cluster to sharedata and computation.
    -interchange-newline"> Objective(s):Building a cluster computer powered by raspberry Pi that could be used to develop andrun parallel and distributed programs. In doing so, the following goals could be achieved.
    Practical understanding of building parallel systems.
    Experiment with diffrent confiurations to achieve better performance.
    Familiarity with MPI (Message Passing Interface) API for parallel programming.
    Familiarity with raspberry pi micro computers useful for rapid hardwareprototyping.Building the system:Components:Computer hardware –Raspberry Pi Model B, 33 nodesStorage – SD cards, 8 G x 33Ethernet cablesPower supplyRack ?Cooling ?Linux OSThere is an array of diffrent possibilities.MPI libraryMPICH or OpenMPI? Or others?Ethernet switch and RouterA switch that we can use without interruption during the lab works.Implementation:Ideally the project will be implemented in stages, starting with confiuring the fist twonodes and then scaling to add all other additional nodes.Resources:There are many resources that we will use includingRaspberry Pi Foundation https://www.raspberrypi.org/Prof Simon Cox, Making a Raspberry pi super computer, University of Southampton
    http://coen.boisestate.edu/ece/raspberry-pi/Confiuring the nodes, step by step guideFirst, confiure the fist nodeWhen this is done, its easier to clone as many nodes as wanted.1. Get the OS imageraspberrypi.org/downloadAftre many false starts, I was content to just use Rasbian Weezy 5.52. Get image into a the sdcardOn window: ?On Linux:dd if=/media/yourMachine/Images/2015-05-05-raspbian-wheezy.img of=/dev/sdbbs=512 conv=noerror,syncIts possible to use other tools than dd, you can get instructions at raspberrypi.org3. Boot the PiGreat suspense it anything did not go as planned.If there is an error with the card or any other thing, nothing will show up on thescreen, if the Pi is overwhelmed it will take forever to boot. Rasbian is idealbecause it has been tested and has a descent fist boot time.4. Confis on fist bootThese confiurations can be done later with raspi-confi or ideally done on the fistboot.
    Expand image to fil card
    Change the passwordlaxmi
    Change hostname (node1 or nodex)5. Re bootuser: pi (has root priviledges)password: laxmiRefresh update repo packages and update the softwaressudo apt-get update && sudo apt-get upgrade -yChoose your poison: I prefer having my emacssudo apt-get install emacs(:( you only get version 23, will have to compile to use version 24)6. Refresh and update the softwares, if not done yet.sudo apt-get update && sudo apt-get upgrade -y7. Get Fortran, (strange but we need it)sudo apt-get install gfortran8. Before getting Argonne MPICHResource: http://www.mpich.org/documentation/guides/The have great resources not just the the MPICH library$ mkdir /home/pi/mpich3$ cd ~/mpich39. Get MPICH sources from Argonne$ wget http://www.mpich.org/static/downloads/3.1.4/mpich-3.1.4.tar.gzResource: http://www.mpich.org/downloads – Get latest stable10. Unpack them.$ tar xfz mpichXXX.tar.gz11. Planning a clean place for install$ sudo mkdir /home/rpimpi/$ sudo mkdir /home/rpimpi/mpich3-install12. Make a build directory, and go to the build$ mkdir /home/pi/mpich_build$ cd /home/pi/mpich_build13. Confiure the buildThis will take a while, you can get the cards ready, you can play while theconfiurations takes place.$ sudo /home/pi/mpich3/mpichXXX/confiure -prefi=/home/rpimpi/mpich3-install14. MakeWhat ever it took the last, you can +1$ sudo make15. Install the fiesIt can take a bit of time, but not any way close to the last two stages.$ sudo make install16. Add the place that you put the install to your PATH$ export PATH=$PATH:/home/rpimpi/mpich3-install/bin17. Or Note to permanently put this on the PATH you will need to edit .profie$emacs ~/.profieand add lines below:# Add MPI to path (This is just a comment for later)PATH="$PATH:/home/rpimpi/mpich3-install/bin"18. Verify if the install were succesful$ which mpicc/home/rpimpi/mpich3-install/mpicc$ which mpiexec19. Go /home and set a place for your fist test$ cd ~$ mkdir mpi_fist_test$ cd mpi_fist_test20. Now testing MPI on single node$mpiexec -f machinefie -n <number> hostnamewhere machinefie contains a list of IP addresses (in this case just one) for themachines21. How this supposed to be donea) Get your IP address$ ifconfib) Put this into a single fie called machinefie$ emacs machinefiec) Add this line:192.168.1.161 [or the ip is … ]22. Now test if the machinefie$ mpiexec -f machinefie ~n 1 hostnameOutput should be:node1 (`hostname`)23. Little C code using MPI on Pi to calculate PiDon't worry, we shall not write the c code our selves, but MPICH has someexample codes we can run.$ cd /home/pi/mpi_fit_test$ mpiexec -f machinefie -n 2 /home/pi/mpich3/examples/cpiOutput is should beProcess 0 of 2 is on raspberrypiProcess 1 of 2 is on raspberrypipi is approximately 3.1415926544231318, Error is 0.000000000833338724. Celebrate!This calls for a celebration! (Seriously!)Order a bottle from Bourgogne and celebrate (and clone the node).25. Shut down$ sudo powerof

Control RGB LEDs with RPI