khansen3
Posts: 2
Joined: Mon Feb 11, 2013 6:07 pm

Problem with Firmata and Arduino

Mon Mar 18, 2013 10:14 pm

Hello,

I'm working on getting the Pi to talk to an Arduino. I've been following the tutorial here: http://niltoid.com/blog/raspberry-pi-arduino/, but I'm met with the error: "cannot open /dev/ttyUSB0" when I run app.js from the terminal. I mention that I'm doing this from the terminal because I believe this may be my problem, as the tutorial seems to be for running the Arduino IDE from the RPi desktop. Instead, I flashed firmata onto the Arduino using a Windows machine. Is this why I'm having a problem, and what could I change in the firmata example to get it to work with my RPi?

I did the following, per the instructions:

sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi

I also tried to disable serial port login by editing /etc/inittab

Changing "respawn:/sbin/getty -L ttyAMA0 115200 vt100" to #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Thanks.

khansen3
Posts: 2
Joined: Mon Feb 11, 2013 6:07 pm

Re: Problem with Firmata and Arduino

Tue Mar 19, 2013 4:08 pm

Okay, I found the problem. In the example code, line 9, the RPi is told to look for the Arduino at /dev/ttyUSB0. What it should have is /dev/ttyACM0. Problem solved and all is well with the world again.

mrmu
Posts: 3
Joined: Fri Apr 12, 2013 3:13 am

Re: Problem with Firmata and Arduino

Fri Apr 12, 2013 3:17 am

Hi,
I had that same issue as well and fixed it the same way.

However, when running the next step of the tutorial, after I install socket.io and should be able control the on/off of the LED from the browser, I got the following error when clicking the Turn On button. Did you get this same error?

[email protected] ~$ node app.js
info - socket.io started
Listening on http://raspberrypi:8080...
Firmware: StandardFirmata-2.3
debug - served static content /socket.io.js

/usr/local/lib/node_modules/firmata/lib/firmata.js:337
MIDI_RESPONSE[cmd](board);
^
TypeError: Property '0' of object #<Object> is not a function

dmcaodha
Posts: 1
Joined: Tue Apr 23, 2013 9:05 am

Re: Problem with Firmata and Arduino

Tue Apr 23, 2013 9:07 am

@mrmu

Did you get that sorted out? I am having the same problem.

mrmu
Posts: 3
Joined: Fri Apr 12, 2013 3:13 am

Re: Problem with Firmata and Arduino

Tue Apr 23, 2013 5:19 pm

No I didn't figure it out. I'm confused because Firmata works on the earlier example before socket.io is implemented and the web page is served. I talked to the author of the tutorial and he wasn't sure.

lewy103
Posts: 1
Joined: Tue Apr 09, 2013 12:20 pm

Re: Problem with Firmata and Arduino

Tue Apr 30, 2013 11:38 am

I have been following the same tutorial and got the same error trying to run the socket.io example. Anyone have any luck find the problem? Or if any of found another simple example to get started with.

Thanks

User avatar
Grumpy Mike
Posts: 914
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Problem with Firmata and Arduino

Sat May 04, 2013 8:46 am

The Arduino can show up on one of two ports almost at random, so when opening it up I always use:-

Code: Select all

try:
   ser = serial.Serial('/dev/ttyACM0',115200, timeout=2)
except :
   ser = serial.Serial('/dev/ttyACM1',115200, timeout=2) 

jmatt
Posts: 1
Joined: Mon Jun 03, 2013 2:06 pm

Re: Problem with Firmata and Arduino

Mon Jun 03, 2013 2:19 pm

I was able to get passed the following error by using an updated firmata.js file.

MIDI_RESPONSE[cmd](board);
^
TypeError: Property '32' of object #<Object> is not a function

firmata.js
https://github.com/rwldrn/firmata/blob/ ... firmata.js

GitHub Discussion
https://github.com/jgautier/firmata/pull/21

Loonhaunt
Posts: 55
Joined: Sat Nov 16, 2013 5:13 am

Re: Problem with Firmata and Arduino

Mon Dec 29, 2014 4:26 am

I am unable to load the standardfirmata sketch, I get a ioctl (TIOCMSET"): Broken Pipe message at upload. I am following a tutorial from the Raspberry Pi Cookbook. Has anyone seen this before?

DB

User avatar
DougieLawson
Posts: 36302
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Problem with Firmata and Arduino

Mon Dec 29, 2014 10:58 am

What tty device are you using? What tty device appears when you connect the Arduino?

Take a look with dmesg | less
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Loonhaunt
Posts: 55
Joined: Sat Nov 16, 2013 5:13 am

Re: Problem with Firmata and Arduino

Mon Dec 29, 2014 8:42 pm

Dougie,

I was completely off the map with my connection last night. I had two issues, one was a crap USB cable, and the other was my port. I was one click away from ttyACMD0 where I belonged. Too late at night for my old eyes. Sorry for the false alarm.

I must mention that I usually read your posts even though they are not on the topic that I happen to be researching. If your profile image is recent you don't look old enough to be a ZX80 afficianado! I started out beating around with an Osborne 1 sewing machine with a Zilog Z80 processor. I wish I still had that thing it would be kind of fun to play with. Oh and what was the "Mystery Ingredient" that distinguished the Z"X" from the "Z"? I never was able to find that out!

Thanks again.

Dave

User avatar
DougieLawson
Posts: 36302
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Problem with Firmata and Arduino

Mon Dec 29, 2014 9:13 pm

Loonhaunt wrote: If your profile image is recent you don't look old enough to be a ZX80 afficianado! I started out beating around with an Osborne 1 sewing machine with a Zilog Z80 processor.
That photo is about three years old. I'm a 1963 vintage hacker.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Interfacing (DSI, CSI, I2C, etc.)”