chipKIT® Development Platform

Inspired by Arduino™

[Android App] PIC32USB Hardwired Serial Communication (Free)

Created Tue, 14 Jul 2015 04:13:54 +0000 by djgardn2


Tue, 14 Jul 2015 04:13:54 +0000

The latest Android application I’ve written is called "PIC32USB.” This simple-to-use app features:

  • 24 buttons to control your microcontroller with a press of the button (see Photo #1)
  • Ability to send/receive data to/from the PIC32 MCU via chat-like terminal view layout (see Photo #2)
  • To change the string, simply long-press any of the buttons (see Photo #3) or use the chat like terminal view to type any string you would like.
  • App auto-launches when PIC32-based boards are connected (see Photo #4)

For photos see this link: [url][/url]

As a USB application, the PIC32 microcontroller board must be connected to an OTG-supported phone or tablet using an OTG USB hardwired connection. Also note that this works only with PIC32 boards that have a direct USB connection to the D+ and D- pins on the microcontroller, with no other chip in between. I have successfully tested the PIC32USB app with the Fubarino Mini, Fubarino SD, and my MAKEmicro32 board--seen in the YouTube video below--which are the only boards I have that use a direct USB connection to the PIC32 D+ and D- pins. Note, that at this time, PIC32 boards with FTDI_USB-to-serial chips are currently not supported in this app, please see my other app "PICFTDI" that supports PIC32 boards with FTDI_USB-to-serial chips. In addition, note that no extra shield or code libraries are required. All you need to use is Serial.begin(9600).

I created this app to allow anyone to create fun and unique projects using a hardwired connection from an Android phone/tablet to a PIC32-based board. For example, what if you wanted to password protect a drawer, keeping it locked while you (and your Android device) were away, and unlocking it only when you plugged your Android into your PIC32-based board and the correct password "string" is sent to the PIC32? That's just one example of a cool way to use this app.

Now let's get started:

Note that the code example below is the same as the code example file on my website, and you can see it in action in the video below.

Items you will need:

PIC32 microcontroller
OTG USB cable
OTG supported Android device

PIC32USB: [url][/url]

Video: [url][/url]

// Microcontroller code example
String inputString ="";
char incoming = 0;
void setup ()
  pinMode(PIN_LED1, OUTPUT);
  //Add pinMode for LEDs here, etc
void loop ()
      incoming =;
      inputString += String(incoming);
    //must be exact spelling, no extra spaces
    if(inputString == "LED on")
      Serial.print("LED is now on");
      //add code here
    if(inputString == "LED off")
      Serial.print("LED is now off");
      //add code here
  inputString ="";

Please note: Due to the hardwired connection to the phone or tablet, this application is use at your own risk. It is recommended to use an OTG USB cable that allows an external power source if you are drawing more than 200mA of current from the device. Be careful to never create a short from power to ground since you have the potential of damaging your USB connection on your device. I have extensively tested this with most of the available PIC32 microcontrollers without a FTDI_USB-to-serial chip in between. If using an OTG USB cable that allows an external power source it is recommended to only use the factory charger that came with the phone or tablet as the external power source.

This will only work with PIC32 boards that have a direct USB connection to the D+ and D- pins on the microcontroller with no other chip in between. My other app called "PICFTDI" supports PIC32 boards with FTDI_USB-to-serial chips.

Thank you for checking out this application.

Below on the website is two basic programs that can be used, a very simple one for a basic proof of concept and the other one was used in the demo video for the application. The first simple file should be able to be loaded and programmed on any PIC32 board that you have without modifications. [url][/url]

There are 5 more example program files that can be used and modified found in the following link below. [url][/url]


Fri, 17 Jul 2015 06:26:25 +0000

Check out the latest update that is now available for download: ★ Chat like terminal view layout ★ Now can receive data from microcontroller as well as send data ★ Auto launches when PIC32 is connected

I updated the first post with new code and details. My website also includes an image showing the new terminal view too.

On the PIC32 microcontroller use: Serial.begin(9600);

To read data on the microcontroller sent from the Android device use:;

To send data from the microcontroller to the Android device use: Serial.print();

Google Play link: [url][/url]

Website link for more details and files: [url][/url]