Shop OBEX P1 Docs P2 Docs Learn Events
Python, Linux and Scribbler (from scribbler forums) — Parallax Forums

Python, Linux and Scribbler (from scribbler forums)

zubernerdzubernerd Posts: 1
edited 2007-02-21 15:00 in Robotics
Getting Scribbler to work with Myro "My Robotics" from the Institute for
Personal Robots in Education.· I'm posting this in the parallax robotics
forums since the forums for the scribbler are being moved over here.·
This is an informational posting.

--JWT

DISCLAIMERS

1. I do NOT work for Parallax, or any of their subsidaries, NOR am I a
staff/faculty/student of· Georgia Institute of Technology or Bryn Mawr
College.

2. If your scribbler blows up, I'm NOT responsible for it.· I did test
these on my scribbler, and it survived, and, in fact, is quite happy [noparse]:)[/noparse]

3. I assume you have a working knowledge of linux, if not, find your
nearest *NIX guru, and offer them free {food,beer} in exchange for help [noparse]:)[/noparse]

PREREQs:

1. Python 2.4 or 2.5
2. A serial port (the Serial2USB port provided/sold by parallax seems
·· to work the best.)
3. A Scribbler (or Boe-Bot, provided that it is setup to "emulate" a
·· Scribbler )
4. Tk, python-tk, pySerial

I am using a Debian based distro, so where ever it says to install
something using 'apt-get', you may have to replace that command with
one using the package manager your distro uses (e.g. yum (rpm))

FORMATING OF DOCUMENTATION

If I am refering to a command line command, you will see it formated:

yourprompt$ this_command option1 option2


DO NOT TYPE IN "yourprompt$ " !!!!

If I am refering to output from the command line, it will be prefixed

>output from this_command


INSTRUCTIONS

First, create a directory to for all the programs involved.

yourprompt$ mkdir myrobot 
yourprompt$ cd myrobot


Get the files:

Now to setup up Python for myro, you will need to make sure that python-tk is installed:

yourprompt$ sudo apt-get install python-tk

When asked to install addition packages, say yes, since you will probably need
Tcl/Tk installed as well.

Then unzip MYRO and pyserial the files

yourprompt$ unzip myro-1.0.0.zip 
yourprompt$ unzip pyserial-2.2.zip

Your directory should look something like this

yourprompt$ ls -l 
>-rw-rw-r-- 1 username usergroup 46 2007-01-13 14:37 install.bat 
>drwxrwxr-x 2 username usergroup 4096 2007-01-13 11:49 misc 
>drwxrwxr-x 6 username usergroup 4096 2007-01-13 14:37 myro 
>-rw-r--r-- 1 username usergroup 78192 2007-01-28 15:21 myro-1.0.0.zip 
>drwxr-xr-x 4 username usergroup 4096 2007-01-28 15:23 pyserial-2.2 
>-rw-r--r-- 1 username usergroup 45470 2007-01-28 15:22 pyserial-2.2.zip 
>-rw-r--r-- 1 username usergroup 553413 2007-01-28 15:26 scribbler.exe 
>-rw-rw-r-- 1 username usergroup 1900 2007-01-11 08:48 setup.py 
>-rw-rw-r-- 1 username usergroup 977 2007-01-06 22:03 Start Python.pyw


Now let's set up the Scribbler...

I am assumming you are using a recent linux distro, with kernel 2.6.17-10,
since has support for the FTDI serial to usb device that comes with the
Scribbler/serial2USB package.· (If you are using another type of serial
to usb device, you're on your own).

To check for it being recognised by linux type the following command:

youprompt$ lsusb

You should many lines, with one being something like this:

>Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd 8-bit FIFO


The serial to usb adapter will be /dev/ttyUSB0. (or some variant of that)
To use the scribbler IPRE server through linux utilising WINE do the following:

1. Install the latest version of wine (I'm using Ubuntu 6.10, so I used the
·· built in package manager to download the latest verison of WINE)
··
yourprompt$ sudo apt-get install wine


2. Run winecfg if this is the first time you have used wine,
·· this should initialise your WINE installation.
··
yourprompt$ winecfg

3. Now from you home directory, go:
yourprompt$ cd .wine/dosdevices 
yourprompt$ ln -s /dev/ttyUSB0 com1



·· This creates a link between the serial2USB adapter and a virtual
·· com1 that WINE will use.· (For more info go to
·· http://www.winehq.com/site/docs/wineusr-guide/misc-things-to-configure)

4. Now you can execute the scribbler program. provided by the IPRE,
·· using the following command line:
··
yourprompt$ wine scribbler.exe /com1

·· You will get some output like this, and a window will pop up
·· showing the transfer.
·
>fixme:setupapi:SetupDiClassGuidsFromNameExA 
>fixme:setupapi:SetupDiGetClassDevsW : returning empty list 
>fixme:setupapi:SetupDiEnumDeviceInfo 0x190238 0 0x33fe38 
>EVT:101-User selected download from information dialog. 
>INF:111-PORT=COM1 DEVICE=Scribbler Server LOOPBACK=Yes ECHO=Yes 
>EVT:104-Downloading to COM1. 
>EVT:044-Download successful!

5. That's it, the scribbler server program should be uploaded.

Setting up pyserial:

1. Setup up the serial port by creating a com5, by executing the following command:
··
yourprompt$ sudo ln -s /dev/ttyUSB0 /dev/ttyS4

2. Now change into the directory that has pyserial setup file in it
·· (i.e. ~/myrobot/pyserial-2.2 )

3. Then execute:
··
yourprompt$ sudo python setup.py install

Setting up MYRO

1. Go to the directory that has "Start Python.pyw"
·· (i.e. ~/myrobot)

2. Make Start Python.pyw executable:
yourprompt$ chmod +x Start\ Python.pyw

3. Start the program:
yourprompt$ ./Start\ Python.pyw &

4. Now to test our scribby (with in the ILDE window)
IDLE 1.1.4c1 
>>> from myro import * 
Myro, (c) 2006 Institute for Personal Robots in Education 
[noparse][[/noparse]See http://www.roboteducation.org/ for more information] 
Version 1.0.0, Revision 1.89, ready! 
>>> robot = Scribbler("/dev/ttyS4") 
Waking robot from sleep... 
Hello, I'm Scribby! 
>>> robot.beep(1, 800) 
>>>

Your robot should beep, and now you're ready to go!

JWT/jwt 28.1.2007 15:40 CST

ADDITIONAL INFORMATION

Myro is copyrighted by·the Institute for Personal Robots in Education.
I am NOT associated with the Myro project, I am just an end user,
so if you have·Myro specific questions you should probably check out:

http://wiki.roboteducation.org/wiki/index.php/Main_Page

Also (probably mentioned somewhere in these forums, just don't have time
to look right now) you can use the MicrosoftTM Robotics Studio
to control your scribbler.

http://www.roboteducation.org/scribbler_msrs_readme.html

I haven't tried it myself, but if you have, please share your experience.

JWT/jwt 29.1.2007 00:27 CST


Post Edited (zubernerd) : 1/29/2007 6:32:00 AM GMT

Comments

  • rroyalrroyal Posts: 8
    edited 2007-02-01 17:17
    Thanks a lot! I got the myro server running in the Scribbler using windows and then switched back to SUSE linux to program.

    Is there a way to get the Scribbler to put out +5V on one of the unused serial pins? I would like to use it to power a bluetooth serial adaptor.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-01 17:37
    The battery voltage (nominally +9V, minus a diode drop, with fresh alkalines) is brought out to pin 9 pin 8 of the DB9 for this purpose, among others.

    -Phil

    Update: Corrected error in pin number.

    Post Edited (Phil Pilgrim (PhiPi)) : 2/1/2007 8:34:13 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-01 17:44
    Do NOT try to use an I/O pin to 'POWER' another device. You're limited to 20 mA per pin, and 50 mA for all BS2 I/O pins together.
  • rroyalrroyal Posts: 8
    edited 2007-02-01 19:15
    I'm not able to measure any nominal voltage coming from pins 6 - 9. The bluetooth serial adaptor I'm using only draws 25mA. Has anyone successfully used the Scribbler and a bluetooth adaptor without an external power supply?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-01 20:25
    Oops! My bad. It's pin 8. Between pin 8 and pin 5, you should be able to measure about 9V, minus a diode drop, with fresh alkaline batteries (less with NiMH) and the power switch turned "on". Originally, it was to be pin 9, but that would have conflicted with a PC that's trying to provide power on the same pin, as some PCs do.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 2/1/2007 8:35:10 PM GMT
  • rroyalrroyal Posts: 8
    edited 2007-02-02 19:24
    I'm trying to power a serial bluetooth adaptor from the Scribbler. A male serial port from a computer does supply potential difference but does the female connection from the Scribbler and is it safe to draw current from it? Hooking up pins 1 - 5 from the computer's serial port to the robot allows me to connect to the Scribbler using the python library and send commands while leaving pins 6 - 9 unconnected. I measure the voltage between pins 6-9 and pin 5 to be nothing. Between pin 4 and 5 I get around 12 volts. I can unhook pin 4 and it not affect the robot, meaning I can still connect to it using the python library and pins 1,2,3,5. Does this mean that I can draw current from pin 4 without it affecting the robot's bstamp and does anyone know for sure how many amps I could draw or how I could find out?

    Note to Phil. I'm not measuring any real voltage between pins 8 and 5 on the robot, should I be?

    And where did Alan get the 20mA figure?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-02-02 20:32
    rroyal said...
    Note to Phil. I'm not measuring any real voltage between pins 8 and 5 on the robot, should I be?

    Yes. Pin 8 is supplied directly with battery voltage through a diode, a PTC resettable fuse, and the on/off switch. This is the only pin from which you should attempt to draw power. See the schematic here.

    -Phil
  • rroyalrroyal Posts: 8
    edited 2007-02-06 19:18
    I have not been able to measure any voltage between pin 8 and pin 5 on the robot's female serial connection. Can the "Hacker's Port" be used to draw 25mA? On the schematic it looks like I can get +5V from pin 4 and then ground on pin 6.
  • rroyalrroyal Posts: 8
    edited 2007-02-09 19:07
    Has anyone done anything with the Scribbler's "Hacker's Port"? How much power can be drawn? Does anyone know what it was originally created for?
  • rroyalrroyal Posts: 8
    edited 2007-02-21 15:00
    bump
Sign In or Register to comment.