As it turns out, power is not the only problem I have with the tablet.
First, a bit about the tablet. It's an Ainol Novo Paladin - currently the cheapest tablet running ICS, with a capacitive screen, and not using a VIA CPU. It's nice enough, and after upgrading it to 4.0.3 with an unofficial build, and getting rid of all the pre-installed Chinese apps, you're left with a responsive tablet with many of the basic apps working. This includes youtube, but not for example a working BBC iplayer.
It's Achilles Heel is the processor - unlike nearly all android systems out there, it's not an ARM based processor, but a MIPS processor. While pure java apps work OK (and something I wrote for a phone in 2.2 worked immediately on the tablet, save a few scaling issues), any app that uses native compiled code won't work. And that excludes a lot of the apps on the Android market. That wouldn't be a problem, I thought, as I was going to write my own code, in java.
First I had to get a working adaptor cable. The tablet has a mini-B type OTG socket. 'Normal' USB connectors always have one type of connector for the host ('A' type, e.g. the flat one in full-sized plugs) and one for the client ('B' type, the square plug) - to make sure that it's not possible to create host-host or client-client connection. For USB OTG, the same socket on the device can be used as host or client, so the shape of the socket needs to accept plugs intended for either clients or hosts. To tell the device to switch (think of connecting two phones, one will need to become host), there must be something different in one of the two plugs. The difference is the 'X' or 'ID' pin (pin 4) - for clients, it is left floating; on the host side this pin is connected to ground. And, as I already found out, to tell the device that it is host, but allowed to charge of VBUS, that pin is connected to ground through a 124k resistor (but don't take my word on this, read the spec, and make sure your device actually implements this).
So you can't just make your own OTG cable by cutting off a connector from an old USB cable and soldering it onto another one, as the ID pin will be left unconnected. Instead, I bought a solderable Mini-USB plug (the only one I could find in the UK). But what you can't see in the photo is that the ID pin is trimmed off - instead of a solder pad, it only has a stub less than 1mm square! The nice people at hobbytronics confirmed that yes, all the plugs are like that.
But it is possible to solder a wire to it, with a bit of care (and two attempts in my case). The tablet reacts as expected - with the other end of the wire unconnected, it remains in client mode; with the wire touching ground, the tablet goes into host mode and powers the device (e.g. a keyboard works). Connected devices also show in /proc/bus/USB/devices.
That's where it stops. Unfortunately, it appears that Ainol did not bother to support Android's USB host API. When I call UsbManager.getDeviceList(), the result is always empty. I am not the only one with this problem, apparently some tablets do, some don't, implement USB host.
What alternatives are there? FTDI, the makers of the serial/USB chip on my jeenodes, actually provide a nice Android library. Looks ideal, but it uses a native library, and that's only available for ARM. Compiling an FTDI driver into the kernel won't work for a similar reason - there is no source release for ICS that works for MIPS.
It now looks as if I need to change my hardware. Either sell the tablet and find one that does support the host mode API (and runs ARM), or turn the jeenode into a USB host instead. The USB host mini shield seems the cheapest way to do that; the Arduino Mega ADK is a lot more expensive and would need an RFM12b module added. With the tablet running as client, I should be able to use the Android Accessory Protocol mode - running as client would also solve the power problem. That's assuming the AAP API is implemented, but I can (and will) test that.
Showing posts with label USB host. Show all posts
Showing posts with label USB host. Show all posts
Thursday, 1 March 2012
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)