Dgital ouput causing disconnect (I think, help me debug)

86 views
Skip to first unread message

Santiago Alfaro

unread,
Aug 22, 2014, 5:21:52 PM8/22/14
to ioio-...@googlegroups.com
Hello all

I have an app that takes data from a sensor in the mobile device and uses the IOIO to transform the numeric value into the frequency of a transducer by turning an output pin on and off and controlling the transducer with a FET.

I have successfully done this in other apps but something is different now. My problem is that when I run:

...
 

int vibPin = 40;
...

led_ = ioio_.openDigitalOutput(IOIO.LED_PIN);
out = ioio_.openDigitalOutput(vibPin);
...

while (true) {

//out.write(false);
led_.write(false);
Thread.sleep((long) 100);
//out.write(true);
led_.write(true);
Thread.sleep((long) _incomingValue);
Log.d(TAG, "Sensor Value " + _incomingValue);
}

with the "out" pin commented out, everything works and LogCat shows the Sensor Value indefinitely. But if I uncomment the out pin, the app will run for a bit but then IOIO will disconnect and re-connect. Log cat will show this:

08-22 17:13:28.351: I/IOIOImpl(20170): IOIO connection established
08-22 17:13:28.356: D/IOIOConnectionVibThread(20170): Thread [Thread-78589] is running.
08-22 17:13:28.961: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:29.591: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:30.221: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:30.851: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:31.476: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:32.096: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:32.721: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:33.351: D/IOIOConnectionVibThread(20170): Sensor Value 485.0
08-22 17:13:33.466: I/IOIOProtocol(20170): IOIO disconnected
08-22 17:13:33.486: D/IOIOImpl(20170): Physical disconnect.
08-22 17:13:33.486: V/BluetoothIOIOConnection(20170): Client initiated disconnect
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): ConnectionLostException
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): ioio.lib.api.exception.ConnectionLostException: java.io.IOException: Broken pipe
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at ioio.lib.impl.DigitalOutputImpl.write(DigitalOutputImpl.java:53)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at mit.edu.obmg.cellsensors.IOIOConnection$Vibration.run(IOIOConnection.java:170)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): Caused by: java.io.IOException: Broken pipe
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at android.net.LocalSocketImpl.writeba_native(Native Method)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at android.net.LocalSocketImpl.access$600(LocalSocketImpl.java:33)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at android.net.LocalSocketImpl$SocketOutputStream.write(LocalSocketImpl.java:132)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:482)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:85)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at java.io.BufferedOutputStream.flushInternal(BufferedOutputStream.java:185)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:85)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at ioio.lib.impl.IOIOProtocol.endBatch(IOIOProtocol.java:186)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at ioio.lib.impl.IOIOProtocol.setDigitalOutLevel(IOIOProtocol.java:245)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): at ioio.lib.impl.DigitalOutputImpl.write(DigitalOutputImpl.java:50)
08-22 17:13:33.496: E/IOIOConnectionVibThread(20170): ... 1 more
08-22 17:15:53.466: I/IOIOConnection(20170): All workers dead
08-22 17:15:53.476: D/IOIOImpl(20170): Waiting for IOIO connection
08-22 17:15:53.476: V/IOIOImpl(20170): Waiting for underlying connection
08-22 17:15:53.506: V/BluetoothIOIOConnection(20170): Attempting to connect to Bluetooth device: IOIO (08:30)
08-22 17:15:53.511: D/BluetoothUtils(20170): isSocketAllowedBySecurityPolicy start : device null
08-22 17:15:53.511: D/BluetoothUtils(20170): isSocketAllowedBySecurityPolicy start : device null
08-22 17:15:53.511: D/BluetoothUtils(20170): isSocketAllowedBySecurityPolicy start : device null
08-22 17:15:53.511: W/BluetoothAdapter(20170): getBluetoothService() called with no BluetoothManagerCallback
08-22 17:15:53.526: D/BluetoothSocket(20170): connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[109]}
08-22 17:15:58.221: V/BluetoothIOIOConnection(20170): Established connection to device IOIO (08:30) address: 00:1F:81:00:08:30
08-22 17:15:58.221: V/IOIOImpl(20170): Waiting for handshake
08-22 17:15:58.226: I/IncomingState(20170): IOIO Connection established. Hardware ID: SPRK0020 Bootloader ID: IOIO0400 Firmware ID: IOIO0500
08-22 17:15:58.226: V/IOIOImpl(20170): Querying for required interface ID
08-22 17:15:58.236: V/IOIOImpl(20170): Required interface ID is supported
08-22 17:15:58.236: I/IOIOImpl(20170): IOIO connection established

The app uses fragments to control each different sensor present in the device and uses IOIO as a service. Inside the IOIO service I start a "Vibration Thread" so that I can control the frequency of the vibPin in a loop.

I have no idea what is going on or how to fix it.

Thanks,
Santiago


Ytai Ben-Tsvi

unread,
Aug 22, 2014, 7:50:25 PM8/22/14
to ioio-...@googlegroups.com
Any chance you connected a vibrator motor directly to the pin???


--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Santiago Alfaro

unread,
Aug 23, 2014, 1:45:19 PM8/23/14
to ioio-users
No, I have the pin going to an IRLZ44N Mosfet and the mosfet controls the 9 volt source for the transducer. and I have done this before and works fine.

BUT!!

Since you mentioned the electronics, I went and took off the board that I milled and re-wired with a proto board and IT WORKS!!!

As I write this I'm working on it and my problem was that I'm using the 9volt battery to power the IOIO and the transducer, so I just added a random resistor between the 9V and the transducer/mosfet and it works, so I'm guessing that too much current was going to the transducer and away from the IOIO so the connection was being dropped. (you can probably tell that I know squat about electronics, but I'm learning) So now I just need to figure out the value of the resistor to add and I should be done.

thanks for the tiny push in the right direction.

Santiago


--
You received this message because you are subscribed to a topic in the Google Groups "ioio-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ioio-users/XESZo5Wy4bQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ioio-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages