Saturday, October 27, 2012

AVR development in Linux

0 comments

Install necessary packages 

    $ sudo apt-get install gcc-avr
    $ sudo apt-get install avr-libc
    $ sudo apt-get install avrdude

Sample code

 #include
 void main()
 {

 }

Compiling code


   $ avr-gcc -Os -mmcu=$2 file_name.c -o file_name.elf
   $ avr-objcopy -j .text -O ihex file_name.elf file_name.hex

Uploading code

    $ sudo avrdude -p part_name -c programmer_id \
    >-U flash:w:file_name.hex
           + part_name => m16, m8
           + prog_id => usbasp
    + "flash" => programs flash
           + "w" => write mode 
  + shld be run as super user => "sudo" 

Compiler optimization

   specify an option -Ox while compiling (avr-gcc -Ox ... )
  + x => optimization levels
  + "-Os" => "s"=> small - for smaller code

 Made a video of LED blinking @ 900ms  

FUSE BITS:

 # read  
    $ avrdude -p m16 -c usbasp -U fuse_name:r:file_name.txt:h
        
        + fuse_name => lfuse,hfuse,lock  
   + "r" => read
        + fuse value "h" in hex format
       + stored in file_name.txt file  

 # write
          $ avrdude -p m16 -c usbasp -U fuse_name:w:0x82:m
          
        + "0x82" => sample fuse value
        + "m" => immediate ( use value in cmd directly )  
 + "w" => write

 Note: make use of AVR fuse CALC available online
Read more ►

Sunday, October 21, 2012

Setting up Git and Gitorious.org

2 comments
1. Backup any existing ssh keys
     $ cd ~/.ssh/
     $ mkdir key_backup
     $ mv *.pub ./key_backup/

2. Generate private ssh keys
     $ ssh-keygen -t rsa -C "developer.rps@gmail.com"
     $ Enter file in which to save the key: filename
     $ Enter passphrase : *****

3. Add private ssh key to git.gitorious.org account
     $ sudo apt-get install xclip
     $ xclip -sel clip < ~/.ssh/filename.pub

       - go to account setting in the user page of git.gitorious.org
       - Go to your Account Settings
       - Click ssh keys
       - Click "Add SSH key"
       - Paste your key into keyfield
       - Click Add key

4. Check whether ssh key is successfully added
     $  ssh -v git@gitorious.org


5.1. Clone the remote repo
     $ mkdir ~/workspace/
     $ cd ~/workspace
     $ git clone git://gitorious.org/athena/athena


5.2. Create remote repo from existing local repo
     $ mkdir ~/workspace/
     $ cd ~/workspace
     $ # add files if not already exist
     $ git init
     $ git remote add origin git@gitorious.org:athena/athena
     $ git commit * -m "some message"
     $ git push origin master


6. Adding files to remote repo
     $ cd ~/workspace/athena
     $ nano someFile.txt

7. Add some msg to it, save and exit
     $ git add someFile.txt
     $ git status
     $ git commit -a
     $ git remote set-url --push origin git@gitorious.org:athena/athena.git
     $ git push origin master #only for the first time,
     $ #next time onwards just use "git push")

   If the step 7 throws an error like this,
          $ Permission denied(publickey).fatal:The remote end hung up unexpectedly

  do the following, then try pushing
     $ ssh-add ~/.ssh/id_rsa.pub
     $ git push

8. Getting files from remote repo
     $ git pull



7. Start a new branch
     $ git branch feature-A
     $ git branch -a

8. Select new branch
     $ git checkout feature-A

9. Push commits on new branch to remote repo
     $ git push origin feature-A

10. Merge new branch with master
     $ git checkout master
     $ git merge feature-A

11. Delete a local branch
     $ git branch -D feature-A

12. Delete a remote branch
     $ git push origin --delete feature-A
Read more ►

Saturday, October 6, 2012

Software design - Proposal 01

1 comments
 Starting with a crude idea and refine it step by step..
   
    Requirements
        + accept a command
        + process and understand it
        + do it

    Refined 01
        + accept voice command
        + convert it to text
        + understand the text --> mostly pickup an object
        + find the object by looking around
        + go nearer to the object
        + pick it up if possible
        + track back to the initial position

    Refined 02
        + detect the object - DETECTION
        + calculate the distance and size of the object - GUESSING
        + track the object - TRACKING
        + go to the object
        + pick up the object if possible.
        + return back to the initial position or who commanded.
           
Before doing anything it is important to write the firmware for the uC.
    I'm planning to implement the firmware as a finite state machine. again the specification for the firmware are

        + LOCOMOTION OPERATIONS
        - LOCO_FORWARD
        - LOCO_BACKWARD
        - LOCO_TURN_RIGHT
        - LOCO_TURN_LEFT
        - LOCO_TURN_AROUND
    + CAMERA HANDLING
        - CAM_LOOK_UP
        - CAM_LOOK_DOWN
        - CAM_LOOK_RIGHT
        - CAM_LOOK_LEFT
    + ARM CONTROL
        - ARM_CONTRACT
        - ARM_DILATE
        - ARM_UP
        - ARM_DOWN
   

    these are some example operations performed by the uC when commanded by the BRAIN
    other than these there are several house-keeping functions. as previously said the uC ATmega16 is selected. the command is received thro the USART
    _____________         _________________
    | uC | USART|  <----> | BtBee | BRAIN |
    """""""""""""         """""""""""""""""
Read more ►
 

Copyright © Project Athena Design by O Pregador | Blogger Theme by Blogger Template de luxo | Powered by Blogger