Translate

Friday, October 30, 2015

Working on the iRis project

Here a step-by-step guide to work on git for the iRis project.
If you are new on git and github, read this article first.

The iRis project is on github, so if somebody wants to join it, or just follow the progress, can clone the git repo for iRis.

Let start from the link for the iRis github, that is Public : https://github.com/TheFwGuy/iRis

Clone iRis

Use git to clone the iRis project, with the command :

  • git clone https://github.com/TheFwGuy/iRis.git
That's it !
On your directory, will exist a directory called iRis, containing the code for iRis.

Update iRis

Now that you have iRis on your machine, to keep iRis updated is even easier.
Simply go in the iRis directory and issue the command : git pull

  • cd ~/SteveProjects/iRis
  • git pull
That's it !  If the code on the github is changed, it will be updated on your machine

Working on iRis

Compiling iRis

The code for iRis is developed using GCC for the MSP430.
In order to compile it is necessary to install on the machine the MSP430 Gcc cross compiler.

Once installed the compiler, simply go in the directory iRis and issue :

make clean; make

Testing iRis

In order to test iRis is necessary to have a MSP430 Launchpad, a MSP430g2452 and a interface board.
Connect the board via USB.

Open a terminal, go in the iRis directory and issue the command:

sudo mspdebug rf2500

If everything is OK, the board is recognized.
If so, load the program in the MSP430:

prog iris.elf

then start it with:

run

Commit iRis


If you want to collaborate to iRis, you can modify the code on your machine, and keep track of the modifications locally, using git.
Issuing the command git status returns the status of the modifications made to the code.

Every time you modify a file, git status will indicate a modification.
Every time you will have to add it with:

git add file_name

git add * will add all the modified files.

Then it will be possible to commit the file with:

git commit file_name

All these operations are LOCAL to your machine !

If you are a registered collaborator to the iRis project, then you should be able to "push" your modifications in the github:

git push

Working on RPOf project

Here a step-by-step guide to work on git for the RPOf project.
If you are new on git and github, read this article first.

The RPOf project is on github, so if somebody wants to join it, or just follow the progress, can clone the git repo for RPOf.

Let start from the link for the RPOf github, that is Public : https://github.com/TheFwGuy/RPOf.git

Clone RPOf

Use git to clone the RPOf  project, with the command :

  • git clone https://github.com/TheFwGuy/RPOf.git
That's it !
On your directory, will exist a directory called RPOf, containing the code.

Update RPOf

Now that you have RPOf on your machine, to keep RPOf updated is even easier.
Simply go in the RPOf directory and issue the command : git pull

  • cd ~/SteveProjects/RPOf
  • git pull
That's it !  If the code on the github is changed, it will be updated on your machine

Working on RPOf

Compiling RPOf

The code for iRis is developed using GCC for the MSP430.
In order to compile it is necessary to install on the machine the MSP430 Gcc cross compiler.

Once installed the compiler, simply go in the directory RPOf and issue :

make clean; make

Testing RPOf

In order to test RPOf is necessary to have a MSP430 Launchpad, a MSP430f2013 and a interface board.
Connect the board via USB.

Open a terminal, go in the RPOf directory and issue the command:

sudo mspdebug rf2500

If everything is OK, the board is recognized.
If so, load the program in the MSP430:

prog rpof.elf

then start it with:

run

Commit RPOf


If you want to collaborate to RPOf, you can modify the code on your machine, and keep track of the modifications locally, using git.
Issuing the command git status returns the status of the modifications made to the code.

Every time you modify a file, git status will indicate a modification.
Every time you will have to add it with:

git add file_name

git add * will add all the modified files.

Then it will be possible to commit the file with:

git commit file_name

All these operations are LOCAL to your machine !

If you are a registered collaborator to the RPOf project, then you should be able to "push" your modifications in the github:

git push

Working on my projects

Here a step-by-step guide to work on git for some projects I maintain.

This guide assumes:

  • you like Linux, you USE Linux
  • you know how to work with the terminal
  • the instructions are based on Ubuntu, but they should be easily used on other systems.
    The main difference could be the application to install code. apt-get for Ubuntu, yum for Red Hat/CentOS, ecc.
  • you know how to set up a cross compiler for different microcontroller under Linux

Introduction


The most important thing to remember working with git, is that normally ALL the operations are LOCAL to your machine !
Only few specific and explicitly called operations operate on a remote server, in our case, github.

Specifically :

  • The first time, when we clone the project from github
  • Every time we want to update our code from github
  • Every time we want to save our work on github

First time

git Installation


The first time we want to clone the project from github.
How we do that ?
First of all we must have git on our machine.
So if you don't already installed it, open a terminal and type :

  • sudo apt-get update
  • sudo apt-get install git


(note, I'm using for this article, the git version 1.9.1 on a Ubuntu 14.04 LTS)

After the installation, is better to set it up with some basic info :

  • git config --global user.name "your name"
  • git config --global user.email "youremail@domain.com"
  • git config --list will show the configuration for your git
For example :

git config --global user.name "John Smith"
git config --global user.email "jsmith@mystery.com"

I'm not sure if is valid for every type of operation, but it is possible github will require a SSH key in order to clone/update a project.
In that case I strongly recommend to follow this brief tutorial about how to generate and deploy an ssh key with github.

At this point you are ready to clone the project from github !

Clone a project

Cloning is the act that duplicate on your hard drive what is present in a remote git repository, in this case github.
The cloning is strongly suggested in case you want to collaborate to the project.
Cloning the project recreate on your local machine the project and it's history and allows to merge it back on github if you do modifications.

First of all create or go on a directory that will host the project.
For example, create a directory called SteveProjects on your home environment :
  • cd ~
  • mkdir SteveProjects
  • cd SteveProjects
Now is possible to use git to clone a project, with the command :

  • git clone URL_repository
That's it !
On your directory Projects, will exist a directory called as the project name, containing the project.

Download a project


In case you are not interested to collaborate to the project but wants to have the project on your machine, or in case you don't want to install git or generate SSH keys, from github is possible to download the project as a zip file.

Update project

Now that you have the project on your machine, to keep it updated is even easier.
Simply go in the project directory and issue the command : git pull

  • cd ~/Projects/project_name
  • git pull
That's it !  If the code on the github is changed, it will be updated on your machine

Working on the project

Commit the project


If you want to collaborate to a project, you can modify the code on your machine, and keep track of the modifications locally, using git.
Issuing the command git status returns the status of the modifications made to the code.

Every time you modify a file, git status will indicate a modification.
Every time you will have to add it with:

git add file_name

git add * will add all the modified files.

Then it will be possible to commit the file with:

git commit file_name

All these operations are LOCAL to your machine !

If you are a registered collaborator to the project (ask me), then you should be able to "push" your modifications in the github with:

git push

Working protocol


In order to reduce the conflict between developer, I suggest this protocol:


  1. Clone the project
    git clone URL_of_github_project
  2. Create a branch
    git checkout -b branch_name
  3. Work on your modifications, add and commit regularly
  4. When is time to push the modifications:
    git push origin branch_name
  5. If allowed, merge the branch on the master.



Tuesday, October 13, 2015

iRis project - an introduction

The purpose of the iRis project is to design and build an eyes training simulator for ophthalmologist.

Purpose


The purpose is to have a "head" for medical training purpose related to eyes illness.
Basically the idea is to build a "eyes simulator" capable to react to the light like an eye does, in order to simulate  different types of illness retina/nerve related.

Here some basic requirements :

  1. relatively low cost (< 500$)
  2. iris dilatation capabilities
  3. simulation light deficiency separately for each eye
  4. (optional) background simulation using slides or small LCD screens

Hardware


The hardware is based on a pair of "electronic eye bulbs".
Each one has the capability to change the "iris" diameter and each one is equipped with light sensors.
The iris could be a diaphragm controlled by a servomotor or other meaning.
The back of the eyes can host a slide representing some specific illness.

The main electronic components are a light sensor and a servomotor capable to control the iris.
No need to  add  a palpebra and eye movements.
A small microcontroller should be able to control the eye or both but the final architecture will depend from many other factors, like the need to collect data other than do the simulation.

The basic idea is to have the "eye" to react to the amount of light, following different set of parameters in order to simulate different type of illness.

Software


The basic functionality of the eye model is to measure the amount of light and provide a feedback to the diaphragm.
Research the timing involved  in a normal eye in order to determine the power of the processor and related systems.
For example, how the light sensor is hooked to the microcontroller, the precision of the reading, how fats the sensor reacts to the change of light, how fast the iris can be controlled in relationship with the numbers of a "real" human eye.
Also some eye behavior is expected to be simulated, like the capability to the iris of the both eyes to operate in sync.