We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › Processing to Arduino Serial Error
Page Index Toggle Pages: 1
Processing to Arduino Serial Error (Read 3500 times)
Processing to Arduino Serial Error
Feb 11th, 2009, 7:59am
 
Hello all,

I've been struggling with a bit of code to send single integers to an Arduino board.  

I'm sending single integers using a Serial object set at 9600 kbs.  I regularly -- once every three seconds -- send a new number to the Arduino board to set the position of a servo motor.  

The system works fine for some indeterminate number of values sent and then the Processing sketch crashes with the following:

Error inside Serial.write()

java.io.IOException: Device not configured in writeByte
at gnu.io.RXTXPort.writeByte(Native Method)
at gnu.io.RXTXPort$SerialOutputStream.write(RXTXPort.java:1093)
at processing.serial.Serial.write(Serial.java:507)
at Processing_to_Arduino.draw(Processing_to_Arduino.java:48)
at processing.core.PApplet.handleDraw(PApplet.java:1406)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Thread.java:613)
Exception in thread "Animation Thread" java.lang.RuntimeException: Error inside Serial.write()
at processing.serial.Serial.errorMessage(Serial.java:588)
at processing.serial.Serial.write(Serial.java:511)
at Processing_to_Arduino.draw(Processing_to_Arduino.java:48)
at processing.core.PApplet.handleDraw(PApplet.java:1406)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Thread.java:613)

Is this a problem with the rxtx library?  Has anyone else encountered this?

OSX 10.5.5
Processing 1.0.1
Arduino 0012
Arduino NG ATmega8

Any help is greatly appreciated.

Kenneth.


Re: Processing to Arduino Serial Error
Reply #1 - Feb 11th, 2009, 8:25am
 
Aha... answered my own question!  It appears that when the servo is asked to do too many long excursions in a row that the current drawn on the USB port powering the Arduino exceeds its maximum allowable level and the Mac shuts it down... leading to the device error on the next write() call from Processing (there's no device to write to).

Moral of the story:  use a separate power supply for the Arduino if you're using a current hungry device like a motor.

Kenneth.
Re: Processing to Arduino Serial Error
Reply #2 - Feb 14th, 2009, 1:01pm
 
oh wauv... i was gonna answer something completely else about the complexity of software and go like blah blah blah for minutes. But, this is really interesting, I have had the same problem a few times but have just restarted the whole thing.
cheers.
Re: Processing to Arduino Serial Error
Reply #3 - Mar 27th, 2009, 2:55am
 
I've had the same problem as well and your solution works. Thanks for this Kenneth.
Re: Processing to Arduino Serial Error
Reply #4 - Oct 2nd, 2009, 7:49am
 
I would have never thought that the problem is due to the supply.. I wanted to point out the first part of the code. Thanks for the tip!
___________________________________
http://mycoverthypnosis.com
Re: Processing to Arduino Serial Error
Reply #5 - Nov 24th, 2009, 6:31pm
 
great catch figuring this out -- that's an obscure problem that could drive you nuts for weeks.
Page Index Toggle Pages: 1