Strange Error Messages

Hello,

I'm currently using my arduino uno to control some servo motors and air pumps. Setting a pin HIGH activates a transistor switch which allows for the external power supply to take over and run the motors/pumps.

I had everything working fine for the last couple weeks, and then yesterday wired it all together on a PCB. After minor testing last night it all worked fine.

Today, out of the blue, when I run my code I am receiving this error:

java.io.IOException: Input/output error in writeArray
    at gnu.io.RXTXPort.writeArray(Native Method)
    at gnu.io.RXTXPort$SerialOutputStream.write(RXTXPort.java:1124)
    at processing.app.Serial.write(Serial.java:469)
    at processing.app.Serial.write(Serial.java:492)
    at processing.app.SerialMonitor.send(SerialMonitor.java:197)
    at processing.app.SerialMonitor.access$100(SerialMonitor.java:31)
    at processing.app.SerialMonitor$3.actionPerformed(SerialMonitor.java:86)
    at javax.swing.JTextField.fireActionPerformed(JTextField.java:492)
    at javax.swing.JTextField.postActionEvent(JTextField.java:705)
    at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:820)
    at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
    at javax.swing.JComponent.processKeyBinding(JComponent.java:2851)
    at javax.swing.JComponent.processKeyBindings(JComponent.java:2886)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2814)
    at java.awt.Component.processEvent(Component.java:6040)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
    at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
    at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
    at java.awt.Component.dispatchEventImpl(Component.java:4502)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

It only occurs when I turn on either of the pumps. This error causes the entire Arduino IDE (and also Visual Studio 2010 when I run my code through that) to freeze, and requires a restart of the IDE; also the USB cable must be unplugged and replugged in for the board to be detected again.

Does anyone have any idea of what is happening?

It's probably a power problem. Can you post the schematic? At this point, my guess is you're probably going to need some decoupling capacitors somewhere.

If it was a power problem wouldn't I have been receiving these errors from the start? I've had this set-up for weeks now (on the PCB as of yesterday) and have never received this error until today. Even last night when I was testing each component one at a time, as I put the PCB together, it all worked fine. Now I can't even turn on either of the pumps (even when it's the only component plugged into the board) without getting this error message.

I don't have a schematic of it...

It seems now that sometimes I am able to control the pumps (meaning turn them on and off) for about 10-15 seconds, and then the board and IDE freeze up, stop sending/receiving signals, and the pumps stay activated until I manually reset the board or unplug the USB cable. Other times however, this occurs immediately. I have no idea what is going on.

Every time it freezes though, I get the error I originally posted.

Replace the pump with a resistor and if the problem persists, then it's probably not a power problem.

Well after much trouble-shooting I've come to the conclusion that the board is faulty. I just borrowed a buddies Arduino Uno; I uploaded my sketch, plugged my appliances into the same pins that I used on mine, and voila! It worked perfectly. No errors. Once it worked I switched my board back in and got the error message immediately.

Does anyone know what kind of board failure would lead to this error message, how/if it's possible to reset the board to factory settings, and whether doing so would even fix this error?

I would say you have damaged the board. The other one you tried isn't damaged, yet.

You would need to look into:

  • Is the pump drawing more power than the board can supply?
  • Are there glitches (power spikes) coming from the pump?
  • Maybe some decoupling capacitors?

What sort of pump is it? How much power does it draw? Are there transistors there to help power it?

Setting a pin HIGH activates a transistor switch which allows for the external power supply to take over and run the motors/pumps.

OK, so there are transistors, but still some more details would help.

The pump draws 550 mA at maximum capacity; the external power supply provides 1500 mA. I'm only using the board for the 5V supply (from the digital pins) to activate the transistor, allowing for the external power to take over.

I've never worked with decoupling capacitors before...how would those help this situation, and where would they be placed in the circuit? Current circuit is power supply -> pump -> transistor -> ground, where the 5V digital pin also connects into the transistor allowing for power to go from the supply, through the pump and to the ground.

Perhaps a circuit?

Add a flyback diode across the motor like below.

http://en.wikipedia.org/wiki/Flyback_diode

  V
  |
  |----+
  |    |
  |   ----
  M    /\
  |   ----
  |    |
  |----+
  |
  |
--T
  |
  G

So no resistor in line with the transistor's base? That will kill your arduino.

I showed nothing connected to the base. My rough schematic isn't complete.

Also, it would be better to have a small value cap across the motor to cut down on the EMI noise and because the diode does instantly turn on.

My rough schematic isn't complete.

So it is a total waste of time posting it then.

You have made an error somewhere, you are perhaps destroying your arduino. If you want us to stand any chance of spotting it you have to tell us what you have done. We are like a compiler, we stop at the first mistake.

I don't have a schematic of it...

So how did you manage to make it then? Perhaps you are much better than me because I can't do that.

would be better to have a small value cap across the motor to cut down on the EMI noise

Who knows you haven't told us how you have wired it up. Draw it on a piece of paper, photograph it and then post it.

Grumpy_Mike:

mkwired: My rough schematic isn't complete.

So it is a total waste of time posting it then.

You have made an error somewhere, you are perhaps destroying your arduino. If you want us to stand any chance of spotting it you have to tell us what you have done. We are like a compiler, we stop at the first mistake.

mkwired: would be better to have a small value cap across the motor to cut down on the EMI noise

Who knows you haven't told us how you have wired it up. Draw it on a piece of paper, photograph it and then post it.

I think you are confusing me with MapleYamCakes.

Yes I was sorry.

But if you are posting advice it is best to post a solution that doesn't miss vital bits.

I've given some thought on how much I should help given incomplete information. What I came up with even is if I gave a complete schematic they can still do something to destroy the circuit and hopefully not himself/herself. So, I just work with what I got. I don't think the original poster knows how to create a schematic. I could refuse to help but I cannot help it.

He/Her probably is destroying his/her Arduino but we don't know that. Here's what we need answered.

What type of transistor is being used? Even better what's the part number? How is the transistor connected to the Arduino? How much current can the motor draw at start-up? How are you handling the inductive voltage spike?

In the end, he/she is probably going to use a relay to completely isolate the motor from the Arduino.