Anyone have any ideas if this will work on the photon? I don’t see any reason why it wouldn’t. Just need to think of some simple .ino program to test it out. As far as powering the photon I think it is a bit dangerous as the mA that are used on your photon would have to be below about 500mA, but for just getting a serial printout, this would be very useful.
I wouldn’t see why it shouldn’t work, and the “danger” should be marginal becaus USB ports usually have an electronic fuse in case of excessive current draw. If you phone hasn’t you might want to bin it anyway
Got it working after a few bumps. Hooked the Data cable up the wrong way. It needs to be connected to the phone not the Photon.
The USB Serial Monitor Lite Worked on Android KitKat 4.4 but not on my Tablet version 5.1. (Lollipop} Simple to operate, hook up the cable. Gave an error message but then was OK.
Settings --> Open Device and it worked.
int analogValue = 0; // Hold A0 value = 0-4095
int incomingByte = 0; // for incoming serial data
void setup()
{
Serial.begin(9600);
}
void loop() {
analogValue = analogRead(A0); // pin A0
Serial.println(analogValue);
if (Serial.available() > 0) { // read the incoming byte:
incomingByte = Serial.read();
Serial.println(incomingByte, DEC);
if (incomingByte == 97){ // ascii code for small letter 'a'
Serial.println("Wow");
}
}
delay(2000); // probably not a good idea but slows things down so I can see it.
}
What was fairly cool was that you could also send ascii codes. Every time the “Write” button is clicked it send Ascii 10.
The code above tests for Ascii 97 which is small letter “a”
So the Photon can be used as a Cell Phone Dongle! That is fairly cool, except useless unless we can control it. So I thought I would look into a Phonegap (Cordova) App. Of course nothing is easy.
Thanks @peekay123. I got it working, In very draft form. The github site is at
It will be much better when cloud9 makes the Android-SDK docker image I have been asking for (they are working on it, I submitted the dockerfile three weeks ago)
Basically it is an entire Android-SDK, node, python, ant, gradle, apache2 online ubuntu server for free (limitations unless you want to pay, it shuts down every 24 hours, which is fine with me). I have used it to make a phonegap android app .apk ready to download from a webpage to install on your phone in about three clicks.
I will write it up better when I am less exhausted.
Basically anyone who knows how to make webpages should be able to use the photon as an Android Dongle to control whatever they are connected to.
I've been trying to get my Electron to communicate with my Android device (Lollipop) over the USB OTG cable with no luck. I started by following @rickkas7 tutorial here:
The Android Serial Monitor Lite app simply crashes when I plug in my Electron over OTG, no matter how many times I try it. I dug into the source code and found drivers like the ones mentioned above:
Created a POC Android app and tried all of them and none of them work. My Android phone recognizes the device with the proper Vendor/Product ID but any logic that tries to interact with it in these drivers fails.
I guess I need some help getting set in the right direction. Which of these drivers is supposed to work for the Electron? How does the driver work that allows the Electron to send serial messages to other platforms like Windows (i.e. particle serial monitor)? I'm wondering if I can make edits to the Android drivers above to get them working with the Electron.
I’ve seen an instance of this operating very recently, but my takeaway is very dubious in nature. My reason is that the Droid side support is sketch as I’ve not seen any indication that OTG enumeration makes a UART VCP?
I know FTDI has some silicon solutions (311/312) that utilize Android AOA and stream IO, so if anyone can cite the combination of things required for real OTG/Serial in Android I’d be highly appreciative.
Hoping someone here on this maker forum will jump in with this info? Having this connectable to Photon is a game changer for me.
I got this working by using an external FTDI chip and connecting it to the serial pins on the Electron. I used this:
Connect orange to RX
Connect yellow to TX
Connect black to GND
Connect red to 3.3
The USB side of it connects to the OTG cable, which then connects to the Android device.
At this point the Android Serial Monitor Lite app works fine. I also tried this library and it worked:
It seems like there are a lot of library/driver options when using this FTDI chip. You can use the FTDI D2XX driver directly if you want.
I wish I could get it working connecting directly to the MicroUSB port on the Electron, but this method has its advantages because it frees up the MicroUSB port for charging the Electron while it’s connected to the Android device.
The cable you cite uses the FT232R USB/Serial silicon. I’ve used this chip on small “dongle boards” for enumerating VCP’s on PC hosts. I’m intrigued that it enumerates to Android when used with the Android USB Host API. I’ll look deeper at this lib and it’s underlying operation. Now if they only made this cable with a microB connector to avoid the OTG adapter?
I also just received the UMFT311EV which uses the FT311 silicon interface and enumerates to Android using the AOA API and streams in/out as a file like device (with many additional interface options).
Trying with no luck to implement the direct “Photon to Android” OTG serial connection as outlined here in the @rickkas7 tutorial: Serial Tutorial
I’ve tried multiple Android devices (S3 running v4.1.2 / S5 running 6.0.1) and I’ve tried all variants of potential USB configuration in my Android 6 device (charging, MTP, PTP, etc…).
I’ve also verified the cables are operational (connecting to other devices), and I’ve downloaded the cited Play Store app (and others) to no avail.
Does anyone have an operational tandem of Photon and Android software, and if so could you please share the particulars? Having a small serial debug terminal on a Smart Phone would be a great tool for my applications.
It’s really hit or miss whether OTG works or not. I wrote that section of the Serial Tutorial using a Moto G3 running Marshmallow 6.0. I tried a few other serial programs before getting Android USB Serial Monitor Lite to work, so you very well may find one of the others work better on a different phone/OS version.