element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Trying to run simple program to alamode using firmata on Raspberry PI
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 416 subscribers
  • Views 486 views
  • Users 0 members are here
  • firmata
  • alamode
Related

Trying to run simple program to alamode using firmata on Raspberry PI

rukem1
rukem1 over 12 years ago

Hi all, I am quite new to Arduino and just purchased an AlaMode (shield?) with intentions to control a robot with python programming on the Pi.

 

I originally had trouble just getting a sketch to load to the AlaMode  with the Arduino IDE and finally found that changing the 'board' info to show the correct baud rate fixed that problem. Blink works fine, so I then loaded the firmataStandard sketch sucessfully.

Then, using steps from a Middlesex University post on 'Raspberry Pi, Arduino and Firmata,' I wrote a simple program to blink another led (9) using the following simple python program:

 

#!/usr/bin/env python

#

import pyfirmata as pyf

PORT = '/dev/ttyACM0'

board = pyf.Arduino(9)

 

while 1:

        board.digital[9].write (1)

        board.pass_time(1)

        board.digital[9].write (0)

        board.pass_time(1)

 

The program waits for about 5 seconds and spits out the following error: ( I tried running it without the sudo first and got the same error.)

 

alamode/sketchbook $ sudo python firmata-tst.py

Traceback (most recent call last):

  File "firmata-tst.py", line 27, in <module>

    board = pyf.Arduino(9)

  File "/usr/local/lib/python2.7/dist-packages/pyfirmata/__init__.py", line 16, in __init__

    super(Arduino, self).__init__(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/pyfirmata/pyfirmata.py", line 75, in __init__

    self.sp = serial.Serial(port, baudrate)

  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 260, in __init__

    self.open()

  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 276, in open

    raise SerialException("could not open port %s: %s" % (self._port, msg))

serial.serialutil.SerialException: could not open port 9: [Errno 2] No such file or directory: '/dev/ttyS9'

Exception AttributeError: "'Arduino' object has no attribute 'digital'" in <bound method Arduino.__del__ of <pyfirmata.Arduino object at 0xb6c4a110>> ignored

 

Of course, I have no device '/dev/ttyS9', although I do have a '/dev/tty9' which is probably not the one this python script is looking for. I do have the device '/dev/ACM0', which is used by the IDE for serial communications.

 

Any ideas what I might be doing wrong here? Anybody familiar with the new AlaMode?    Thanks Kem

  • Sign in to reply
  • Cancel
Parents
  • rukem1
    0 rukem1 over 12 years ago

    Update:

    On further research, I found that my Alamode port is /dev/ttyAMA0, not /dev/ttyACM0. However, changing that in the test script didn't change the error results.

    Also, in checking line 75 in pyfirmata.py (mentioned in the error trace) I see that the baud rate is hard coded to 57600, not the 115200 which was needed to get my alamode to originally upload sketches. (I did try changing the baud rate in pyfirmata.py with no change.)

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • rukem1
    0 rukem1 over 12 years ago

    Update:

    On further research, I found that my Alamode port is /dev/ttyAMA0, not /dev/ttyACM0. However, changing that in the test script didn't change the error results.

    Also, in checking line 75 in pyfirmata.py (mentioned in the error trace) I see that the baud rate is hard coded to 57600, not the 115200 which was needed to get my alamode to originally upload sketches. (I did try changing the baud rate in pyfirmata.py with no change.)

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube