A friendly user from the tabletrepublic forum pointed out that I was using the wrong version of the google accessory API: the com.android.future.usb.accessory API is only used on pre-gingerbread versions of the OS. Anyone else should use android.hardware.usb instead.
With that fixed, the app can be loaded onto the tablet. The device correctly switches to accessory mode, and usbManager even logs that as an event in logcat. But as in my host mode attempts, mUsbManager.getAccessoryList() always returns an empty list. The intent I registered is never called either.
Still not there.
Watching logcat while the tablet is running is quite scary, btw: so many exceptions thrown and signals not caught...
Showing posts with label tablet. Show all posts
Showing posts with label tablet. Show all posts
Sunday, 4 March 2012
Friday, 24 February 2012
The first 'gotcha'
The tablet arrived, and so have the parts from jeenode!
The tablet is nice, especially after I did some updates on it - more about that some other time.
I got the arduino development tools to work, too. If you're using a jeenode USB, the instructions given on JeeNode Tips are a bit out-of-date: if you get arduino programmer is not responding errors, you need to change the device type to Uno (I think the bootloader has been updated). Then you can just take one of the example sketches, go to 'upload' - and see it working (with small changes - the 'blink' sketch assumes an LED on pin 13 - it's on pin 9 on the jeenode).
In eclipse, I went with this Arduino plugin - a fork from the official WinAVR plugin. It appears to work, though Eclipse is throwing java.lang.UnsatisfiedLinkError: no spawner in java.library.path in the path configuration - so I had to configure all the paths by hand. By default, the executables are all in /usr/bin, the header files in /usr/lib/avr/include, the IDE path is /usr/share/arduino, and I have no idea where the Atmel part description files are (or what they are, for that matter). I wonder if the problem is cause by setting the java library path in eclipse.ini for subclipse (see yesterdays post), but removing that entry doesn't seem to help.
That wasn't the 'gotcha', unfortunately. The gotcha is that the tablet only has one USB OTG mini-b socket, and no external power connection. In the OTG standard, the host device (the tablet in my setup) provides the power. When the battery is empty, I have to unplug it and charge - but that won't do if the tablet is the user interface for the whole system.
Fortunately, it looks as if there is a provision for exactly this in the USB OTG standard (thank you Wikipedia for linking to it). The USB Accessory Charger Adapter is a three-way connection between host, client, and charger. Has anyone ever come across a device actually implementing this? (don't confuse this with the USB splitter cable that's plugged into two ports on the host, to double the current). From reading the spec, since I am only interested in a single use case, it looks like a resistor in the plug at the tablet might be enough to tell it that, while it's the host, it is allowed to draw charge.
Of course, that depends on if the tablet actually implements OTG, including that part of the spec. It's not clear, as some other tablets come with a dongle that adds a second port and ethernet adapter - that would suggest it's connecting to a hub, which OTG can't do (I think?). Maybe there is another way of switching from client to host role without following the OTG standard.
I don't actually have a cable yet that goes from USB mini male to USB A female, so I can't try what happens if you plug in a hub.
The tablet is nice, especially after I did some updates on it - more about that some other time.
I got the arduino development tools to work, too. If you're using a jeenode USB, the instructions given on JeeNode Tips are a bit out-of-date: if you get arduino programmer is not responding errors, you need to change the device type to Uno (I think the bootloader has been updated). Then you can just take one of the example sketches, go to 'upload' - and see it working (with small changes - the 'blink' sketch assumes an LED on pin 13 - it's on pin 9 on the jeenode).
In eclipse, I went with this Arduino plugin - a fork from the official WinAVR plugin. It appears to work, though Eclipse is throwing java.lang.UnsatisfiedLinkError: no spawner in java.library.path in the path configuration - so I had to configure all the paths by hand. By default, the executables are all in /usr/bin, the header files in /usr/lib/avr/include, the IDE path is /usr/share/arduino, and I have no idea where the Atmel part description files are (or what they are, for that matter). I wonder if the problem is cause by setting the java library path in eclipse.ini for subclipse (see yesterdays post), but removing that entry doesn't seem to help.
That wasn't the 'gotcha', unfortunately. The gotcha is that the tablet only has one USB OTG mini-b socket, and no external power connection. In the OTG standard, the host device (the tablet in my setup) provides the power. When the battery is empty, I have to unplug it and charge - but that won't do if the tablet is the user interface for the whole system.
Fortunately, it looks as if there is a provision for exactly this in the USB OTG standard (thank you Wikipedia for linking to it). The USB Accessory Charger Adapter is a three-way connection between host, client, and charger. Has anyone ever come across a device actually implementing this? (don't confuse this with the USB splitter cable that's plugged into two ports on the host, to double the current). From reading the spec, since I am only interested in a single use case, it looks like a resistor in the plug at the tablet might be enough to tell it that, while it's the host, it is allowed to draw charge.
Of course, that depends on if the tablet actually implements OTG, including that part of the spec. It's not clear, as some other tablets come with a dongle that adds a second port and ethernet adapter - that would suggest it's connecting to a hub, which OTG can't do (I think?). Maybe there is another way of switching from client to host role without following the OTG standard.
I don't actually have a cable yet that goes from USB mini male to USB A female, so I can't try what happens if you plug in a hub.
Wednesday, 22 February 2012
The other kitchen node: arduino takes the tablet
The kitchen node I described in the previous post has a USB port. Why?
Because the kitchen will also house the user interface. As I mentioned before, I initially looked at the Raspberry Pi. But I wanted a nice touch screen to go with it, and they aren't cheap. And then I realized that by the time I add wifi, sound (for alarms, if nothing else), and power, I might as well get one of those cheap Chinese Android tablets. I'll save all the hassle of connecting the display and touch screen, and have a powerful environment to program the UI.
So, somewhere mounted on the kitchen cupboards, we will have a nice 7in tablet, talking to the Jeenode using USB. The one I've ordered (Ainol Paladin) is not the cheapest available, but it's the cheapest running Android 4.0 (so I can play with the newest Android version), has a capacitive screen, and it's not one of the (reportedly) underpowered VIA 8650 based systems. Apparently, the VIA chip is on its way out, to be replaced by something faster. I would have liked an Allwinner 10 based device, but they are more expensive.
There remains the question how to connect the tablet to the jeenode. One option I found is a low-level debug mode based connection as used in the IoIo. That's supposed to work on most devices, but the ioio is a bit more expensive, and since it's not actually an arduino-type node (more of a dumb direct io extension of the android device), driving an rfm12b wireless node off it is not straightforward.
The other option is based on Android's new Open Accessory Development Kit. Not all devices support this mode, and because the USB host in this case is the arduino, it needs a more powerful (and expensive) mega based node.
But don't tablets support USB host mode? After all, most of them come with external dongles with ethernet and additional USB ports? That wouldn't make sense if they only could work as USB clients.
Indeed they do, and as this great post describes, it is possible to connect Arduinos as simple serial clients. Perfect.
At least, that's the theory. The tablet will come tomorrow (and there's always a worry about quality with cheap Chinese devices), and the jeenode parts have shipped from Holland as well. We'll find out.
Because the kitchen will also house the user interface. As I mentioned before, I initially looked at the Raspberry Pi. But I wanted a nice touch screen to go with it, and they aren't cheap. And then I realized that by the time I add wifi, sound (for alarms, if nothing else), and power, I might as well get one of those cheap Chinese Android tablets. I'll save all the hassle of connecting the display and touch screen, and have a powerful environment to program the UI.
So, somewhere mounted on the kitchen cupboards, we will have a nice 7in tablet, talking to the Jeenode using USB. The one I've ordered (Ainol Paladin) is not the cheapest available, but it's the cheapest running Android 4.0 (so I can play with the newest Android version), has a capacitive screen, and it's not one of the (reportedly) underpowered VIA 8650 based systems. Apparently, the VIA chip is on its way out, to be replaced by something faster. I would have liked an Allwinner 10 based device, but they are more expensive.
There remains the question how to connect the tablet to the jeenode. One option I found is a low-level debug mode based connection as used in the IoIo. That's supposed to work on most devices, but the ioio is a bit more expensive, and since it's not actually an arduino-type node (more of a dumb direct io extension of the android device), driving an rfm12b wireless node off it is not straightforward.
The other option is based on Android's new Open Accessory Development Kit. Not all devices support this mode, and because the USB host in this case is the arduino, it needs a more powerful (and expensive) mega based node.
But don't tablets support USB host mode? After all, most of them come with external dongles with ethernet and additional USB ports? That wouldn't make sense if they only could work as USB clients.
Indeed they do, and as this great post describes, it is possible to connect Arduinos as simple serial clients. Perfect.
At least, that's the theory. The tablet will come tomorrow (and there's always a worry about quality with cheap Chinese devices), and the jeenode parts have shipped from Holland as well. We'll find out.
Location:
Birmingham, West Midlands, UK
Subscribe to:
Posts (Atom)