0

currently I am building a little project based on the Arduino Mega 2560. My goal is to send some data gathered by some sensors to an Android phone. It has to be as basic as possible. Buying new hardware is no option.

After some research, I found that it is possible to communicate via USB OTG just with Serial commands. I downloaded the an app which can do this (Serial Monitor), connected the Arduino via the USB cable to the Android. Unfortunately, it did not work.

I have an Arduino UNO, too. Connecting the UNO the same way to the phone works like a charm and does exactly what I want.

I did some more research and found nothing about that. It seems that everybody is using the Arduino Mega ADK to establish a communication between Arduino and Android. But I would like to be able to achieve this the same way it works with the UNO.

Can somebody explain me why it does not work?

EDIT Here is the code I have to test:

Arduino

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("Test...");
  delay(2000);
}

For Android I use the code from this tutorial.

Any further suggestions?

  • It this a genuine Arduino Mega 2560 with an ATmega16u2 as the USB solution (small square chip without leads) or a "compatible" with something else? What USB VID/PID is associated with it when connected to a computer? Does it work if you provide 7-12v power through the DC jack? – Chris Stratton Oct 7 '16 at 18:01
  • It's the original Arduino Mega 2560. Where can I see the VID/PID? What is PID? I think VID is vendor ID. But what is PID? I did not tested it with the power jack, yet. Unfortunately, I can test this on Monday, not earlier. – user19698 Oct 8 '16 at 16:16
  • Does the Mega 2560, with the test code you showed us, work when connected to a regular computer? – Edgar Bonet Oct 10 '16 at 8:58
  • Yes, the code does work with the Mega and UNO with my Mac and with a Raspberry Pi. – user19698 Oct 12 '16 at 9:13
0

So I figured it out.

It was the VendorID. I found it and noticed, that the VIDs of the UNO and Mega are different. I adjusted the code and now everything works as I expect. So, thank you Chris Startton for the correct hints.

Thank you all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy