Fullers Folio
  • Blog
  • Book List 2015-16
  • Book List 2014-15
  • Book List 2013-14
  • Book List 2013
  • Book List 2012
  • Book List 2011-12

Connecting my RaspberryPi and USB Robotic Arm

1/13/2013

0 Comments

 
Just under a year ago I put my name down for a Raspberry Pi, and was given a waiting list number of over 260,000. While I was waiting for my Pi to come, I looked around on the internet as to various things one could do with a Pi.

Early on I noticed a blog article by someone talking about programming their arm to pick up a mince pie and give it to them, when they were having a cup of coffee. This was over Christmas 2011.

I sort of vaguely mentioned this to Pauline, that it might be good fun to try and do when I got the Pi. Well the Pi came in the early autumn, followed by Christmas we have just had. There under the tree was a Robot Arm and usb interface.

Quite a few hours later the arm was built – (33 pages of instructions), and was happily moving around with the manual control unit. This had to be uninstalled and the usb interface wired in.

This is now quite a number of months since I saw the original blog item, and I could not find it again, but no worries as there seems to be at least 20 sites quoting the same bit of code on how to get it working. That should give a clue.

It was late one evening between Christmas and New Year and I felt that I would like to get it working, and then work out how to change it afterwards. So I went onto one of the 20 plus sites, downloaded the code and tried to get it working. It would not work. Maybe time for bed

The next day tried again, and still would not work. Ok so I thought maybe something on my Pi was conflicting with it. I had apache running at the time, so time for a new version. I downloaded the latest wheezy version http://www.raspberrypi.org/downloads, and wrote it to my sd card.

While this was being done I thought I had better test my wiring just to make sure the Arm was working via the usb, so installed the software that came with it on a windows laptop and tested it. Yes it was working.

So have set up the new card, installed tightvncserver on it so I can access it remotely (also this reduced the number of things going into the usb ports just in case they were causing the problem. We were ready for action. This time I was going to do it from first principles.

Picture
lsusb command results
Firstly needed to check that the pi was picking up the arm via the usb hub. The easiest was of doing this is to use the command “sudo lsusb” in a terminal. (If the -v flag is used at the end then it is quite amazing the info it produces).


The first time was with the arm turned off. The second time was when it was turned on

So I could see that the arm had been detected as device 4 with an id of 1267. This is important as the id is needed by the program to talk to the arm.


Next needed to install the usb library for python this is the version that I used. I saved it then, extracted it then ran into problems as the installation instructions say "python setup.py install". The Pi has two versions of python 2.7 and 3.2 Unfortunately the default one seems to be python 2.7, but this needs to be on the other version so when doing a python command need to add a 3 to the command. Probably there is a way of changing the default but I don't know it.




Picture
robot.py - Simple python program to move the arm.
The simple python code is as shown. This sends a single command at a time controlling the arm.

  • It imports the four libraries required to work, 
  • then identifies the robot by its usb id.
  • Then defines the commanddata to be sent down the usb, as a byte command
  • Waits for a short while and 
  • then sends the stop all command to the arm

The byte commands are documented here http://notbrainsurgery.livejournal.com/38622.html

It can either be run via the python GUI or as a terminal command line remembering to do it as a sudo command

The byte data in the commanddata variable can be changed to move the arm. This way each movement and the corresponding byte data can be checked and tested. 

The next stage is to develop the program but that is for another day.

0 Comments



Leave a Reply.

    Picture

    Tim Fuller

    Dyslexic doodles on photography, food (growing, cooking & of course eating), faith and other fascinating things. This is a personal blog expressing my views.


    www.fullersfolio.co.uk
    www.trostriecottage.co.uk
    www.thespinneycottage.co.uk
    www.cardswithamessage.co.uk
    www.gallowaygetaways.co.uk
     www.tpfuller.com


    Archives

    November 2015
    October 2015
    September 2015
    August 2015
    July 2015
    June 2015
    May 2015
    April 2015
    March 2015
    December 2014
    November 2014
    October 2014
    August 2014
    July 2014
    May 2014
    April 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    November 2012
    October 2012
    September 2012
    August 2012
    July 2012
    June 2012
    May 2012
    April 2012
    March 2012
    February 2012
    January 2012
    December 2011
    November 2011
    October 2011
    September 2011
    August 2011
    July 2011
    June 2011
    May 2011

    Categories

    All
    1 Peter
    1 Samuel
    2 Kings 6
    2 Samuel
    52 Books In 52 Weeks
    Acts 14
    Adrian Plass
    Agatha Christie
    Alanna Knight
    Alexander Mccall Smith
    Alexandre Dumas
    Alistair Moffat
    Amy Orr-Ewing
    Andre Norton
    Andrew Harrington
    Andrew Paterson
    Anna K Green
    Ann Cleeves
    Anthony Horowitz
    Arthur B Reeve
    Autumn Colours
    Banana
    Baroness Orczy
    Beetroot
    Biomass
    Blackberries
    Blog Sites
    Booklist 20112012
    Book List 2012
    Book List 2013
    Book List 2013 2014
    Book List 2013-2014
    Book List 2014
    Booklist 2015
    Bread
    Bt Broadband
    Business (Ad)venture
    Butterflies
    Charles Dickens
    Charles Elliott
    Charles Petzold
    Chicken
    Chocolate Brownie
    Christmas
    Christmas Traditions
    Chutney
    C J Sansom
    Clare Francis
    Colin Dexter
    Conn Iggulden
    C S Lewis
    Dan Brown
    Daniel Defoe
    David
    David Baldacci
    David Donachie
    Derek Wilson
    Desmond Bagley
    Diet
    Dorothy L Sayers
    Edmund Clowney
    Elijah
    Elisha
    Elizabeth George
    Eric Van Lustbader
    Faith
    Fish
    Folio
    Food
    Frederic Forsyth
    Frederick Bartlett
    Free Wallpapers
    Freeware
    Gardening
    Gayle Lynds
    George Hendry
    George R R Martin
    G K Chesterton
    Good Choice Foods
    H G Wells
    Holiday Cottage
    Home Group
    How To Loose 50lbs Or More
    H Rider Haggard
    Hungry Giraffe
    Ian Rankin
    Irfanview
    Jack Higgins
    Jam
    Jean-Yves Ferri
    Jed Rubenfeld
    Jeffery Archer
    Jeffery Deaver
    J Jackson Bentley
    John Buchan
    John Cheeseman
    John C Lennox
    John Grisham
    John Le Carre
    John Mortimer
    Johns Gospel
    John Thomas McIntyre
    John Wyndham
    Jo Nesbo
    Jules Verne
    Kate Atkinson
    Ken Follett
    Kielder Power Problems
    Kielder Water
    Kirkcudbright
    Laurence Clarke
    Laurie R King
    Lee Child
    Len Deighton
    Lentils
    Librivox
    Librivoxorgb9a2cc43c9
    Louis De Bernieres
    Low Fat
    Luke
    Margery Allingham
    Martin Bell
    Martin Cruz Smith
    M C Scott
    Michael Chabon
    Michael Crichton
    Michael Dobbs
    Mick Brooks
    Mincemeat
    Monty Don
    Netprotectplus Problems
    Ngaio Marsh
    Nicky Gumbel
    Northumberland
    Oats
    Open Source
    Pasta
    Patricia Highsmith
    Patrick O Brian
    P D James
    Peter
    Peter F Hamilton
    Peter May
    Peter Robinson
    P G Wodehouse
    Phillip Margolin
    Photos
    Pierson
    Plums
    Prayer
    Productivity
    Prophecy
    Python
    Raspberry Pi
    Recipe
    Richard Preston
    Risotto
    Robert Dale
    Robert Goddard
    Robert Harris
    Robert Louis Stevenson
    Robert Ludlum
    Roger Stelljes
    Rory Clements
    Sardines
    Scottish Borders
    Sebastian Faulks
    Simon Conway
    Simon Monk
    Simon Scarrow
    Sir Arthur Conan Doyle
    Sir Walter Scott
    Snow
    Software
    Soup
    Spiders
    Spring
    Stella Rimingtom
    Stephen
    Steve Berry
    Steve Timmis
    Story Behind Image
    Stuart Clark
    Summer
    Superfoods
    Suzanne Collins
    Talk
    The Cloud
    Three Wise Men
    Tim Chester
    Trostrie Cottage
    Valerio Massimo Manfredi
    Vegetation
    Victor Appleton
    Vince Flynn
    Watermakering
    Wayne A Grudema172e2ef81
    Weather
    Web Site Design
    Wigtown
    Wilkie Collins
    William Boyd
    William Le Queux
    Willow Wood
    Winter
    Yann Martel
    Zane Grey

    RSS Feed

Powered by Create your own unique website with customizable templates.